Procházet zdrojové kódy

switch account will close all activities

billyyoyo před 5 roky
rodič
revize
0a22f87d74

+ 5 - 11
app/src/main/java/com/sheep/gamegroup/view/activity/ActMain.java

@@ -137,6 +137,8 @@ public class ActMain extends BaseActYmPermissionCheck {
             Jump2View.getInstance().goLoginView(this, "home");
         } else if (intent.hasExtra("SWITCH_TAB")) {
             switchFragment(intent.getIntExtra("SWITCH_TAB", 0));
+        } else if ("EXIT".equals(intent.getStringExtra("INTENT_ACTION"))) {
+            exit(false);
         }
     }
 
@@ -338,16 +340,6 @@ public class ActMain extends BaseActYmPermissionCheck {
      */
     private void doBackPress() {
         if (System.currentTimeMillis() - mLastBackTime < 1000) {
-//            List<Fragment> fragmentList = getSupportFragmentManager().getFragments();
-//            FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
-//            for (Fragment fragment : fragmentList) {
-//                try {
-//                    transaction.remove(fragment);
-//                } catch (Exception e) {
-//                    e.printStackTrace();
-//                }
-//            }
-//            transaction.commitAllowingStateLoss();
             exit(true);
         } else {
             try {
@@ -485,7 +477,9 @@ public class ActMain extends BaseActYmPermissionCheck {
                 DialogStorageLow.showDialog(null);
                 break;
             case APP_EXIT:
-                exit(false);
+                Intent intent = new Intent(this, ActMain.class).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+                intent.putExtra("INTENT_ACTION", "EXIT");
+                startActivity(intent);
                 return;
         }
         if (progressView != null && event.getData() instanceof DownLoadInfo) {