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:Main.java

public static void showDialog(@Nonnull DialogFragment dialogFragment, @Nonnull String fragmentTag,
        @Nonnull FragmentManager fm) {/*w w w.  ja v a  2  s. com*/
    final FragmentTransaction ft = fm.beginTransaction();

    Fragment prev = fm.findFragmentByTag(fragmentTag);
    if (prev != null) {
        ft.remove(prev);
    }

    // Create and show the dialog.
    dialogFragment.show(ft, fragmentTag);
}

From source file:com.dabay6.libraries.androidshared.ui.dialogs.changelog.util.ChangeLogDialogUtils.java

/**
 * Displays the applications change log.
 *
 * @param context {@link Context} used to create the {@link ChangeLogDialogFragment}.
 *//*w w w  .  j a v a2s  .  c  o m*/
public static void displayChangeLogDialogFragment(final FragmentActivity context, final String assetName,
        final String style) {
    if (context.isFinishing()) {
        return;
    }

    final DialogFragment fragment = ChangeLogDialogFragment.newInstance(assetName, style);

    fragment.show(context.getSupportFragmentManager(), "change_log");
}

From source file:com.artemchep.horario.ui.DialogHelper.java

private static void showDialog(@NonNull AppCompatActivity activity, @NonNull DialogFragment fragment,
        @NonNull String tag) {//from  www  .  j  av  a 2  s .co  m
    FragmentManager fm = activity.getSupportFragmentManager();
    FragmentTransaction ft = fm.beginTransaction();
    Fragment prev = fm.findFragmentByTag(tag);
    if (prev != null)
        ft.remove(prev);
    ft.addToBackStack(null);
    fragment.show(ft, tag);
}

From source file:de.schildbach.wallet.ui.send.RaiseFeeDialogFragment.java

public static void show(final FragmentManager fm, final Transaction tx) {
    final DialogFragment newFragment = instance(tx);
    newFragment.show(fm, FRAGMENT_TAG);
}

From source file:com.maxwen.wallpaper.board.fragments.dialogs.DirectoryChooserDialog.java

public static void showDirectoryChooserDialog(FragmentManager fm, ChosenDirectoryListener listener,
        String startFolder) {//from   w w w  .ja v a2 s  .c  o  m
    FragmentTransaction ft = fm.beginTransaction();
    Fragment prev = fm.findFragmentByTag(TAG);
    if (prev != null) {
        ft.remove(prev);
    }

    try {
        android.support.v4.app.DialogFragment dialog = DirectoryChooserDialog.newInstance(listener,
                startFolder);
        dialog.show(ft, TAG);
    } catch (IllegalArgumentException | IllegalStateException ignored) {
    }
}

From source file:de.schildbach.wallet.ui.backup.BackupWalletDialogFragment.java

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

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

/**
 * Display a dialog which asks if the user wants to add the given show to one or more lists.
 *
 * @param itemId   TVDb/database id of the item to add
 * @param itemType type of the item to add (show, season or episode)
 *///  ww  w.ja v a2  s  . co  m
public static void showListsDialog(String itemId, int itemType, FragmentManager fm) {
    if (fm == null) {
        return;
    }

    // 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("listsdialog");
    if (prev != null) {
        ft.remove(prev);
    }
    ft.addToBackStack(null);

    // Create and show the dialog.
    DialogFragment newFragment = ListsDialogFragment.newInstance(itemId, itemType);
    newFragment.show(ft, "listsdialog");
}

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

/**
 * Display a dialog which asks if the user wants to add the given show to one or more lists.
 *
 * @param itemTvdbId   TVDb id of the item to add
 * @param itemType type of the item to add (show, season or episode)
 *//*w w w .  j  a v  a  2 s  . co  m*/
public static void showListsDialog(int itemTvdbId, int itemType, FragmentManager fm) {
    if (fm == null) {
        return;
    }

    // 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("listsdialog");
    if (prev != null) {
        ft.remove(prev);
    }
    ft.addToBackStack(null);

    // Create and show the dialog.
    DialogFragment newFragment = ManageListsDialogFragment.newInstance(itemTvdbId, itemType);
    newFragment.show(ft, "listsdialog");
}

From source file:dev.drsoran.moloko.util.UIUtils.java

public final static void showAboutMolokoDialog(FragmentActivity fragActivity) {
    final DialogFragment dialog = AboutMolokoDialogFragment.newInstance(Bundle.EMPTY);
    dialog.show(fragActivity.getSupportFragmentManager(), String.valueOf(R.id.frag_about_moloko));
}

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

/**
 * Show the dialog.//from   w w w  .j  a v a 2  s.co  m
 *
 * @param fm  The FragmentManager to use
 * @param app The source app
 */
public static void showDialog(@NonNull FragmentManager fm, int app) {
    final DialogFragment fragment = new AppImportDialog();

    final Bundle args = new Bundle();
    args.putInt(ARG_APP, app);
    fragment.setArguments(args);

    fragment.show(fm, TAG);
}