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 BasePreferenceActivity extends PreferenceActivity { | |
private AppCompatDelegate appCompatDelegate; | |
private Toolbar toolbar; | |
protected abstract int getPreferencesResource(); | |
protected abstract int getLayoutResource(); | |
protected abstract int getTitleResource(); |
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 hideSoftKeyboard(Activity context) { | |
View view = context.getCurrentFocus(); | |
if (view == null) { | |
return; | |
} | |
InputMethodManager inputMethodManager = | |
(InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); | |
inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), | |
InputMethodManager.HIDE_NOT_ALWAYS); |
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 DisplayLeakConnectorView extends View { | |
private static final float DEFAULT_STROKEWIDTH = 4f; | |
private static final int DEFAULT_COLOR_BRANCH = 0xFFbababa; | |
private static final int DEFAULT_COLOR_ROOT = 0xFF84a6c5; | |
private static final int DEFAULT_COLOR_LEAK = 0xFFb1554e; | |
public static final int TYPE_START = -1; | |
public static final int TYPE_NODE = 0; | |
public static final int TYPE_END = 1; | |
public static final int TYPE_DEFAULT = TYPE_NODE; |
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 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 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 UniversalFragmentPagerAdapter extends FragmentPagerAdapter { | |
private final String[] tabTitles; | |
private final Fragment[] tabFragments; | |
public UniversalFragmentPagerAdapter(@NonNull FragmentManager fm, String[] tabTitles, | |
@NonNull Fragment[] tabFragments) { | |
super(fm); | |
if (tabTitles != null && tabTitles.length != tabFragments.length) { | |
throw new IllegalArgumentException(); | |
} |
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 FontCache { | |
private static final Map<String, Typeface> mapFont = new HashMap<>(); | |
public static Typeface getFont(Context context, String fontName) { | |
Typeface typeface = mapFont.get(fontName); | |
if (typeface == null) { | |
try { | |
typeface = Typeface.createFromAsset(context.getAssets(), fontName); | |
} catch (Exception e) { |
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 AdvancedRadioGroup extends LinearLayout { | |
private int radioButtonCheckedId; | |
private boolean working; | |
private RadioGroup.OnCheckedChangeListener listener; | |
public AdvancedRadioGroup(Context context) { | |
this(context, null); | |
} |
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 TextViewFont extends TextView { | |
public TextViewFont(Context context) { | |
this(context, null); | |
} | |
public TextViewFont(Context context, AttributeSet attrs) { | |
this(context, attrs, 0); | |
} | |
public TextViewFont(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
public class UniversalFragmentStatePagerAdapter extends FragmentStatePagerAdapter { | |
private final String[] titles; | |
private final Fragment[] fragments; | |
public UniversalFragmentStatePagerAdapter(@NonNull FragmentManager fragmentManager, | |
String[] titles, @NonNull Fragment[] fragments) { | |
super(fragmentManager); | |
if (titles != null && titles.length != fragments.length) { | |
throw new IllegalArgumentException(); | |
} |
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 TextViewWriter extends TextView { | |
private static final int DEFAULT_DELAY_MS = 150; | |
private static final boolean DEFAULT_AUTOSTART = false; | |
public static final int MODE_CHARACTER = 0; | |
public static final int MODE_WORD = 1; | |
private static final int DEFAULT_MODE = MODE_CHARACTER; | |
@Retention(RetentionPolicy.SOURCE) @IntDef({ MODE_CHARACTER, MODE_WORD }) public @interface Mode { | |
} |