Skip to content

Instantly share code, notes, and snippets.

/*
* Copyright 2012-2014 the original author or authors.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@indraAsLesmana
indraAsLesmana / proguard-rules.pro
Created February 25, 2018 12:00 — forked from jemshit/proguard-rules.pro
Proguard rules for common Android libraries
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
-keepclassmembers class fqcn.of.javascript.interface.for.webview {
public *;
}
### RxJava, RxAndroid (https://gist.github.com/kosiara/487868792fbd3214f9c9)
-keep class rx.schedulers.Schedulers {
public static <methods>;
@indraAsLesmana
indraAsLesmana / GPSTracker.java
Created October 15, 2018 15:22 — forked from rupakraj/GPSTracker.java
To get the current location of the android phone; GPS; Traking
package np.com.rupakraj.util;
import android.app.AlertDialog;
import android.app.Service;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
@indraAsLesmana
indraAsLesmana / EqualSpacingItemDecoration.java
Created April 23, 2019 22:22 — forked from alexfu/EqualSpacingItemDecoration.java
Add equal spacing to RecyclerView items automatically. Can handle horizontal, vertical, and grid display modes
import android.graphics.Rect;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
public class EqualSpacingItemDecoration extends RecyclerView.ItemDecoration {
private final int spacing;
private int displayMode;
public static final int HORIZONTAL = 0;
image: node:latest
cache:
paths:
- node_modules/
- app/bower_components
deploy_production:
stage: deploy
environment: Production
@indraAsLesmana
indraAsLesmana / shadow.xml
Created March 11, 2020 23:31 — forked from lecho/shadow.xml
Android shadow drawable xml.
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<!-- Drop Shadow Stack -->
<item>
<shape>
<padding
android:bottom="1dp"
android:left="1dp"
android:right="1dp"
DateTime.ToString() Patterns
All the patterns:
0 MM/dd/yyyy 08/22/2006
1 dddd, dd MMMM yyyy Tuesday, 22 August 2006
2 dddd, dd MMMM yyyy HH:mm Tuesday, 22 August 2006 06:30
3 dddd, dd MMMM yyyy hh:mm tt Tuesday, 22 August 2006 06:30 AM
4 dddd, dd MMMM yyyy H:mm Tuesday, 22 August 2006 6:30
5 dddd, dd MMMM yyyy h:mm tt Tuesday, 22 August 2006 6:30 AM
@indraAsLesmana
indraAsLesmana / RecyclerMargin.kt
Last active November 20, 2020 02:49
Create recyclerview margin, end, middle, start margin of item
import android.graphics.Rect
import androidx.recyclerview.widget.RecyclerView
import android.view.View
/**
* this widget add margin to start
* @param outReact.left to change margin start
*
* */
class RecyclerMargin(
@indraAsLesmana
indraAsLesmana / DinamicAdsMarginFullscreenMode.kt
Last active January 13, 2021 23:14
Add dinamic buttom margin, when scrren in immersive mode/fullscreen
private fun setDinamicAdsMarginFullscreenMode() {
val bottomMargin = getNavigationBarHeight(this, resources.configuration.orientation)
if (adView?.layoutParams is MarginLayoutParams) {
(adView?.layoutParams as MarginLayoutParams).setMargins(
0,
top,
0,
bottomMargin
)
adView?.requestLayout()
@indraAsLesmana
indraAsLesmana / task_screen.dart
Created April 26, 2022 01:15
ModalBottomSheet above Keyboard
showModalBottomSheet(
context: context,
isScrollControlled: true,
builder: (context) => SingleChildScrollView(
child: Container(
color: Color(0xff757575),
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom),
child: Container(
padding: EdgeInsets.all(20.0),