Example usage for android.support.v4.app FragmentActivity getSupportFragmentManager

List of usage examples for android.support.v4.app FragmentActivity getSupportFragmentManager

Introduction

In this page you can find the example usage for android.support.v4.app FragmentActivity getSupportFragmentManager.

Prototype

public FragmentManager getSupportFragmentManager() 

Source Link

Document

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

Usage

From source file:com.google.samples.apps.ledtoggler.UserConsentDialogFragment.java

/**
 * When the user accepts TOS, store as a preference.
 * @return Whether the user has signed TOS or not.
 */// w  w w .  j a  va2  s. c o  m
public static boolean showIfNecessary(FragmentActivity activity) {
    if (!isTosAccepted(activity)) {
        String fragmentTag = "Accept_TOS";
        if (activity.getSupportFragmentManager().findFragmentByTag(fragmentTag) == null) {
            new UserConsentDialogFragment().show(activity.getSupportFragmentManager(), fragmentTag);
        }
        return true;
    }
    return false;
}

From source file:br.ufg.iptsp.app.variloid.util.HelpUtils.java

public static void showAbout(FragmentActivity activity) {
    FragmentManager fm = activity.getSupportFragmentManager();
    FragmentTransaction ft = fm.beginTransaction();
    Fragment prev = fm.findFragmentByTag("dialog_about");
    if (prev != null) {
        ft.remove(prev);//from  www . j a va  2 s. c  om
    }
    ft.addToBackStack(null);

    new AboutDialog().show(ft, "dialog_about");
}

From source file:br.ufg.iptsp.app.variloid.util.HelpUtils.java

public static void showEula(FragmentActivity activity) {
    FragmentManager fm = activity.getSupportFragmentManager();
    FragmentTransaction ft = fm.beginTransaction();
    Fragment prev = fm.findFragmentByTag("dialog_eula");
    if (prev != null) {
        ft.remove(prev);//www  .  j  a v  a 2 s .c  o  m
    }
    ft.addToBackStack(null);

    new EulaDialog().show(ft, "dialog_eula");
}

From source file:cn.jarlen.richcommon.ui.FragmentStack.java

/**
 *
 * @param mActivity/*from  www .ja v a  2 s. com*/
 */
public static void popBackStack(FragmentActivity mActivity) {
    FragmentManager fragmentManager = mActivity.getSupportFragmentManager();
    fragmentManager.popBackStack();
}

From source file:com.firebase.ui.auth.util.signincontainer.IdpSignInContainer.java

public static void signIn(FragmentActivity activity, FlowParameters parameters, User user) {
    FragmentManager fm = activity.getSupportFragmentManager();
    Fragment fragment = fm.findFragmentByTag(TAG);
    if (!(fragment instanceof IdpSignInContainer)) {
        IdpSignInContainer result = new IdpSignInContainer();

        Bundle bundle = FragmentHelper.getFlowParamsBundle(parameters);
        bundle.putParcelable(ExtraConstants.EXTRA_USER, user);
        result.setArguments(bundle);/*from  w  w  w  .  j a  v a 2  s.co m*/

        try {
            fm.beginTransaction().add(result, TAG).disallowAddToBackStack().commit();
        } catch (IllegalStateException e) {
            Log.e(TAG, "Cannot add fragment", e);
        }
    }
}

From source file:de.vanita5.twittnuker.fragment.support.SupportProgressDialogFragment.java

public static SupportProgressDialogFragment show(final FragmentActivity activity, final String tag) {
    if (activity == null)
        return null;
    final SupportProgressDialogFragment f = new SupportProgressDialogFragment();
    f.show(activity.getSupportFragmentManager(), tag);
    return f;//from   w  w w. java2s .co m
}

From source file:com.laevatein.internal.ui.helper.PhotoSelectionViewHelper.java

public static void setPhotoGridFragment(FragmentActivity activity, DrawerLayout drawer, Album album) {
    Fragment fragment = PhotoGridFragment.newInstance(album);
    FragmentManager manager = activity.getSupportFragmentManager();
    manager.beginTransaction().replace(R.id.l_container_grid_fragment, fragment, PhotoGridFragment.TAG)
            .commit();//from  w w  w . j  a  v a 2s  .c o m
    if (((PhotoSelectionActivity) activity).isDrawerOpen()) {
        drawer.closeDrawers();
    } else {
        drawer.openDrawer(GravityCompat.START);
    }
}

From source file:org.kaaproject.kaa.demo.cityguide.util.FragmentUtils.java

public static void addBackStackFragment(FragmentActivity activity, Fragment fragment) {
    if (activity == null) {
        Log.e(TAG, "Unable pop fragment. Invalid args.");
        return;/*from  w w w .ja v  a2s .  c  o  m*/
    }
    FragmentManager fm = activity.getSupportFragmentManager();
    FragmentTransaction ft = fm.beginTransaction();
    ft.replace(R.id.container, fragment);
    ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
    ft.addToBackStack(null);
    ft.commit();
}

From source file:com.tomeokin.lspush.ui.navigator.Navigator.java

public static void moveTo(FragmentActivity base, Class<? extends Fragment> fragment, Bundle args,
        @IdRes int id) {
    moveTo(base, base.getSupportFragmentManager(), fragment, args, id, DEFAULT_ADD_TO_BACK_STACK);
}

From source file:org.tigase.mobile.WarningDialog.java

public static void showWarning(FragmentActivity activity, int message) {
    try {/*from w  ww. j  av  a 2  s. c om*/
        DialogFragment newFragment = WarningDialog.newInstance(message);
        newFragment.show(activity.getSupportFragmentManager(), "dialog");
    } catch (IllegalStateException e) {
        showNotification(activity, null, message);
    }
}