android.app.DialogFragment

Here are the examples of the java api class android.app.DialogFragment taken from open source projects.

1. SyncPrefs#showAccountDialog()

Project: NotePad
File: SyncPrefs.java
private void showAccountDialog() {
    FragmentTransaction ft = getFragmentManager().beginTransaction();
    Fragment prev = getFragmentManager().findFragmentByTag("accountdialog");
    if (prev != null) {
        ft.remove(prev);
    }
    ft.addToBackStack(null);
    // Create and show the dialog.
    // Bundle args = new Bundle();
    // args.putString(KEY_ACCOUNT, newPassword);
    DialogFragment newFragment = new AccountDialog();
    // newFragment.setArguments(args);
    newFragment.show(ft, "accountdialog");
}

2. FragmentDialog#showDialog()

Project: codeexamples-android
File: FragmentDialog.java
void showDialog() {
    mStackLevel++;
    // 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 = getFragmentManager().beginTransaction();
    Fragment prev = getFragmentManager().findFragmentByTag("dialog");
    if (prev != null) {
        ft.remove(prev);
    }
    ft.addToBackStack(null);
    // Create and show the dialog.
    DialogFragment newFragment = MyDialogFragment.newInstance(mStackLevel);
    newFragment.show(ft, "dialog");
}

3. FragmentDialog#showDialog()

Project: android-maven-plugin
File: FragmentDialog.java
void showDialog() {
    mStackLevel++;
    // 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 = getFragmentManager().beginTransaction();
    Fragment prev = getFragmentManager().findFragmentByTag("dialog");
    if (prev != null) {
        ft.remove(prev);
    }
    ft.addToBackStack(null);
    // Create and show the dialog.
    DialogFragment newFragment = MyDialogFragment.newInstance(mStackLevel);
    newFragment.show(ft, "dialog");
}

4. MessageViewFragment#removeDialog()

Project: k-9
File: MessageViewFragment.java
private void removeDialog(int dialogId) {
    FragmentManager fm = getFragmentManager();
    if (fm == null || isRemoving() || isDetached()) {
        return;
    }
    // Make sure the "show dialog" transaction has been processed when we call
    // findFragmentByTag() below. Otherwise the fragment won't be found and the dialog will
    // never be dismissed.
    fm.executePendingTransactions();
    DialogFragment fragment = (DialogFragment) fm.findFragmentByTag(getDialogTag(dialogId));
    if (fragment != null) {
        fragment.dismiss();
    }
}

5. SiteSettingsFragment#showRelatedPostsDialog()

Project: WordPress-Android
File: SiteSettingsFragment.java
private void showRelatedPostsDialog() {
    DialogFragment relatedPosts = new RelatedPostsDialog();
    Bundle args = new Bundle();
    args.putBoolean(RelatedPostsDialog.SHOW_RELATED_POSTS_KEY, mSiteSettings.getShowRelatedPosts());
    args.putBoolean(RelatedPostsDialog.SHOW_HEADER_KEY, mSiteSettings.getShowRelatedPostHeader());
    args.putBoolean(RelatedPostsDialog.SHOW_IMAGES_KEY, mSiteSettings.getShowRelatedPostImages());
    relatedPosts.setArguments(args);
    relatedPosts.setTargetFragment(this, RELATED_POSTS_REQUEST_CODE);
    relatedPosts.show(getFragmentManager(), "related-posts");
}

6. MessageViewFragment#showDialog()

