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 CustomGenerateViewId { | |
private static final AtomicInteger nextGeneratedId = new AtomicInteger(1); | |
public static int customGenerateViewId() { | |
for (; ; ) { | |
final int result = nextGeneratedId.get(); | |
// aapt-generated IDs have the high byte nonzero; clamp to the range under that. | |
int newValue = result + 1; | |
if (newValue > 0x00FFFFFF) { | |
newValue = 1; // Roll over to 1, not 0. | |
} |
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 Log { | |
static final boolean isLoggable = BuildConfig.DEBUG; | |
static final String TAG = BuildConfig.APPLICATION_ID; | |
public static void i(String tag, String string) { | |
if (isLoggable) android.util.Log.i(tag, string); | |
} | |
public static void i(String string) { | |
if (isLoggable) android.util.Log.i(TAG, string); |
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
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(); |
NewerOlder