From adfffe6121b59236f1bf1e7f7ffc0f056a08f64c Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Thu, 30 Aug 2018 04:19:08 -0400 Subject: [PATCH] Better back pressing logic --- .../java/com/topjohnwu/magisk/MainActivity.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/app/src/full/java/com/topjohnwu/magisk/MainActivity.java b/app/src/full/java/com/topjohnwu/magisk/MainActivity.java index 6f49485b9..144e01466 100644 --- a/app/src/full/java/com/topjohnwu/magisk/MainActivity.java +++ b/app/src/full/java/com/topjohnwu/magisk/MainActivity.java @@ -34,7 +34,7 @@ public class MainActivity extends BaseActivity private final Handler mDrawerHandler = new Handler(); private int mDrawerItem; - private boolean fromShortcut = true; + private static boolean fromShortcut = false; @BindView(R.id.drawer_layout) DrawerLayout drawer; @BindView(R.id.toolbar) public Toolbar toolbar; @@ -50,12 +50,7 @@ public class MainActivity extends BaseActivity @Override protected void onCreate(final Bundle savedInstanceState) { if (!mm.hasInit) { - Intent intent = new Intent(this, SplashActivity.class); - String section = getIntent().getStringExtra(Const.Key.OPEN_SECTION); - if (section != null) { - intent.putExtra(Const.Key.OPEN_SECTION, section); - } - startActivity(intent); + startActivity(new Intent(this, SplashActivity.class)); finish(); } @@ -83,8 +78,11 @@ public class MainActivity extends BaseActivity drawer.addDrawerListener(toggle); toggle.syncState(); - if (savedInstanceState == null) - navigate(getIntent().getStringExtra(Const.Key.OPEN_SECTION)); + if (savedInstanceState == null) { + String section = getIntent().getStringExtra(Const.Key.OPEN_SECTION); + fromShortcut = section != null; + navigate(section); + } navigationView.setNavigationItemSelectedListener(this); }