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 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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user