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
@SuppressWarnings("unchecked") public abstract class DRMVPFragmentV4<P extends DRMVPPresenter<V>, V extends DRMVPView> extends Fragment { | |
private P presenter; | |
@CallSuper @Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { | |
return inflater.inflate(getLayoutResId(), container, false); | |
} | |
@CallSuper @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { | |
presenter = MVPUtils.getDeclaredPresenter(getClass()); | |
presenter.bind((V) this); |
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
@SuppressWarnings("unchecked") public abstract class DRMVPAppCompatActivity<P extends DRMVPPresenter<V>, V extends DRMVPView> | |
extends AppCompatActivity { | |
private P presenter; | |
@CallSuper @Override protected void onCreate(@Nullable Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(getLayoutResId()); | |
presenter = MVPUtils.getDeclaredPresenter(getClass()); | |
presenter.bind((V) this); | |
} |
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 StateRecyclerView extends RecyclerView { | |
private View emptyView; | |
private int emptyViewId; | |
public StateRecyclerView(Context context) { | |
this(context, null); | |
} | |
public StateRecyclerView(Context context, @Nullable AttributeSet attrs) { | |
this(context, attrs, 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
def appVersionMajor = 1 | |
def appVersionMinor = 0 | |
def appVersionPatch = 0 | |
def appVersionBuild = 0 | |
appVersionCode = appVersionMajor * 1000000 + appVersionMinor * 10000 + appVersionPatch * 100 + appVersionBuild | |
appVersionName = "${appVersionMajor}.${appVersionMinor}.${appVersionPatch}" |
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 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; |
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 CustomLayout extends LinearLayout { | |
@SuppressWarnings("unchecked") @Override public Parcelable onSaveInstanceState() { | |
Parcelable saveInstanceState = super.onSaveInstanceState(); | |
SavedState savedState = new SavedState(saveInstanceState); | |
savedState.childrenStates = new SparseArray(); | |
for (int i = 0; i < getChildCount(); i++) { | |
getChildAt(i).saveHierarchyState(savedState.childrenStates); | |
} | |
return savedState; |
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 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 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
int sizePx = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, sizeDp, context.getResources().getDisplayMetrics()); |
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 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 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
/* | |
* +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 { | |
} |