Example usage for android.support.v4.app DialogFragment show

List of usage examples for android.support.v4.app DialogFragment show

Introduction

In this page you can find the example usage for android.support.v4.app DialogFragment show.

Prototype

public int show(FragmentTransaction transaction, String tag) 

Source Link

Document

Display the dialog, adding the fragment using an existing transaction and then committing the transaction.

Usage

From source file:com.dm.wallpaper.board.fragments.dialogs.InAppBillingFragment.java

public static void showInAppBillingDialog(@NonNull FragmentManager fm, BillingProcessor billingProcessor,
        @NonNull String key, @NonNull String[] productId) {
    mBillingProcessor = billingProcessor;
    FragmentTransaction ft = fm.beginTransaction();
    Fragment prev = fm.findFragmentByTag(TAG);
    if (prev != null) {
        ft.remove(prev);/*from  w  ww .ja  va2 s  .c  o m*/
    }

    try {
        DialogFragment dialog = InAppBillingFragment.newInstance(key, productId);
        dialog.show(ft, TAG);
    } catch (IllegalArgumentException | IllegalStateException ignored) {
    }
}

From source file:com.ultramegasoft.flavordex2.dialog.CatListDialog.java

/**
 * Show the dialog./*from  ww w.ja  v  a 2 s .co m*/
 *
 * @param fm          The FragmentManager to use
 * @param target      The Fragment to notify of the result
 * @param requestCode A number to identify this request
 */
public static void showDialog(@NonNull FragmentManager fm, @Nullable Fragment target, int requestCode) {
    final DialogFragment fragment = new CatListDialog();
    fragment.setTargetFragment(target, requestCode);

    fragment.show(fm, TAG);
}

From source file:com.hangulo.powercontact.OpensourceFragment.java

/**
 * Builds and displays a licenses fragment with or without a Close button.
 * Requires "/res/raw/licenses.html" and "/res/layout/licenses_fragment.xml"
 * to be present./* w  ww .  ja  v  a2  s. c o m*/
 *
 * @param fm A fragment manager instance used to display this LicensesFragment.
 * @param showCloseButton Whether to show a Close button at the bottom of the dialog.
 */
public static void displayLicensesFragment(FragmentManager fm, boolean showCloseButton) {
    FragmentTransaction ft = fm.beginTransaction();
    Fragment prev = fm.findFragmentByTag(FRAGMENT_TAG);
    if (prev != null) {
        ft.remove(prev);
    }
    ft.addToBackStack(null);

    // Create and show the dialog.
    DialogFragment newFragment = OpensourceFragment.newInstance(showCloseButton);
    newFragment.show(ft, FRAGMENT_TAG);
}

From source file:com.dm.material.dashboard.candybar.fragments.dialog.InAppBillingFragment.java

public static void showInAppBillingDialog(@NonNull FragmentManager fm, BillingProcessor billingProcessor,
        int type, @NonNull String key, @NonNull String[] productId, int[] productCount) {
    mBillingProcessor = billingProcessor;
    FragmentTransaction ft = fm.beginTransaction();
    Fragment prev = fm.findFragmentByTag(TAG);
    if (prev != null) {
        ft.remove(prev);//from  w ww  . j a v a 2 s .  c  om
    }

    try {
        DialogFragment dialog = InAppBillingFragment.newInstance(type, key, productId, productCount);
        dialog.show(ft, TAG);
    } catch (IllegalArgumentException | IllegalStateException ignored) {
    }
}

From source file:com.feathercoin.wallet.feathercoin.ui.AmountCalculatorFragment.java

public static void calculate(final FragmentManager fm, final Listener listener) {
    final DialogFragment newFragment = new AmountCalculatorFragment();
    newFragment.setTargetFragment((Fragment) listener, 0);
    newFragment.show(fm, FRAGMENT_TAG);
}

From source file:Main.java

public static void showDialog(DialogFragment dialog, FragmentManager fragmentManager, String tag,
        boolean allowStateLoss) {
    if (allowStateLoss) {
        final FragmentTransaction transaction = fragmentManager.beginTransaction();
        transaction.add(dialog, tag);//from ww w  .java2  s .  c om
        transaction.commitAllowingStateLoss();
    } else {
        dialog.show(fragmentManager, tag);
    }

}

From source file:com.ultramegasoft.flavordex2.dialog.MessageDialog.java

/**
 * Show a confirmation dialog./*w  ww .  j a v  a2  s .  c  om*/
 *
 * @param fm      The FragmentManager to use
 * @param title   The dialog title
 * @param message The dialog message
 * @param icon    Resource ID for the dialog icon
 */
public static void showDialog(@NonNull FragmentManager fm, @NonNull String title, @NonNull String message,
        int icon) {
    final DialogFragment fragment = new MessageDialog();

    final Bundle args = new Bundle();
    args.putString(ARG_TITLE, title);
    args.putString(ARG_MESSAGE, message);
    args.putInt(ARG_ICON, icon);
    fragment.setArguments(args);

    fragment.show(fm, TAG);
}

From source file:com.battlelancer.seriesguide.ui.dialogs.AddShowDialogFragment.java

/**
 * Display a dialog which asks if the user wants to add the given show to his show database. If
 * necessary an AsyncTask will be started which takes care of adding the show.
 *//*from  ww w  .  ja  v  a 2 s.  c  o m*/
public static void showAddDialog(SearchResult show, FragmentManager fm) {
    // DialogFragment.show() will take care of adding the fragment
    // in a transaction. We also want to remove any currently showing
    // dialog, so make our own transaction and take care of that here.
    FragmentTransaction ft = fm.beginTransaction();
    Fragment prev = fm.findFragmentByTag(TAG);
    if (prev != null) {
        ft.remove(prev);
    }
    ft.addToBackStack(null);

    // Create and show the dialog.
    DialogFragment newFragment = AddShowDialogFragment.newInstance(show);
    newFragment.show(ft, TAG);
}

From source file:de.schildbach.wallet.ui.RestoreWalletFromSeedDialogFragment.java

public static void show(final FragmentManager fm) {
    final DialogFragment newFragment = new RestoreWalletFromSeedDialogFragment();
    newFragment.show(fm, FRAGMENT_TAG);
}

From source file:com.hivewallet.androidclient.wallet.ui.EditAddressBookEntryFragment.java

public static void edit(final FragmentManager fm, @Nonnull final String address,
        @Nullable final String suggestedAddressLabel, @Nullable final Uri suggestedPhotoUri) {
    final DialogFragment newFragment = EditAddressBookEntryFragment.instance(address, suggestedAddressLabel,
            suggestedPhotoUri);//  w w w. j  av  a  2s  . c o m
    newFragment.show(fm, FRAGMENT_TAG);
}