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 PreDrawer<T extends View> { | |
// Private constructor prevent instantiation by the caller. Use addPredrawer() method instead. | |
private PreDrawer(final T view) { | |
// Adds the observer to the given view, then calls notifyPredraw() when clean up has been done ready | |
final ViewTreeObserver viewTreeObserver = view.getViewTreeObserver(); | |
viewTreeObserver.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() { | |
@Override | |
public boolean onPreDraw() { |
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 CancelEditTextListener { | |
private EditText widget; | |
private Drawable[] hideDrawables; | |
private Drawable canceler; | |
public CancelListener(EditText editText) { | |
widget = editText; | |
widget.addTextChangedListener(textWatcher); | |
View.OnTouchListener touchListener = (v, event) -> { |
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
// Defines the actions of the Zoomer class. Feel free to implement as you see fit | |
public interface MotionEventHandler { | |
// Defines which "Mode" the user is in. NONE means they have not taken any action, DRAG means tehy're dragging, | |
// ZOOM means they're zooming | |
enum Mode { | |
NONE, | |
DRAG, | |
ZOOM | |
} |
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 BaseFragment extends Fragment { | |
@Override | |
public void onAttach(Context context) { | |
super.onAttach(context); | |
((MainApp) context.getApplicationContext()).getApplicationComponent().inject(this); | |
Map<Object, Class> map = getCastMap(); | |
for (Object object: map.keySet()) { | |
Class clazz = map.get(object); |
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
task appStart(type: Exec, dependsOn: 'installDebug') { | |
def adb = "$System.env.ANDROID_HOME/platform-tools/adb" | |
commandLine "$adb", 'shell', 'am', 'start', '-n', 'package.name/activityclass' | |
} |