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.CreditsFragment.java

public static void showCreditsDialog(FragmentManager fm, int type) {
    FragmentTransaction ft = fm.beginTransaction();
    Fragment prev = fm.findFragmentByTag(TAG);
    if (prev != null) {
        ft.remove(prev);/*from ww  w .ja  va 2s. co m*/
    }

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

From source file:com.example.androidlicensespage.LicensesFragment.java

/**
 * Builds and displays a licenses fragment with no Close button. Requires
 * "/res/raw/licenses.html" and "/res/layout/licenses_fragment.xml" to be
 * present./*from ww w  .j  a v  a 2 s.  c  o  m*/
 *
 * @param fm A fragment manager instance used to display this LicensesFragment.
 */
public static void displayLicensesFragment(FragmentManager fm) {
    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 = LicensesFragment.newInstance();
    newFragment.show(ft, FRAGMENT_TAG);
}

From source file:de.luhmer.owncloudnewsreader.MenuUtilsFragmentActivity.java

public static boolean onOptionsItemSelected(MenuItem item, FragmentActivity activity) {
    switch (item.getItemId()) {
    case R.id.menu_About_Changelog:
        DialogFragment dialog = new VersionInfoDialogFragment();
        dialog.show(activity.getSupportFragmentManager(), "VersionChangelogDialogFragment");
        return true;

    case R.id.menu_markAllAsRead:
        NewsReaderDetailFragment ndf = ((NewsReaderDetailFragment) activity.getSupportFragmentManager()
                .findFragmentById(R.id.content_frame));
        if (ndf != null) {
            DatabaseConnectionOrm dbConn = new DatabaseConnectionOrm(activity);
            //dbConn.markAllItemsAsReadForCurrentView();

            for (int i = 0; i < ndf.getListAdapter().getCount(); i++) {
                RssItem rssItem = (RssItem) ndf.getListAdapter().getItem(i);
                rssItem.setRead_temp(true);
                dbConn.updateRssItem(rssItem);
            }/* ww  w.  j a  v  a 2  s .com*/

            ndf.notifyDataSetChangedOnAdapter();

            //If tablet view is enabled update the listview as well
            if (activity instanceof NewsReaderListActivity)
                ((NewsReaderListActivity) activity).updateAdapter();

        }
        return true;

    case R.id.menu_downloadMoreItems:
        DownloadMoreItems();
        return true;
    }
    return false;
}

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

public static void showWallpaperOptionsDialog(FragmentManager fm, String url, String name) {
    FragmentTransaction ft = fm.beginTransaction();
    Fragment prev = fm.findFragmentByTag(TAG);
    if (prev != null) {
        ft.remove(prev);/*from   w w  w. j  a v  a2s.com*/
    }

    try {
        DialogFragment dialog = WallpaperOptionsFragment.newInstance(url, name);
        dialog.show(ft, TAG);
    } catch (IllegalArgumentException | IllegalStateException ignored) {
    }
}

From source file:com.coinomi.wallet.ui.EditAddressBookEntryFragment.java

public static void edit(final FragmentManager fm, @Nonnull CoinType type,
        @Nonnull final AbstractAddress address, @Nullable final String suggestedAddressLabel) {
    final DialogFragment newFragment = EditAddressBookEntryFragment.instance(type, address,
            suggestedAddressLabel);//from w ww  .  j av  a2 s . c  om
    newFragment.show(fm, FRAGMENT_TAG);
}

From source file:com.example.androidlicensespage.LicensesFragment.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. j  a  va 2  s  .c  om
 *
 * @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 = LicensesFragment.newInstance(showCloseButton);
    newFragment.show(ft, FRAGMENT_TAG);
}

From source file:com.mygeopay.wallet.ui.EditAddressBookEntryFragment.java

public static void edit(final FragmentManager fm, @Nonnull CoinType type, @Nonnull final String address,
        @Nullable final String suggestedAddressLabel) {
    final DialogFragment newFragment = EditAddressBookEntryFragment.instance(type, address,
            suggestedAddressLabel);//from  w  w w.  java 2 s  .c  om
    newFragment.show(fm, FRAGMENT_TAG);
}

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

/**
 * Display a dialog which allows to edit the title of this list or remove
 * it.//  w  w w .  j  a va2s. c  om
 */
public static void showListManageDialog(String listId, 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("listmanagedialog");
    if (prev != null) {
        ft.remove(prev);
    }
    ft.addToBackStack(null);

    // Create and show the dialog.
    DialogFragment newFragment = ListManageDialogFragment.newInstance(listId);
    newFragment.show(ft, "listmanagedialog");
}

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

/**
 * Builds and displays a licenses fragment with no Close button. Requires
 * "/res/raw/licenses.html" and "/res/layout/licenses_fragment.xml" to be
 * present./* w w  w.ja v  a2  s  .  c  o  m*/
 *
 * @param fm A fragment manager instance used to display this LicensesFragment.
 */
public static void displayLicensesFragment(FragmentManager fm) {
    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();
    newFragment.show(ft, FRAGMENT_TAG);
}

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

public static void showIntentChooserDialog(@NonNull FragmentManager fm, @NonNull Request request) {
    FragmentTransaction ft = fm.beginTransaction();
    Fragment prev = fm.findFragmentByTag(TAG);
    if (prev != null) {
        ft.remove(prev);//from ww w  .  java2s.c  om
    }

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