Commit ae173688 by wjg

添加空闲时间清空购物车,并回到首页

parent 83340ba8
...@@ -83,6 +83,7 @@ public class ConfirmOrderDialog extends Dialog { ...@@ -83,6 +83,7 @@ public class ConfirmOrderDialog extends Dialog {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
this.setContentView(R.layout.view_confirm_order); this.setContentView(R.layout.view_confirm_order);
initViews(); initViews();
LauncherActivity.TIMEOUT_TOGGLE = false;
} }
private void initViews() { private void initViews() {
...@@ -171,6 +172,7 @@ public class ConfirmOrderDialog extends Dialog { ...@@ -171,6 +172,7 @@ public class ConfirmOrderDialog extends Dialog {
OnDismissListener dismissListener = new OnDismissListener() { OnDismissListener dismissListener = new OnDismissListener() {
@Override @Override
public void onDismiss(DialogInterface dialog) { public void onDismiss(DialogInterface dialog) {
LauncherActivity.TIMEOUT_TOGGLE = true;
Utils.fastBroadcast(getContext(), Base.BROADCAST_ACTION_CLEAR_GOODS); Utils.fastBroadcast(getContext(), Base.BROADCAST_ACTION_CLEAR_GOODS);
if (expireThread != null) { if (expireThread != null) {
expireThread.interrupt(); expireThread.interrupt();
......
...@@ -700,6 +700,8 @@ public class LauncherActivity extends Activity { ...@@ -700,6 +700,8 @@ public class LauncherActivity extends Activity {
} }
public static Long TIMESTAMP = System.currentTimeMillis(); public static Long TIMESTAMP = System.currentTimeMillis();
public static Boolean TIMEOUT_TOGGLE = true;
/** 判断空闲时间定时器 */ /** 判断空闲时间定时器 */
private class TimeoutThread extends Thread { private class TimeoutThread extends Thread {
@Override @Override
...@@ -708,8 +710,12 @@ public class LauncherActivity extends Activity { ...@@ -708,8 +710,12 @@ public class LauncherActivity extends Activity {
try { try {
while (true) { while (true) {
Thread.sleep(1000); Thread.sleep(1000);
if (!TIMEOUT_TOGGLE) { // 打开确认订单弹窗,停止判断空闲
TIMESTAMP = Utils.getTimestamp();
continue;
}
Log.i(AppConfig.TAG, String.valueOf(Utils.getTimestamp() - TIMESTAMP)); Log.i(AppConfig.TAG, String.valueOf(Utils.getTimestamp() - TIMESTAMP));
if (Utils.getTimestamp() - TIMESTAMP > 1000 * 5) { if (Utils.getTimestamp() - TIMESTAMP > 1000 * 30) {
TIMESTAMP = Utils.getTimestamp(); TIMESTAMP = Utils.getTimestamp();
Utils.fastBroadcast(HLApplication.SELF, Base.BROADCAST_ACTION_CLEAR_GOODS); Utils.fastBroadcast(HLApplication.SELF, Base.BROADCAST_ACTION_CLEAR_GOODS);
Utils.fastBroadcast(HLApplication.SELF, Base.BROADCAST_ACTION_TIMEOUT); Utils.fastBroadcast(HLApplication.SELF, Base.BROADCAST_ACTION_TIMEOUT);
......
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