mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-24 19:47:38 +00:00
Better back pressing logic
This commit is contained in:
parent
64601baa76
commit
adfffe6121
@ -34,7 +34,7 @@ public class MainActivity extends BaseActivity
|
|||||||
|
|
||||||
private final Handler mDrawerHandler = new Handler();
|
private final Handler mDrawerHandler = new Handler();
|
||||||
private int mDrawerItem;
|
private int mDrawerItem;
|
||||||
private boolean fromShortcut = true;
|
private static boolean fromShortcut = false;
|
||||||
|
|
||||||
@BindView(R.id.drawer_layout) DrawerLayout drawer;
|
@BindView(R.id.drawer_layout) DrawerLayout drawer;
|
||||||
@BindView(R.id.toolbar) public Toolbar toolbar;
|
@BindView(R.id.toolbar) public Toolbar toolbar;
|
||||||
@ -50,12 +50,7 @@ public class MainActivity extends BaseActivity
|
|||||||
@Override
|
@Override
|
||||||
protected void onCreate(final Bundle savedInstanceState) {
|
protected void onCreate(final Bundle savedInstanceState) {
|
||||||
if (!mm.hasInit) {
|
if (!mm.hasInit) {
|
||||||
Intent intent = new Intent(this, SplashActivity.class);
|
startActivity(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);
|
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,8 +78,11 @@ public class MainActivity extends BaseActivity
|
|||||||
drawer.addDrawerListener(toggle);
|
drawer.addDrawerListener(toggle);
|
||||||
toggle.syncState();
|
toggle.syncState();
|
||||||
|
|
||||||
if (savedInstanceState == null)
|
if (savedInstanceState == null) {
|
||||||
navigate(getIntent().getStringExtra(Const.Key.OPEN_SECTION));
|
String section = getIntent().getStringExtra(Const.Key.OPEN_SECTION);
|
||||||
|
fromShortcut = section != null;
|
||||||
|
navigate(section);
|
||||||
|
}
|
||||||
|
|
||||||
navigationView.setNavigationItemSelectedListener(this);
|
navigationView.setNavigationItemSelectedListener(this);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user