List of usage examples for android.support.v4.app FragmentActivity getSupportFragmentManager
public FragmentManager getSupportFragmentManager()
From source file:com.example.signintest.SignInFragment.java
/** * Attach a SignInFragment to manage authentication in your activity. * //from w ww . ja v a 2 s.c om * @param activity The activity to attach the fragment to * @return */ public static SignInFragment getSignInFragment(FragmentActivity activity) { // Check if the fragment is already attached. FragmentManager fragmentManager = activity.getSupportFragmentManager(); Fragment fragment = fragmentManager.findFragmentByTag(TAG_SIGNIN_FRAGMENT); if (fragment instanceof SignInFragment) { return (SignInFragment) fragment; } SignInFragment signInFragment = new SignInFragment(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); fragmentTransaction.add(signInFragment, TAG_SIGNIN_FRAGMENT); fragmentTransaction.commit(); return signInFragment; }
From source file:org.runbuddy.tomahawk.utils.PreferenceUtils.java
/** * Starts the AskAccessActivity in order to ask the user for permission to the notification * listener, if the user is logged into Hatchet and we don't already have access *///from w w w . ja va 2s.com public static void askAccess(FragmentActivity activity) { if (AuthenticatorManager.get().getAuthenticatorUtils(TomahawkApp.PLUGINNAME_HATCHET).isLoggedIn()) { mPreferences.edit().putBoolean(ASKED_FOR_ACCESS, true).apply(); new AskAccessConfigDialog().show(activity.getSupportFragmentManager(), null); } }
From source file:dev.drsoran.moloko.util.UIUtils.java
public final static boolean isDialogFragmentAdded(FragmentActivity fragmentActivity, String fragmentTag) { return fragmentActivity.getSupportFragmentManager().findFragmentByTag(fragmentTag) != null; }
From source file:au.com.museumvictoria.fieldguide.bunurong.util.ImageCache.java
/** * Find and return an existing ImageCache stored in a {@link RetainFragment}, if not found a new * one is created using the supplied params and saved to a {@link RetainFragment}. * * @param activity The calling {@link FragmentActivity} * @param cacheParams The cache parameters to use if creating the ImageCache * @return An existing retained ImageCache object or a new one if one did not exist *///from w ww . ja va 2s. c o m public static ImageCache findOrCreateCache(final FragmentActivity activity, ImageCacheParams cacheParams) { // Search for, or create an instance of the non-UI RetainFragment final RetainFragment mRetainFragment = RetainFragment .findOrCreateRetainFragment(activity.getSupportFragmentManager()); // See if we already have an ImageCache stored in RetainFragment ImageCache imageCache = (ImageCache) mRetainFragment.getObject(); // No existing ImageCache, create one and store it in RetainFragment if (imageCache == null) { imageCache = new ImageCache(activity, cacheParams); mRetainFragment.setObject(imageCache); } return imageCache; }
From source file:com.vuze.android.remote.dialog.DialogFragmentRcmAuthAll.java
public static void openDialog(FragmentActivity fragment, String profileID) { DialogFragmentRcmAuthAll dlg = new DialogFragmentRcmAuthAll(); Bundle bundle = new Bundle(); bundle.putString(SessionInfoManager.BUNDLE_KEY, profileID); dlg.setArguments(bundle);//w w w. j a v a 2s.c o m AndroidUtils.showDialog(dlg, fragment.getSupportFragmentManager(), TAG); }
From source file:com.quark.skillopedia.Googlemap.PermissionUtils.java
/** * Requests the fine location permission. If a rationale with an additional explanation should * be shown to the user, displays a dialog that triggers the request. *///from ww w . jav a2s. co m public static void requestPermission(FragmentActivity activity, int requestId, String permission, boolean finishActivity) { if (ActivityCompat.shouldShowRequestPermissionRationale(activity, permission)) { // Display a dialog with rationale. RationaleDialog.newInstance(requestId, finishActivity).show(activity.getSupportFragmentManager(), "dialog"); } else { // Location permission has not been granted yet, request it. ActivityCompat.requestPermissions(activity, new String[] { permission }, requestId); } }
From source file:me.onemobile.client.image.ImageCache.java
/** * Try to find and return an existing ImageCache stored in a * {@link RetainFragment}/*from w ww . j av a 2s . co m*/ * * @param activity * @return ImageCache or null */ public static ImageCache tryTofindCache(final FragmentActivity activity) { // Search for, or create an instance of the non-UI RetainFragment RetainFragment mRetainFragment = (RetainFragment) activity.getSupportFragmentManager() .findFragmentByTag(RetainFragment.TAG); ImageCache imageCache = null; if (mRetainFragment != null) { // See if we already have an ImageCache stored in RetainFragment imageCache = (ImageCache) mRetainFragment.getObject(); } return imageCache; }
From source file:ca.rmen.android.networkmonitor.app.dialog.DialogFragmentFactory.java
/** * Show a visible dialog fragment with the given title and message, and just one OK button. *///from ww w . ja v a 2 s.c o m public static void showInfoDialog(FragmentActivity activity, String title, String message) { Log.v(TAG, "showInfoDialog"); Bundle arguments = new Bundle(3); arguments.putString(EXTRA_TITLE, title); arguments.putString(EXTRA_MESSAGE, message); InfoDialogFragment result = new InfoDialogFragment(); result.setArguments(arguments); result.show(activity.getSupportFragmentManager(), InfoDialogFragment.class.getSimpleName()); }
From source file:com.cxgps.vehicle.utils.PermissionUtils.java
/** * Requests the fine location permission. If a rationale with an additional explanation should * be shown to the user, displays a dialog that triggers the request. *///from ww w.j a va2 s.c o m public static void requestPermission(FragmentActivity activity, int requestId, String permission, boolean finishActivity) { if (ActivityCompat.shouldShowRequestPermissionRationale(activity, permission)) { // Display a dialog with rationale. PermissionUtils.RationaleDialog.newInstance(requestId, finishActivity) .show(activity.getSupportFragmentManager(), "dialog"); } else { // Location permission has not been granted yet, request it. ActivityCompat.requestPermissions(activity, new String[] { permission }, requestId); } }
From source file:com.inter.trade.ui.fragment.gamerecharge.dialog.FavoriteCharacterDialogFragment.java
public static void show(Fragment fragment, FragmentActivity activity, String title, String[] items) { FavoriteCharacterDialogFragment dialog = new FavoriteCharacterDialogFragment(); dialog.setTargetFragment(fragment, 0); dialog.setStyle(android.R.style.Theme_Light, 0); Bundle args = new Bundle(); args.putString(ARG_TITLE, title);// w w w . j a v a 2 s .c o m args.putStringArray(ARG_ITEMS, items); dialog.setArguments(args); dialog.show(activity.getSupportFragmentManager(), TAG); }