當前位置: 首頁>>代碼示例>>Java>>正文


Java Dialog.dismiss方法代碼示例

本文整理匯總了Java中android.app.Dialog.dismiss方法的典型用法代碼示例。如果您正苦於以下問題:Java Dialog.dismiss方法的具體用法?Java Dialog.dismiss怎麽用?Java Dialog.dismiss使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.app.Dialog的用法示例。


在下文中一共展示了Dialog.dismiss方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: dismiss

import android.app.Dialog; //導入方法依賴的package包/類
/**
 * 關閉彈出框
 */
public static void dismiss(DialogInterface... dialogs) {
    if (dialogs != null && dialogs.length > 0) {
        for (DialogInterface dialog : dialogs) {
            if (dialog instanceof Dialog) {
                Dialog dialog1 = (Dialog) dialog;
                if (dialog1.isShowing()) {
                    dialog1.dismiss();
                }
            } else if (dialog instanceof AppCompatDialog) {
                AppCompatDialog dialog2 = (AppCompatDialog) dialog;
                if (dialog2.isShowing()) {
                    dialog2.dismiss();
                }
            }
        }

    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:22,代碼來源:DialogUIUtils.java

示例2: dismiss

import android.app.Dialog; //導入方法依賴的package包/類
/**
 * 關閉彈出框
 */
public static void dismiss(DialogInterface... dialogs) {
    if (dialogs != null && dialogs.length > 0) {
        for (DialogInterface dialog : dialogs) {
            if (dialog instanceof Dialog) {
                Dialog dialog1 = (Dialog) dialog;
                if (dialog1.isShowing()) {
                    dialog1.dismiss();
                }
            } else if (dialog instanceof AppCompatDialog) {
                AppCompatDialog dialog2 = (AppCompatDialog) dialog;
                if (dialog2.isShowing()) {
                    dialog2.dismiss();
                }
            }
        }

    }


}
 
開發者ID:devzwy,項目名稱:KUtils,代碼行數:24,代碼來源:DialogUIUtils.java

示例3: showDialogForAvatarOrDismiss

import android.app.Dialog; //導入方法依賴的package包/類
private void showDialogForAvatarOrDismiss(boolean showOrNotShow)
{
    if (showOrNotShow)
    {
        avatarClickDialog = new Dialog(getActivity(), R.style.Theme_Light_Dialog);
        dialogView = LayoutInflater.from(getActivity()).inflate(R.layout.layout_dialog,null);
        //獲得dialog的window窗口
        Window window = avatarClickDialog.getWindow();
        //設置dialog在屏幕底部
        window.setGravity(Gravity.BOTTOM);
        //設置dialog彈出時的動畫效果,從屏幕底部向上彈出
        window.setWindowAnimations(R.style.dialogStyle);
        window.getDecorView().setPadding(0, 0, 0, 0);
        //獲得window窗口的屬性
        android.view.WindowManager.LayoutParams lp = window.getAttributes();
        //設置窗口寬度為充滿全屏
        lp.width = WindowManager.LayoutParams.MATCH_PARENT;
        //設置窗口高度為包裹內容
        lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
        //將設置好的屬性set回去
        window.setAttributes(lp);
        //將自定義布局加載到dialog上
        avatarClickDialog.setContentView(dialogView);
        //初始化Button
        btn_camera= (Button) dialogView.findViewById(R.id.btn_camera);
        btn_album= (Button) dialogView.findViewById(R.id.btn_album);
        btn_cancel= (Button) dialogView.findViewById(R.id.btn_cancel);
        //監聽Button
        btn_camera.setOnClickListener(this);
        btn_album.setOnClickListener(this);
        btn_cancel.setOnClickListener(this);
        avatarClickDialog.show();
    }
    else
    {
        avatarClickDialog.dismiss();
    }
}
 
開發者ID:WindFromFarEast,項目名稱:SmartButler,代碼行數:39,代碼來源:UserFragment.java

示例4: tryToDismiss

import android.app.Dialog; //導入方法依賴的package包/類
private void tryToDismiss() {
    supposedToBeDismissed = true;
    try {
        Dialog dialog = getDialog();
        if (dialog != null)
            dialog.dismiss();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
開發者ID:feifadaima,項目名稱:https-github.com-hyb1996-NoRootScriptDroid,代碼行數:11,代碼來源:AbstractIssueReporterActivity.java

示例5: FileChooser

import android.app.Dialog; //導入方法依賴的package包/類
public FileChooser(Activity activity) {
    this.activity = activity;
    dialog = new Dialog(activity);
    list = new ListView(activity);
    list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
        @Override
        public void onItemClick(AdapterView<?> parent, View view, int which, long id) {
            String fileChosen = (String) list.getItemAtPosition(which);
            File chosenFile = getChosenFile(fileChosen);
            if (chosenFile.isDirectory()) {
                refresh(chosenFile);
            } else {
                if (fileListener != null) {
                    fileListener.fileSelected(chosenFile);
                }
                dialog.dismiss();
            }
        }
    });
    dialog.setContentView(list);
    dialog.getWindow().setLayout(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
    FileManager manager = new FileManager(activity);

    try {
        refresh(manager.getExternalFilesDir());
    } catch (IOException e) {
        dialog.dismiss();
        dismissed = true;
        Utils.showInformationDialog(activity.getString(R.string.external_storage_exception_title), activity.getString(R.string.external_storage_exception_message), activity, Utils.createDismissListener());
    }
}
 
開發者ID:AbyxBelgium,項目名稱:Loyalty,代碼行數:32,代碼來源:FileChooser.java

示例6: safeCloseDialog

import android.app.Dialog; //導入方法依賴的package包/類
public static void safeCloseDialog(Dialog dialog) {
    if (dialog != null) {
        try {
            if (dialog.isShowing()) {
                Activity ownerActivity = dialog.getOwnerActivity();
                if (ownerActivity == null || !ownerActivity.isFinishing()) {
                    dialog.dismiss();
                }
            }
        } catch (Exception e) {
            Log.e(TAG, "dialog dismiss error", e);
        }
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:15,代碼來源:SocializeUtils.java

示例7: safeCloseDialog

import android.app.Dialog; //導入方法依賴的package包/類
/**
 * 關閉Dialog
 */
public static void safeCloseDialog(Dialog dialog) {
    try {
        if (dialog != null && dialog.isShowing()) {
            dialog.dismiss();
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
開發者ID:zhonglikui,項目名稱:cardinalsSample,代碼行數:13,代碼來源:DialogUtil.java

示例8: dismiss

import android.app.Dialog; //導入方法依賴的package包/類
/**
 * Tries to dismiss the given {@link Dialog}.
 *
 * @param dialog Which dialog to dismiss
 * @return {@code True} if the given dialog is not {@code null}, it is currently showing and dismiss was invoked; {@code false}
 * otherwise
 */
public static boolean dismiss(@Nullable final Dialog dialog) {
    if (dialog != null && dialog.isShowing()) {
        dialog.dismiss();
        return true;
    } else {
        return false;
    }
}
 
開發者ID:milosmns,項目名稱:silly-android,代碼行數:16,代碼來源:SillyAndroid.java

示例9: closeDialog

import android.app.Dialog; //導入方法依賴的package包/類
/**
 * 關閉dialog
 *
 * @param mDialogUtils
 */
public static void closeDialog(Dialog mDialogUtils) {
    if (mDialogUtils != null && mDialogUtils.isShowing()) {
        mDialogUtils.dismiss();
    }
}
 
開發者ID:Loofer,項目名稱:Watermark,代碼行數:11,代碼來源:DefaultDialogUtils.java

示例10: toDismissDialog

import android.app.Dialog; //導入方法依賴的package包/類
protected void toDismissDialog(Dialog dialog) {
    if (dialog != null && dialog.isShowing()) {
        dialog.dismiss();
    }
}
 
開發者ID:Justson,項目名稱:AgentWeb,代碼行數:6,代碼來源:AgentWebUIController.java

示例11: toDismissDialog

import android.app.Dialog; //導入方法依賴的package包/類
private void toDismissDialog(Dialog dialog) {
    if (dialog != null)
        dialog.dismiss();

}
 
開發者ID:Justson,項目名稱:AgentWeb,代碼行數:6,代碼來源:DefaultChromeClient.java

示例12: dismissDialog

import android.app.Dialog; //導入方法依賴的package包/類
private static void dismissDialog(Dialog dialog)
{
    if (dialog != null)
        dialog.dismiss();
}
 
開發者ID:rtr-nettest,項目名稱:open-rmbt,代碼行數:6,代碼來源:RMBTTestFragment.java

示例13: closeDialog

import android.app.Dialog; //導入方法依賴的package包/類
/**
 * 關閉dialog
 *
 * http://blog.csdn.net/qq_21376985
 *
 * @param mDialogUtils
 */
public static void closeDialog(Dialog mDialogUtils) {
    if (mDialogUtils != null && mDialogUtils.isShowing()) {
        mDialogUtils.dismiss();
    }
}
 
開發者ID:MedicationReminder,項目名稱:MedicationReminder,代碼行數:13,代碼來源:DialogThridUtils.java


注:本文中的android.app.Dialog.dismiss方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。