private void reloadFragment(DrawerItem dt) { FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); fragmentTransaction.replace(getFragmentId(), dt.getFragment(), dt.getName()); if (mPrefs.getAnimationsEnabled()) fragmentTransaction.setCustomAnimations(R.anim.enter, R.anim.exit, R.anim.pop_enter, R.anim.pop_exit); fragmentTransaction.commit(); }
/** * @param context for resource retrieval * @param di drawer type * @param i identifier for drawer item */ public static PrimaryDrawerItem getPrimaryDrawerItem(final Context context, DrawerItem di, int i) { return new PrimaryDrawerItem().withName(context.getResources().getString( di.getTitleID())).withIdentifier(i).withIcon( IconUtils.getVectorDrawable(context, di.getIconRes())) .withIconTintingEnabled(true); }
!item.isSecondary() ? DrawerItem.getPrimaryDrawerItem(this, item, position) : DrawerItem.getSecondaryDrawerItem(this, item, position));
private void switchFragment(long itemId, DrawerItem dt) { // Don't allow re-selection of the currently active item if (currentItem == itemId) return; currentItem = itemId; // TODO Make sure this works fine even after configuration changes if ((dt == DrawerItem.HOME) && (pickerKey == 0) && (shortcut == null || shortcut.length() < 1)) { expandAppBar(mPrefs != null && mPrefs.getAnimationsEnabled()); } else { collapseAppBar(mPrefs != null && mPrefs.getAnimationsEnabled()); } if (dt == DrawerItem.HOME) { icon1.setVisibility(View.INVISIBLE); icon2.setVisibility(View.INVISIBLE); icon3.setVisibility(View.INVISIBLE); icon4.setVisibility(View.INVISIBLE); } //Fragment Switcher reloadFragment(dt); cCollapsingToolbarLayout.setTitle(dt.getName().equals("Home") ? Config.get().string(R.string.app_name) : getString(dt.getTitleID())); drawer.setSelection(itemId); }
@Override public int getTitleId() { return DrawerActivity.DrawerItem.APPLY.getTitleID(); }
@Override public int getTitleId() { return DrawerActivity.DrawerItem.WALLPAPERS.getTitleID(); }
@Override public int getTitleId() { return DrawerActivity.DrawerItem.HOME.getTitleID(); }
@Override public int getTitleId() { return DrawerActivity.DrawerItem.CREDITS.getTitleID(); }
@Override public int getTitleId() { return DrawerActivity.DrawerItem.PREVIEWS.getTitleID(); }
@Override public int getTitleId() { return DrawerActivity.DrawerItem.DONATE.getTitleID(); }
@Override public int getTitleId() { return DrawerActivity.DrawerItem.FAQS.getTitleID(); }
@Override public int getTitleId() { return DrawerActivity.DrawerItem.ZOOPER.getTitleID(); }
@Override public int getTitleId() { return DrawerActivity.DrawerItem.KUSTOM.getTitleID(); }
@Override public int getTitleId() { return DrawerActivity.DrawerItem.PREVIEWS.getTitleID(); }
@Override public int getTitleId() { return DrawerActivity.DrawerItem.REQUESTS.getTitleID(); }
/** * @param context for resource retrieval * @param di drawer type * @param i identifier for drawer item */ public static SecondaryDrawerItem getSecondaryDrawerItem(final Context context, DrawerItem di, int i) { return new SecondaryDrawerItem().withName(context.getResources().getString( di.getTitleID())).withIdentifier(i); }