Commit 49cd5cf6 authored by 陈前's avatar 陈前

Merge remote-tracking branch 'origin/master'

parents 5f4175a5 2f963fb3
......@@ -55,6 +55,8 @@ public abstract class BaseDialog<P extends BasePresenter, B extends ViewDataBind
public boolean isShowing;
private long recLen = -1;
private boolean shutDown = false;
//强制关闭时间
long time = 0;
static {
AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
......@@ -302,18 +304,24 @@ public abstract class BaseDialog<P extends BasePresenter, B extends ViewDataBind
}
}
/**
* 强制关闭dialog
*/
public void toughDismiss() {
if (shutDown) {
if (System.currentTimeMillis() - time < 500) {
dismiss();
} else {
if (recLen <= 0) {
dismiss();
} else {
ToastUtils.showLong(recLen + "s 后可关闭");
ToastUtils.showLong(recLen + "s 后可关闭,双击返回按钮可强制关闭");
}
}
time = System.currentTimeMillis();
}
}
/**
......@@ -343,5 +351,4 @@ public abstract class BaseDialog<P extends BasePresenter, B extends ViewDataBind
mBaseBinding.btnConfirm.setText(OK);
return this;
}
}
\ No newline at end of file
......@@ -31,10 +31,10 @@ public class LoadingDialog extends BaseDialog<BasePresenter, DialogLoadingBindin
this.getDialog().setOnKeyListener(new DialogInterface.OnKeyListener() {
@Override
public boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
if (i == keyEvent.KEYCODE_BACK) {
if (i == keyEvent.KEYCODE_BACK && keyEvent.getAction() == KeyEvent.ACTION_DOWN) {
toughDismiss();
}
return true;
return false;
}
});
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment