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

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

Introduction

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

Prototype

public void dismiss() 

Source Link

Document

Dismiss the fragment and its dialog.

Usage

From source file:piuk.blockchain.android.ui.dialogs.RequestForgotPasswordDialog.java

public static DialogFragment show(final FragmentManager fm, SuccessCallback callback) {

    final DialogFragment prev = (DialogFragment) fm.findFragmentById(R.layout.forgot_password_dialog);

    final FragmentTransaction ft = fm.beginTransaction();

    if (prev != null) {
        prev.dismiss();
        ft.remove(prev);/* w w w .  j a va 2 s  .  c o m*/
    }

    ft.addToBackStack(null);

    final RequestForgotPasswordDialog newFragment = instance();

    newFragment.show(ft, FRAGMENT_TAG);

    newFragment.callback = callback;

    return newFragment;
}

From source file:piuk.blockchain.android.ui.dialogs.RequestPasswordDialog.java

public static DialogFragment show(final FragmentManager fm, SuccessCallback callback, int passwordType) {

    final DialogFragment prev = (DialogFragment) fm.findFragmentById(R.layout.password_dialog);

    final FragmentTransaction ft = fm.beginTransaction();

    if (prev != null) {
        prev.dismiss();
        ft.remove(prev);/*from   w ww. jav  a  2s .  c o m*/
    }

    ft.addToBackStack(null);

    final RequestPasswordDialog newFragment = instance();

    if (passwordType == PasswordTypeMain || passwordType == PasswordTypeMainNoValidate)
        newFragment.setCancelable(false);
    else
        newFragment.setCancelable(true);

    newFragment.show(ft, FRAGMENT_TAG);

    newFragment.passwordType = passwordType;

    newFragment.callback = callback;

    return newFragment;
}

From source file:piuk.blockchain.android.ui.NewAccountFragment.java

public static NewAccountFragment show(final FragmentManager fm, WalletApplication application) {
    final DialogFragment prev = (DialogFragment) fm.findFragmentById(R.layout.new_account_dialog);

    final FragmentTransaction ft = fm.beginTransaction();

    if (prev != null) {
        prev.dismiss();
        ft.remove(prev);/* w  w w .ja  v a 2 s. c  o  m*/
    }

    ft.addToBackStack(null);

    final NewAccountFragment newFragment = instance();

    newFragment.application = application;

    newFragment.show(ft, FRAGMENT_TAG);

    return newFragment;
}

From source file:piuk.blockchain.android.ui.dialogs.NewAccountDialog.java

public static NewAccountDialog show(final FragmentManager fm, WalletApplication application) {
    final DialogFragment prev = (DialogFragment) fm.findFragmentById(R.layout.new_account_dialog);

    final FragmentTransaction ft = fm.beginTransaction();

    if (prev != null) {
        prev.dismiss();
        ft.remove(prev);/*  w w  w  .  ja v a 2  s. c o m*/
    }

    ft.addToBackStack(null);

    final NewAccountDialog newFragment = instance();

    newFragment.application = application;

    newFragment.show(ft, FRAGMENT_TAG);

    return newFragment;
}

From source file:piuk.blockchain.android.ui.dialogs.TransactionSummaryDialog.java

public static TransactionSummaryDialog show(final FragmentManager fm, WalletApplication application,
        Transaction tx) {//from   ww  w  . ja v a 2s  .  c  om
    final DialogFragment prev = (DialogFragment) fm.findFragmentById(R.layout.transaction_summary_fragment);

    final FragmentTransaction ft = fm.beginTransaction();

    if (prev != null) {
        prev.dismiss();
        ft.remove(prev);
    }

    ft.addToBackStack(null);

    final TransactionSummaryDialog newFragment = instance();

    newFragment.application = application;

    newFragment.show(ft, FRAGMENT_TAG);

    newFragment.tx = tx;

    return newFragment;
}

From source file:org.ohmage.auth.AuthenticatorActivity.java

/**
 * Shows the error dialog if there is one from {@link GoogleAuthUtil}
 *
 * @param errorDialog// w w  w .  j  ava2 s. co  m
 */
public static void showErrorDialog(FragmentManager fragmentManager, DialogFragment errorDialog) {
    DialogFragment oldErrorDialog = (DialogFragment) fragmentManager.findFragmentByTag(TAG_ERROR_DIALOG);
    if (oldErrorDialog != null) {
        oldErrorDialog.dismiss();
    }

    errorDialog.show(fragmentManager, TAG_ERROR_DIALOG);
}

From source file:com.microsoft.office365.meetingfeedback.util.DialogUtil.java

public void dismissDialog(BaseActivity activity) {
    Fragment dialogFragment = activity.getSupportFragmentManager().findFragmentByTag(TAG_DIALOG);
    if (dialogFragment != null) {
        DialogFragment df = (DialogFragment) dialogFragment;
        df.dismiss();
        activity.setDialog(null);/*  w w w.  j  a v  a2s.  c  om*/
    }
}

From source file:com.github.piasy.safelyandroid.dialogfragment.SupportDialogFragmentDismissDelegate.java

/**
 * called at the {@link android.support.v4.app.DialogFragment#onResume()}, it will be
 * dismissed if it has a pending dismiss job.
 *
 * @param dialogFragment the {@link android.support.v4.app.DialogFragment} resumed
 * @return {@code true} if it is dismissed.
 *//*www  .j  a va2 s.c o  m*/
@SuppressLint("UnsafeDismiss")
public boolean onResumed(android.support.v4.app.DialogFragment dialogFragment) {
    if (mPendingDismiss) {
        dialogFragment.dismiss();
        mPendingDismiss = false;
        return true;
    }
    return false;
}

From source file:com.github.piasy.safelyandroid.dialogfragment.SupportDialogFragmentDismissDelegate.java

/**
 * safe dismiss the {@link android.support.v4.app.DialogFragment}, when the
 * {@link android.support.v4.app.DialogFragment} is resumed, dismiss it right now, other wise,
 * dismiss it when {@link #onResumed(android.support.v4.app.DialogFragment)} is called.
 *
 * @param dialogFragment the {@link android.support.v4.app.DialogFragment} want to be dismissed
 * safely/* w  ww .  ja v a  2 s.c  o m*/
 * @return {@code true} if the {@link android.support.v4.app.DialogFragment} will be dismissed
 * when {@link #onResumed(android.support.v4.app.DialogFragment)} is called
 */
@SuppressLint("UnsafeDismiss")
public boolean safeDismiss(android.support.v4.app.DialogFragment dialogFragment) {
    if (dialogFragment.isResumed()) {
        dialogFragment.dismiss();
        return false;
    } else {
        mPendingDismiss = true;
        return true;
    }
}

From source file:com.wujilin.doorbell.starter.FragmentStarter.java

@Override
protected void exit(Fragment starter) {
    if (starter instanceof DialogFragment) {
        DialogFragment fragment = (DialogFragment) starter;
        if (fragment.getShowsDialog()) {
            fragment.dismiss();
            return;
        }/* w  w w  .  j a  va 2s .c om*/
    }
    Activity activity = getActivity();
    if (activity != null) {
        activity.finish();
    }
}