Project: k-9
File: MessageViewFragment.java
private void showDialog(int dialogId) {
    DialogFragment fragment;
    switch(dialogId) {
        case R.id.dialog_confirm_delete:
            {
                String title = getString(R.string.dialog_confirm_delete_title);
                String message = getString(R.string.dialog_confirm_delete_message);
                String confirmText = getString(R.string.dialog_confirm_delete_confirm_button);
                String cancelText = getString(R.string.dialog_confirm_delete_cancel_button);
                fragment = ConfirmationDialogFragment.newInstance(dialogId, title, message, confirmText, cancelText);
                break;
            }
        case R.id.dialog_confirm_spam:
            {
                String title = getString(R.string.dialog_confirm_spam_title);
                String message = getResources().getQuantityString(R.plurals.dialog_confirm_spam_message, 1);
                String confirmText = getString(R.string.dialog_confirm_spam_confirm_button);
                String cancelText = getString(R.string.dialog_confirm_spam_cancel_button);
                fragment = ConfirmationDialogFragment.newInstance(dialogId, title, message, confirmText, cancelText);
                break;
            }
        case R.id.dialog_attachment_progress:
            {
                String message = getString(R.string.dialog_attachment_progress_title);
                fragment = ProgressDialogFragment.newInstance(null, message);
                break;
            }
        default:
            {
                throw new RuntimeException("Called showDialog(int) with unknown dialog id.");
            }
    }
    fragment.setTargetFragment(this, dialogId);
    fragment.show(getFragmentManager(), getDialogTag(dialogId));
}

7. MessageListFragment#showDialog()

Project: k-9
File: MessageListFragment.java
private void showDialog(int dialogId) {
    DialogFragment fragment;
    switch(dialogId) {
        case R.id.dialog_confirm_spam:
            {
                String title = getString(R.string.dialog_confirm_spam_title);
                int selectionSize = mActiveMessages.size();
                String message = getResources().getQuantityString(R.plurals.dialog_confirm_spam_message, selectionSize, Integer.valueOf(selectionSize));
                String confirmText = getString(R.string.dialog_confirm_spam_confirm_button);
                String cancelText = getString(R.string.dialog_confirm_spam_cancel_button);
                fragment = ConfirmationDialogFragment.newInstance(dialogId, title, message, confirmText, cancelText);
                break;
            }
        case R.id.dialog_confirm_delete:
            {
                String title = getString(R.string.dialog_confirm_delete_title);
                int selectionSize = mActiveMessages.size();
                String message = getResources().getQuantityString(R.plurals.dialog_confirm_delete_messages, selectionSize, Integer.valueOf(selectionSize));
                String confirmText = getString(R.string.dialog_confirm_delete_confirm_button);
                String cancelText = getString(R.string.dialog_confirm_delete_cancel_button);
                fragment = ConfirmationDialogFragment.newInstance(dialogId, title, message, confirmText, cancelText);
                break;
            }
        default:
            {
                throw new RuntimeException("Called showDialog(int) with unknown dialog id.");
            }
    }
    fragment.setTargetFragment(this, dialogId);
    fragment.show(getFragmentManager(), getDialogTag(dialogId));
}

8. ErrorReport#showError()

Project: CheckMail
File: ErrorReport.java
public static void showError(FragmentManager lm, String message) {
    DialogFragment dialog = new ErrorReport();
    dialog.show(lm, "ErrorReport");
    Bundle args = new Bundle();
    args.putString("text", message);
    dialog.setArguments(args);
}

9. AutofillPreferenceActivity#showDialog()

Project: Android-Password-Store
File: AutofillPreferenceActivity.java
public void showDialog(String packageName, String appName, boolean isWeb) {
    DialogFragment df = new AutofillFragment();
    Bundle args = new Bundle();
    args.putString("packageName", packageName);
    args.putString("appName", appName);
    args.putBoolean("isWeb", isWeb);
    df.setArguments(args);
    df.show(getFragmentManager(), "autofill_dialog");
}

10. AddToDoActivity#showTimePickerDialog()

Project: coursera-android-labs
File: AddToDoActivity.java
private void showTimePickerDialog() {
    DialogFragment newFragment = new TimePickerFragment();
    newFragment.show(getFragmentManager(), "timePicker");
}

11. AddToDoActivity#showDatePickerDialog()

Project: coursera-android-labs
File: AddToDoActivity.java
private void showDatePickerDialog() {
    DialogFragment newFragment = new DatePickerFragment();
    newFragment.show(getFragmentManager(), "datePicker");
}

