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 BaseActivity extends AppCompatActivity { | |
private Toolbar toolbar; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(getLayoutResource()); | |
toolbar = (Toolbar) findViewById(R.id.toolbar); | |
if (toolbar != null) { |
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 ColorDividerItemDecoration extends RecyclerView.ItemDecoration { | |
private static final int DEFAULT_DIVIDER_COLOR = Color.GRAY; | |
private static final int DEFAULT_DIVIDER_SIZE_PX = 1; | |
private static final boolean DEFAULT_DIVIDER_SHOW_FIRST = false; | |
private static final boolean DEFAULT_DIVIDER_SHOW_LAST = false; | |
private final boolean showFirstDivider; | |
private final boolean showLastDivider; | |
private final Paint paint; |
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 RightAlignedHorizontalScrollView extends HorizontalScrollView { | |
private static final boolean DEFAULT_GRAVITY_RIGHT = true; | |
private static final boolean DEFAULT_AUTOSCROLL = true; | |
private boolean autoScroll; | |
private boolean gravityRight; | |
public RightAlignedHorizontalScrollView(Context context) { | |
this(context, null); | |
} |
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 TextViewDrawableSize extends TextView { | |
private static final int DEFAULT_COMPOUND_DRAWABLE_SIZE = -1; | |
private int compoundDrawableWidth; | |
private int compoundDrawableHeight; | |
public TextViewDrawableSize(Context context) { | |
this(context, null); | |
} | |
public TextViewDrawableSize(Context context, AttributeSet attrs) { |
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 PreferencesObjectHelper<T> { | |
private static final String TAG = "PreferencesObjectHelper"; | |
private final SharedPreferences preferences; | |
private final SharedPreferences.Editor editor; | |
@SuppressLint("CommitPrefEdits") | |
public PreferencesObjectHelper(Context context, String fileName) { | |
preferences = context.getSharedPreferences(fileName, Context.MODE_PRIVATE); | |
editor = preferences.edit(); |
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
@IntDef({ | |
FIND_STREAK_LESS_THAN_ZERO, FIND_STREAK_LESS_EQUAL_TO_ZERO, FIND_STREAK_LESS_GREATER_ZERO | |
}) @Retention(RetentionPolicy.SOURCE) public @interface FIND_STREAK_OPERATOR { | |
} | |
public static final int FIND_STREAK_LESS_THAN_ZERO = 0; | |
public static final int FIND_STREAK_LESS_EQUAL_TO_ZERO = 1; | |
public static final int FIND_STREAK_LESS_GREATER_ZERO = 2; | |
public int findLongestStreak(float[] values, @FIND_STREAK_OPERATOR int operator) { |
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 BasePreferenceActivity extends PreferenceActivity { | |
private AppCompatDelegate appCompatDelegate; | |
private Toolbar toolbar; | |
protected abstract int getPreferencesResource(); | |
protected abstract int getLayoutResource(); | |
protected abstract int getTitleResource(); |
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 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 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
# Built application files | |
*.apk | |
*.ap_ | |
# Files for the Dalvik VM | |
*.dex | |
# Java class files | |
*.class |
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 UnderlineTextView extends TextView { | |
private Context context; | |
private int textColor; | |
public UnderlineTextView(Context context) { | |
this(context, null); | |
} | |
public UnderlineTextView(Context context, AttributeSet attrs) { | |
this(context, attrs, 0); |