This file contains 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 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 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 SquareRelativeLayout extends RelativeLayout { | |
public SquareRelativeLayout(Context context) { | |
this(context, null); | |
} | |
public SquareRelativeLayout(Context context, AttributeSet attrs) { | |
this(context, attrs, 0); | |
} | |
This file contains 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 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 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 void addListener(Listener listener) { | |
if (listeners == null) { | |
listeners = new ArrayList<>(); | |
} | |
listeners.add(listener); | |
} | |
public void removeListener(Listener listener) { | |
if (listeners != null) { | |
int position = listeners.indexOf(listener); |
This file contains 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
class ImageCenteredSpan extends ImageSpan { | |
public ImageCenteredSpan(Drawable d) { | |
super(d); | |
} | |
@Override | |
public void draw(Canvas canvas, CharSequence text, | |
int start, int end, float x, | |
int top, int y, int bottom, Paint paint) { | |
Drawable b = getDrawable(); |
This file contains 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 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 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; |