From a90a446005b96e526d4067586e7e473fb8cfe9a0 Mon Sep 17 00:00:00 2001 From: cgspine Date: Tue, 26 Dec 2017 20:03:00 +0800 Subject: [PATCH] cancelable of QMUITipDialog #132 --- .../com/qmuiteam/qmui/widget/dialog/QMUITipDialog.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/qmui/src/main/java/com/qmuiteam/qmui/widget/dialog/QMUITipDialog.java b/qmui/src/main/java/com/qmuiteam/qmui/widget/dialog/QMUITipDialog.java index 0b00f2c73..5478a9e80 100644 --- a/qmui/src/main/java/com/qmuiteam/qmui/widget/dialog/QMUITipDialog.java +++ b/qmui/src/main/java/com/qmuiteam/qmui/widget/dialog/QMUITipDialog.java @@ -45,7 +45,6 @@ public QMUITipDialog(Context context) { public QMUITipDialog(Context context, int themeResId) { super(context, themeResId); setCanceledOnTouchOutside(false); - setCancelable(false); } @Override @@ -126,13 +125,19 @@ public Builder setTipWord(CharSequence tipWord) { return this; } + public QMUITipDialog create(){ + return create(true); + } + /** * 创建 Dialog, 但没有弹出来, 如果要弹出来, 请调用返回值的 {@link Dialog#show()} 方法 * + * @param cancelable 按系统返回键是否可以取消 * @return 创建的 Dialog */ - public QMUITipDialog create() { + public QMUITipDialog create(boolean cancelable) { QMUITipDialog dialog = new QMUITipDialog(mContext); + dialog.setCancelable(cancelable); dialog.setContentView(R.layout.qmui_tip_dialog_layout); ViewGroup contentWrap = (ViewGroup) dialog.findViewById(R.id.contentWrap);