12. MainActivity#showDialog()

Project: codeexamples-android
File: MainActivity.java
void showDialog(String text) {
    // 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 = getFragmentManager().beginTransaction();
    DialogFragment newFragment = MyDialogFragment.newInstance(text);
    // Show the dialog.
    newFragment.show(ft, "dialog");
}

13. FragmentDialogOrActivity#showDialog()

Project: codeexamples-android
File: FragmentDialogOrActivity.java
void showDialog() {
    // Create the fragment and show it as a dialog.
    DialogFragment newFragment = MyDialogFragment.newInstance();
    newFragment.show(getFragmentManager(), "dialog");
}

14. FragmentAlertDialog#showDialog()

Project: codeexamples-android
File: FragmentAlertDialog.java
void showDialog() {
    DialogFragment newFragment = MyAlertDialogFragment.newInstance(R.string.alert_dialog_two_buttons_title);
    newFragment.show(getFragmentManager(), "dialog");
}

15. MainActivity#showDialog()

Project: codeexamples-android
File: MainActivity.java
void showDialog(String text) {
    // 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 = getFragmentManager().beginTransaction();
    DialogFragment newFragment = MyDialogFragment.newInstance(text);
    // Show the dialog.
    newFragment.show(ft, "dialog");
}

16. FragmentDialogOrActivity#showDialog()

Project: android-maven-plugin
File: FragmentDialogOrActivity.java
void showDialog() {
    // Create the fragment and show it as a dialog.
    DialogFragment newFragment = MyDialogFragment.newInstance();
    newFragment.show(getFragmentManager(), "dialog");
}

17. FragmentAlertDialog#showDialog()

Project: android-maven-plugin
File: FragmentAlertDialog.java
void showDialog() {
    DialogFragment newFragment = MyAlertDialogFragment.newInstance(R.string.alert_dialog_two_buttons_title);
    newFragment.show(getFragmentManager(), "dialog");
}

18. RecordActivity#tappedTime()

Project: Android-LensRocket
File: RecordActivity.java
public void tappedTime(View view) {
    DialogFragment newFragment = new NumberPickerFragment();
    newFragment.show(getFragmentManager(), "timePicker");
}

19. ListActivity#showEventDetails()

Project: android-autostarts
File: ListActivity.java
protected void showEventDetails(IntentFilterInfo event) {
    FragmentTransaction ft = getFragmentManager().beginTransaction();
    Fragment prev = getFragmentManager().findFragmentByTag("details");
    if (prev != null)
        ft.remove(prev);
    ft.addToBackStack(null);
    DialogFragment newFragment = EventDetailsFragment.newInstance(event);
    newFragment.show(ft, "details");
}

20. AccountSetupCheckSettings#showDialogFragment()

Project: k-9
File: AccountSetupCheckSettings.java
private void showDialogFragment(int dialogId, String customMessage) {
    if (mDestroyed) {
        return;
    }
    mProgressBar.setIndeterminate(false);
    DialogFragment fragment;
    switch(dialogId) {
        case R.id.dialog_account_setup_error:
            {
                fragment = ConfirmationDialogFragment.newInstance(dialogId, getString(R.string.account_setup_failed_dlg_title), customMessage, getString(R.string.account_setup_failed_dlg_edit_details_action), getString(R.string.account_setup_failed_dlg_continue_action));
                break;
            }
        default:
            {
                throw new RuntimeException("Called showDialog(int) with unknown dialog id.");
            }
    }
    FragmentTransaction ta = getFragmentManager().beginTransaction();
    ta.add(fragment, getDialogTag(dialogId));
    ta.commitAllowingStateLoss();
// TODO: commitAllowingStateLoss() is used to prevent https://code.google.com/p/android/issues/detail?id=23761
// but is a bad...
//fragment.show(ta, getDialogTag(dialogId));
}