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:net.kjmaster.cookiemom.scout.turnin.ScoutTurnInDialog.java

public void ScoutTurnInDialog(Scout scout, FragmentActivity activity) {
    SimpleDialogFragment.createBuilder(activity, activity.getSupportFragmentManager())
            .setTitle("Turn in for" + scout.getScoutName()).setMessage("Is she turning in money or cookies?")
            .setPositiveButtonText("Money").setNegativeButtonText("Cookies").setCancelable(true)
            .setRequestCode(scout.getId().intValue()).setTag(scout.getId().toString()).show();
}

From source file:eu.thedarken.rootvalidator.ui.AboutDialog.java

public void showDialog(FragmentActivity activity) {
    show(activity.getSupportFragmentManager(), AboutDialog.class.getName());
}

From source file:net.kjmaster.cookiemom.booth.checking.BoothCheckInDialog.java

public void BoothCheckInDialog(Booth booth, FragmentActivity activity) {
    SimpleDialogFragment.createBuilder(activity, activity.getSupportFragmentManager())
            .setTitle("Turn in for" + booth.getBoothLocation())
            .setMessage("Is she turning in money or cookies?").setPositiveButtonText("Money")
            .setNegativeButtonText("Cookies").setCancelable(true).setRequestCode(booth.getId().intValue())
            .setTag(booth.getId().toString())

            .show();//from  w  w  w. j  a  va  2s .co m
}

From source file:de.dreier.mytargets.features.distance.DistanceTabsFragmentPagerAdapter.java

public DistanceTabsFragmentPagerAdapter(FragmentActivity context, Dimension distance) {
    super(context.getSupportFragmentManager());
    this.context = context;
    fragments[0] = DistanceGridFragment.newInstance(distance, UNITS.get(0));
    fragments[1] = DistanceGridFragment.newInstance(distance, UNITS.get(1));
    fragments[2] = DistanceGridFragment.newInstance(distance, UNITS.get(2));
}

From source file:com.commonsware.empub.ContentsAdapter.java

public ContentsAdapter(FragmentActivity ctxt, BookContents contents) {
    super(ctxt.getSupportFragmentManager());
    this.ctxt = ctxt;
    this.contents = contents;
}

From source file:com.zapp.library.merchant.util.PBBAAppUtils.java

/**
 * Show the Pay by Bank app popup. It opens the CFI App automatically (without displaying the popup) if the device has CFI App installed and the user has tapped
 * 'Open banking app' button. It closes itself automatically if the user taps the 'Open banking app' button. It closes any other Pay by Bank App popup currently open.
 *
 * @param activity    The activity to use.
 * @param secureToken The secure token for the payment.
 * @param brn         The BRN code for the payment.
 * @param callback    The callback listener for the popup. The popup keeps {@link java.lang.ref.WeakReference} to the callback.
 * @see PBBAPopupCallback/*  ww w.  j a  v  a  2  s  .  co  m*/
 * @see #showPBBAErrorPopup(FragmentActivity, String, String, String, PBBAPopupCallback)
 * @see #dismissPBBAPopup(FragmentActivity)
 * @see #setPBBAPopupCallback(FragmentActivity, PBBAPopupCallback)
 */
