This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@SuppressWarnings({ "WeakerAccess", "unused" }) public class SQLQueryBuilder { | |
private static final String STATEMENT_SELECT = "SELECT"; | |
private static final String STATEMENT_DISTINCT_SELECT = "SELECT DISTINCT"; | |
private static final String STATEMENT_UPDATE = "UPDATE"; | |
private static final String STATEMENT_INSERT_INTO = "INSERT INTO"; | |
private static final String STATEMENT_DELETE = "DELETE FROM"; | |
private static final String WHERE = "WHERE"; | |
private static final String FROM = "FROM"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ProgressView extends View { | |
private static final int DEFAULT_PROGRESS = 0; | |
private static final int DEFAULT_PROGRESS_MAX = 100; | |
private static final int DEFAULT_COLOR_BACKGROUND = Color.GRAY; | |
private static final int DEFAULT_COLOR_PROGRESS = Color.BLUE; | |
private Paint paintProgress; | |
private Paint paintProgressBackground; | |
private int height; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
android.libraryVariants.all { variant -> | |
String taskName = "makeJar${variant.name.capitalize()}" | |
task(taskName, type: Copy) { | |
String baseFileName = "${project.name}-${variant.name}" | |
String outputDir = "${buildDir.getPath()}/outputs" | |
dependsOn "assemble${variant.name.capitalize()}" | |
from(zipTree("${outputDir}/aar/${baseFileName}.aar")) | |
into("${outputDir}/jar/") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TintedProgressBar extends ProgressBar { | |
public TintedProgressBar(Context context) { | |
this(context, null); | |
} | |
public TintedProgressBar(Context context, AttributeSet attrs) { | |
this(context, attrs, 0); | |
} | |
public TintedProgressBar(Context context, AttributeSet attrs, int defStyleAttr) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* +info: https://gist.github.com/romannurik/3982005 | |
*/ | |
public class ToolTipView { | |
public static final int LENGTH_SHORT = Toast.LENGTH_SHORT; | |
public static final int LENGTH_LONG = Toast.LENGTH_LONG; | |
@Retention(RetentionPolicy.CLASS) @IntDef({ LENGTH_SHORT, LENGTH_LONG }) public @interface Duration { | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class AppCompatPreferenceActivity extends PreferenceActivity { | |
private AppCompatDelegate appCompatDelegate; | |
@Override protected void onCreate(Bundle savedInstanceState) { | |
getDelegate().installViewFactory(); | |
getDelegate().onCreate(savedInstanceState); | |
super.onCreate(savedInstanceState); | |
} | |
@Override protected void onPostCreate(Bundle savedInstanceState) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int sizePx = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, sizeDp, context.getResources().getDisplayMetrics()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class PlayServicesUtils { | |
private static String advertisingId = ""; | |
private static boolean limitAdTrackingEnabled = false; | |
private PlayServicesUtils() { | |
} | |
public static void prepareAdvertisingId(final Context context) { | |
if (TextUtils.isEmpty(advertisingId)) { | |
new Thread(new Runnable() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CustomLayout extends LinearLayout { | |
@SuppressWarnings("unchecked") @Override public Parcelable onSaveInstanceState() { | |
Parcelable saveInstanceState = super.onSaveInstanceState(); | |
SavedState savedState = new SavedState(saveInstanceState); | |
savedState.childrenStates = new SparseArray(); | |
for (int i = 0; i < getChildCount(); i++) { | |
getChildAt(i).saveHierarchyState(savedState.childrenStates); | |
} | |
return savedState; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public final class ReverseIterable { | |
private ReverseIterable() { | |
} | |
public static <T> Iterable<T> reverse(final List<T> list) { | |
return new ListReverseIterable<>(list); | |
} | |
private static class ListReverseIterable<T> implements Iterable<T> { | |
private final List<T> list; |