List of usage examples for android.support.v4.app FragmentManager findFragmentByTag
public abstract Fragment findFragmentByTag(String tag);
From source file:com.dm.material.dashboard.candybar.fragments.dialog.IntentChooserFragment.java
public static void showIntentChooserDialog(@NonNull FragmentManager fm, @NonNull Request request) { FragmentTransaction ft = fm.beginTransaction(); Fragment prev = fm.findFragmentByTag(TAG); if (prev != null) { ft.remove(prev);/*from www . j a v a 2 s. c o m*/ } try { DialogFragment dialog = IntentChooserFragment.newInstance(request); dialog.show(ft, TAG); } catch (IllegalArgumentException | IllegalStateException ignored) { } }
From source file:com.cylan.jiafeigou.utils.ActivityUtils.java
public static boolean addFragmentSlideInFromRight(FragmentManager fragmentManager, Fragment fragment, int containerId) { final String tag = fragment.getClass().getSimpleName(); Fragment f = fragmentManager.findFragmentByTag(tag); if (f != null && f.isVisible()) { return false; }/*from w w w . j av a 2 s . c om*/ fragmentManager.beginTransaction() .setCustomAnimations(R.anim.slide_right_in, R.anim.slide_out_left, R.anim.slide_out_right, R.anim.slide_out_right) .add(containerId, fragment, tag).addToBackStack(tag).commitAllowingStateLoss(); return true; }
From source file:com.cylan.jiafeigou.utils.ActivityUtils.java
public static boolean addFragmentSlideInFromLeft(FragmentManager fragmentManager, Fragment fragment, int containerId) { final String tag = fragment.getClass().getSimpleName(); Fragment f = fragmentManager.findFragmentByTag(tag); if (f != null && f.isVisible()) { return false; }// ww w . jav a 2 s. com fragmentManager .beginTransaction().setCustomAnimations(R.anim.slide_in_left, R.anim.slide_out_left, R.anim.slide_out_right, R.anim.slide_out_right) .add(containerId, fragment, tag).addToBackStack(tag).commit(); return true; }
From source file:android.com.example.contactslist.util.ImageCache.java
/** * Locate an existing instance of this Fragment or if not found, create and * add it using FragmentManager./*w ww .ja v a2s. c om*/ * * @param fm The FragmentManager manager to use. * @return The existing instance of the Fragment or the new instance if just * created. */ public static RetainFragment findOrCreateRetainFragment(FragmentManager fm) { // Check to see if we have retained the worker fragment. RetainFragment mRetainFragment = (RetainFragment) fm.findFragmentByTag(TAG); // If not retained (or first time running), we need to create and add it. if (mRetainFragment == null) { mRetainFragment = new RetainFragment(); fm.beginTransaction().add(mRetainFragment, TAG).commitAllowingStateLoss(); } return mRetainFragment; }
From source file:com.github.baoti.pioneer.ui.common.image.chooser.ImageChooserFragment.java
public static ImageChooserFragment showDialog(FragmentManager fragmentManager, boolean crop) { ImageChooserFragment fragment = (ImageChooserFragment) fragmentManager .findFragmentByTag(TAG_FRAG_IMAGE_CHOOSER); if (fragment == null) { fragment = new ImageChooserFragment(); fragment.setStyle(STYLE_NO_FRAME, R.style.AppTheme_Dialog); }//from ww w . j a v a 2 s. com Bundle args = new Bundle(); args.putBoolean(ARG_CROP, crop); fragment.setArguments(args); fragment.show(fragmentManager, TAG_FRAG_IMAGE_CHOOSER); return fragment; }
From source file:com.cylan.jiafeigou.utils.ActivityUtils.java
public static boolean addFragmentSlideInFromRight(FragmentManager fragmentManager, Fragment fragment, int containerId, boolean noStack) { final String tag = fragment.getClass().getSimpleName(); Fragment f = fragmentManager.findFragmentByTag(tag); if (f != null && f.isVisible()) { return false; }//w w w . ja va 2s. co m fragmentManager.beginTransaction().setCustomAnimations(R.anim.slide_right_in, R.anim.slide_out_left, R.anim.slide_out_right, R.anim.slide_out_right).add(containerId, fragment, tag).commit(); return true; }
From source file:com.cylan.jiafeigou.utils.ActivityUtils.java
public static boolean addFragmentSlideInFromLeft(FragmentManager fragmentManager, Fragment fragment, int containerId, boolean noStatck) { final String tag = fragment.getClass().getSimpleName(); Fragment f = fragmentManager.findFragmentByTag(tag); if (f != null && f.isVisible()) { return false; }/* w w w .j a v a 2 s .c o m*/ fragmentManager.beginTransaction().setCustomAnimations(R.anim.slide_in_left, R.anim.slide_out_left, R.anim.slide_out_right, R.anim.slide_out_right).add(containerId, fragment, tag).commit(); return true; }
From source file:com.cylan.jiafeigou.utils.ActivityUtils.java
public static boolean addFragmentSlideInFromRight(FragmentManager fragmentManager, Fragment fragment, int containerId, String stackName) { final String tag = fragment.getClass().getSimpleName(); Fragment f = fragmentManager.findFragmentByTag(tag); if (f != null && f.isVisible()) { return false; }//from ww w . j a v a 2 s . c o m fragmentManager.beginTransaction() .setCustomAnimations(R.anim.slide_right_in, R.anim.slide_out_left, R.anim.slide_out_right, R.anim.slide_out_right) .add(containerId, fragment, tag).addToBackStack(stackName).commitAllowingStateLoss(); return true; }
From source file:com.bdevlin.apps.utils.HelpUtils.java
public static void showOpenSourceLicenses(FragmentActivity activity) { FragmentManager fm = activity.getSupportFragmentManager(); FragmentTransaction ft = fm.beginTransaction(); Fragment prev = fm.findFragmentByTag("dialog_licenses"); if (prev != null) { ft.remove(prev);/*from w w w . ja v a2 s . c o m*/ } ft.addToBackStack(null); new OpenSourceLicensesDialog().show(ft, "dialog_licenses"); }
From source file:com.hpush.app.fragments.AboutDialogFragment.java
/** * To open showing open source licenses. * * @param activity/*from w w w . ja v a 2 s .c o m*/ * Host {@link android.support.v4.app.FragmentActivity}. */ private static void showOpenSourceLicenses(FragmentActivity activity) { FragmentManager fm = activity.getSupportFragmentManager(); FragmentTransaction ft = fm.beginTransaction(); Fragment prev = fm.findFragmentByTag("dialog_licenses"); if (prev != null) { ft.remove(prev); } ft.addToBackStack(null); new OpenSourceLicensesDialog().show(ft, "dialog_licenses"); }