@SuppressWarnings({ "FeatureEnvy", "OverlyComplexMethod", "OverlyLongMethod", "ElementOnlyUsedFromTestCode" })
public static void showPBBAPopup(@NonNull final FragmentActivity activity, @NonNull final String secureToken,
        @NonNull final String brn, @NonNull final PBBAPopupCallback callback) {

    verifyActivity(activity);

    if (TextUtils.isEmpty(secureToken)) {
        throw new IllegalArgumentException("secureToken is required");
    }

    if (TextUtils.isEmpty(brn)) {
        throw new IllegalArgumentException("BRN is required");
    }
    if (brn.length() != 6) {
        throw new IllegalArgumentException("BRN length is not 6 characters");
    }

    //noinspection ConstantConditions
    if (callback == null) {
        throw new IllegalArgumentException("callback == null");
    }

    final FragmentManager fragmentManager = activity.getSupportFragmentManager();
    final PBBAPopup fragment = (PBBAPopup) fragmentManager.findFragmentByTag(PBBAPopup.TAG);

    final boolean hasBankApp = isCFIAppAvailable(activity);
    if (hasBankApp) {
        final boolean openBankAppAutomatically = PBBALibraryUtils.isOpenBankingAppButtonClicked(activity);

        if (openBankAppAutomatically) {
            //close any open PBBA popup (e.g. error popup was displayed due to network error and retry request was successful with auto bank App open enabled)
            if (fragment != null) {
                fragmentManager.beginTransaction().remove(fragment).commit();
            }
            openBankingApp(activity, secureToken);
            return;
        }
    } else {
        //disable auto bank opening in case of no PBBA enabled App installed (or has been uninstalled)
        PBBALibraryUtils.setOpenBankingAppButtonClicked(activity, false);
    }

    if (fragment instanceof PBBAPopupFragment) {
        final PBBAPopupFragment popupFragment = (PBBAPopupFragment) fragment;
        if (TextUtils.equals(popupFragment.getSecureToken(), secureToken)
                && TextUtils.equals(popupFragment.getBrn(), brn)) {
            //same type of popup is already displayed, only reconnect is needed
            popupFragment.setCallback(callback);
            return;
        }
    }

    final PBBAPopupFragment newFragment = PBBAPopupFragment.newInstance(secureToken, brn);
    newFragment.setCallback(callback);

    final FragmentTransaction transaction = fragmentManager.beginTransaction();
    if (fragment != null) {
        transaction.remove(fragment);
    }
    transaction.add(newFragment, PBBAPopup.TAG).commit();
}

From source file:net.kjmaster.cookiemom.scout.pickup.ScoutPickupDialog.java

public void ScoutPickupDialog(Scout scout, FragmentActivity activity, Fragment fragment) {
    SimpleDialogFragment.createBuilder(activity, activity.getSupportFragmentManager())
            .setTitle("Pickup for" + scout.getScoutName())
            .setMessage("Is she picking up now or are you just preparing?").setPositiveButtonText("Pickup Now")
            .setNegativeButtonText("Just Preparing").setCancelable(true)
            .setTargetFragment(fragment, scout.getId().intValue()).setRequestCode(scout.getId().intValue())
            .setTag(scout.getId().toString()).show();
}

From source file:com.pyamsoft.dontsuckmp.uicore.NowPlayingDelegate.java

private void showPlaybackFragment(@NonNull FragmentActivity activity) {
    final FragmentManager fragmentManager = activity.getSupportFragmentManager();
    if (fragmentManager.findFragmentByTag(NowPlayingFragment.TAG) == null) {
        fragmentManager.beginTransaction()
                .replace(R.id.main_view_container, new NowPlayingFragment(), NowPlayingFragment.TAG)
                .addToBackStack(null).commit();
    }//w w w  .jav  a  2  s . c o m
}

From source file:org.droidparts.fragment.DialogFragment.java

public void show(FragmentActivity activity) {
    String tag = getClass().getName();
    FragmentManager fm = activity.getSupportFragmentManager();
    FragmentTransaction ft = fm.beginTransaction();
    Fragment f = fm.findFragmentByTag(tag);
    if (f != null) {
        ft.remove(f);//w  ww  .  j  av a2 s. co m
    }
    show(ft, tag);
}

From source file:org.kaaproject.kaa.demo.cityguide.fragment.BaseFragment.java

public String getFragmentTag(FragmentActivity activity) {
    if (activity.getSupportFragmentManager().getBackStackEntryCount() == 0) {
        return null;
    }/*  w w w .j  a  v  a  2 s. c  om*/
    return activity.getSupportFragmentManager()
            .getBackStackEntryAt(activity.getSupportFragmentManager().getBackStackEntryCount() - 1).getName();
}