Java Code Examples for androidx.fragment.app.DialogFragment#dismiss()

The following examples show how to use androidx.fragment.app.DialogFragment#dismiss() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Installer2Fragment.java    From SAI with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void handleActionView(Uri uri) {
    if (!isAdded()) {
        mPendingActionViewUri = uri;
        return;
    }

    if (mHelper.isInstallerXEnabled()) {
        openInstallerXDialog(uri);
    } else {
        DialogFragment existingDialog = (DialogFragment) getChildFragmentManager().findFragmentByTag("installation_confirmation_dialog");
        if (existingDialog != null)
            existingDialog.dismiss();

        InstallationConfirmationDialogFragment.newInstance(uri).show(getChildFragmentManager(), "installation_confirmation_dialog");
    }

}
 
Example 2
Source File: DialogUtils.java    From DevUtils with Apache License 2.0 5 votes vote down vote up
/**
 * 关闭 DialogFragment
 * @param dialog {@link DialogFragment}
 * @return {@code true} success, {@code false} fail
 */
public static boolean closeDialog(final DialogFragment dialog) {
    if (dialog != null) {
        try {
            dialog.dismiss();
            return true;
        } catch (Exception e) {
            LogPrintUtils.eTag(TAG, e, "closeDialog");
        }
    }
    return false;
}
 
Example 3
Source File: Installer2Fragment.java    From SAI with GNU General Public License v3.0 5 votes vote down vote up
private void openInstallerXDialog(@Nullable Uri apkSourceUri) {
    DialogFragment existingDialog = (DialogFragment) getChildFragmentManager().findFragmentByTag("installerx_dialog");
    if (existingDialog != null)
        existingDialog.dismiss();

    InstallerXDialogFragment.newInstance(apkSourceUri, null).show(getChildFragmentManager(), "installerx_dialog");
}
 
Example 4
Source File: LegacyInstallerFragment.java    From SAI with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void handleActionView(Uri uri) {
    if (!isAdded()) {
        mPendingActionViewUri = uri;
        return;
    }

    DialogFragment existingDialog = (DialogFragment) getChildFragmentManager().findFragmentByTag("installation_confirmation_dialog");
    if (existingDialog != null)
        existingDialog.dismiss();
    InstallationConfirmationDialogFragment.newInstance(uri).show(getChildFragmentManager(), "installation_confirmation_dialog");
}
 
Example 5
Source File: CodeAndRunActivity.java    From AndroidQuick with MIT License 5 votes vote down vote up
@Override
public void onDestroy() {
    super.onDestroy();
    Fragment prev = getSupportFragmentManager().findFragmentByTag("BottomDialogFragment");
    if (prev != null) {
        DialogFragment df = (DialogFragment) prev;
        df.dismiss();
    }
}
 
Example 6
Source File: CodeAndRunFragment.java    From AndroidQuick with MIT License 5 votes vote down vote up
@Override
public void onDestroy() {
    super.onDestroy();
    Fragment prev = getSupportFragmentManager().findFragmentByTag("BottomDialogFragment");
    if (prev != null) {
        DialogFragment df = (DialogFragment) prev;
        df.dismiss();
    }
}
 
Example 7
Source File: DialogFragmentHelper.java    From Alligator with MIT License 5 votes vote down vote up
public void hideDialog() {
	DialogFragment dialogFragment = (DialogFragment) mFragmentManager.findFragmentByTag(TAG);
	if (dialogFragment == null) {
		throw new IllegalStateException("Dialog is not visible.");
	}

	dialogFragment.dismiss();
	mFragmentManager.executePendingTransactions();
}
 
Example 8
Source File: CommCareActivity.java    From commcare-android with Apache License 2.0 5 votes vote down vote up
@Override
public void dismissAlertDialog() {
    DialogFragment alertDialog = getCurrentAlertDialog();
    if (alertDialog != null) {
        alertDialog.dismiss();
    }
}