|
@@ -3,6 +3,7 @@ package com.cooleshow.institution.stu.ui.main;
|
|
|
import android.Manifest;
|
|
|
import android.os.Bundle;
|
|
|
import android.text.TextUtils;
|
|
|
+import android.view.KeyEvent;
|
|
|
import android.view.View;
|
|
|
import android.widget.TextView;
|
|
|
|
|
@@ -15,6 +16,7 @@ import com.cooleshow.base.router.RouterPath;
|
|
|
import com.cooleshow.base.ui.activity.BaseActivity;
|
|
|
import com.cooleshow.base.ui.activity.BaseMVPActivity;
|
|
|
import com.cooleshow.base.utils.LogUtils;
|
|
|
+import com.cooleshow.base.utils.ToastUtil;
|
|
|
import com.cooleshow.base.utils.helper.MidiFileHelper;
|
|
|
import com.cooleshow.base.utils.helper.QMUIStatusBarHelper;
|
|
|
import com.cooleshow.base.utils.helper.UpdateAppHelper;
|
|
@@ -54,6 +56,9 @@ public class MainActivity extends BaseMVPActivity<ActivityInstitutionMainLayoutB
|
|
|
private HomeFragment mHomeFragment;
|
|
|
private boolean isNeedSetPushId = true;
|
|
|
private boolean isShowActivationCodeTip = true;
|
|
|
+
|
|
|
+ private static final int EXIT_APP_DELAY = 1000;
|
|
|
+ private long lastTime = 0;
|
|
|
private IUnReadMessageObserver mUnReadMessageObserver = new IUnReadMessageObserver() {
|
|
|
@Override
|
|
|
public void onTotalUnreadMessageCountChanged(long totalUnreadCount) {
|
|
@@ -271,6 +276,29 @@ public class MainActivity extends BaseMVPActivity<ActivityInstitutionMainLayoutB
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 监听返回键
|
|
|
+ *
|
|
|
+ * @param keyCode
|
|
|
+ * @param event
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public boolean onKeyDown(int keyCode, KeyEvent event) {
|
|
|
+
|
|
|
+ if (keyCode == KeyEvent.KEYCODE_BACK) {
|
|
|
+ if ((System.currentTimeMillis() - lastTime) > EXIT_APP_DELAY) {
|
|
|
+ ToastUtil.getInstance().showShort(getString(com.cooleshow.base.R.string.press_twice_exit));
|
|
|
+ lastTime = System.currentTimeMillis();
|
|
|
+ } else {
|
|
|
+ moveTaskToBack(true);
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+
|
|
|
+ }
|
|
|
+ return super.onKeyDown(keyCode, event);
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public void onDestroy() {
|
|
|
super.onDestroy();
|