Example usage for android.app Activity getFragmentManager

List of usage examples for android.app Activity getFragmentManager

Introduction

In this page you can find the example usage for android.app Activity getFragmentManager.

Prototype

@Deprecated
public FragmentManager getFragmentManager() 

Source Link

Document

Return the FragmentManager for interacting with fragments associated with this activity.

Usage

From source file:com.jrummyapps.busybox.dialogs.AppletUsageDialog.java

public static void show(Activity activity, String applet, String help) {
    AppletUsageDialog dialog = new AppletUsageDialog();
    Bundle args = new Bundle();
    args.putString("applet_name", applet);
    args.putString("applet_help", help);
    dialog.setArguments(args);/*w w  w  . java 2s  . com*/
    dialog.show(activity.getFragmentManager(), "AppletUsageDialog");
    Analytics.newEvent("dialog_applet_usage").put("applet", applet).log();
}

From source file:com.jrummyapps.busybox.dialogs.BusyBoxAppletDialog.java

public static void show(Activity activity, String applet, String help) {
    BusyBoxAppletDialog dialog = new BusyBoxAppletDialog();
    Bundle args = new Bundle();
    args.putString("applet_name", applet);
    args.putString("applet_help", help);
    dialog.setArguments(args);/*www. jav a 2  s.  c  o  m*/
    dialog.show(activity.getFragmentManager(), "BusyBoxAppletDialog");
    Analytics.newEvent("applet help").put("applet", applet).log();
}

From source file:com.cyanogenmod.account.util.CMAccountUtils.java

public static void showLearnMoreDialog(Activity context) {
    WebViewDialogFragment.newInstance().setUri(AuthClient.LEARN_MORE_URI).show(context.getFragmentManager(),
            WebViewDialogFragment.TAG);// w  w w  .  j a  v  a  2  s .c om
}

From source file:com.emuneee.superb.ui.bitmap.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}.//  w w w . ja  v a  2 s  . c  o m
 * 
 * @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
 */
public static ImageCache findOrCreateCache(final Activity activity, ImageCacheParams cacheParams) {

    // Search for, or create an instance of the non-UI RetainFragment
    final RetainFragment mRetainFragment = RetainFragment
            .findOrCreateRetainFragment(activity.getFragmentManager());

    // 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:io.digibyte.tools.animation.BRAnimator.java

public static void popBackStackTillEntry(Activity app, int entryIndex) {

    if (app.getFragmentManager() == null) {
        return;/*from  www.  ja  v  a2s  . c o m*/
    }
    if (app.getFragmentManager().getBackStackEntryCount() <= entryIndex) {
        return;
    }
    FragmentManager.BackStackEntry entry = app.getFragmentManager().getBackStackEntryAt(entryIndex);
    if (entry != null) {
        app.getFragmentManager().popBackStackImmediate(entry.getId(), FragmentManager.POP_BACK_STACK_INCLUSIVE);
    }

}

From source file:io.digibyte.tools.animation.BRAnimator.java

public static void killAllFragments(Activity app) {
    if (app != null && !app.isDestroyed())
        app.getFragmentManager().popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);
}

From source file:org.onepf.opfiab.opfiab_uitest.tests.ui.UnifiedFragmentHelperTest.java

private static void restoreFragment(Activity activity) throws InterruptedException {
    if (activity instanceof FragmentActivity) {
        ((FragmentActivity) activity).getSupportFragmentManager().popBackStack();
    } else {//from w w w .  j  av a2 s.  c  om
        activity.getFragmentManager().popBackStack();
    }
    Thread.sleep(WAIT_REOPEN_ACTIVITY);
}

From source file:Main.java

@SuppressWarnings("unchecked")
public static <T extends Fragment> T attach(Activity activity, int containerId, Class<T> fragmentType,
        String tag) {//from  w  w  w .  ja va  2 s.  c  o m
    if (activity == null) {
        throw new IllegalArgumentException("activity is null");
    }
    if (fragmentType == null) {
        throw new IllegalArgumentException("fragmentType is null");
    }
    if (tag == null) {
        throw new IllegalArgumentException("tag is null");
    }

    T result;

    FragmentManager manager = activity.getFragmentManager();
    Fragment fragment = manager.findFragmentByTag(tag);

    if (fragment == null) {
        try {
            result = fragmentType.newInstance();
        } catch (InstantiationException e) {
            throw new IllegalArgumentException(
                    "fragmentType cannot be instantiated (default constructor is not visible)", e);
        } catch (IllegalAccessException e) {
            throw new IllegalArgumentException(
                    "fragmentType cannot be instantiated (instance could not be created)", e);
        }

        manager.beginTransaction().add(containerId, result, tag).commit();
    } else {
        if (!fragmentType.isInstance(fragment)) {
            throw new IllegalArgumentException("Different fragmentType for tag");
        }

        result = (T) fragment;
    }

    return result;
}

From source file:io.digibyte.tools.animation.BRAnimator.java

public static void showMenuFragment(Activity app) {
    if (app == null) {
        Log.e(TAG, "showReceiveFragment: app is null");
        return;//from www .ja  va2s . c o  m
    }
    FragmentTransaction transaction = app.getFragmentManager().beginTransaction();
    transaction.setCustomAnimations(0, 0, 0, R.animator.plain_300);
    transaction.add(android.R.id.content, new FragmentMenu(), FragmentMenu.class.getName());
    transaction.addToBackStack(FragmentMenu.class.getName());
    transaction.commit();

}

From source file:io.digibyte.tools.animation.BRAnimator.java

public static void showGreetingsMessage(Activity app) {
    if (app == null) {
        Log.e(TAG, "showGreetingsMessage: app is null");
        return;// www  . j  a va2s  .  com
    }
    FragmentTransaction transaction = app.getFragmentManager().beginTransaction();
    transaction.setCustomAnimations(0, 0, 0, R.animator.plain_300);
    transaction.add(android.R.id.content, new FragmentGreetings(), FragmentGreetings.class.getName());
    transaction.addToBackStack(FragmentGreetings.class.getName());
    transaction.commit();

}