Select the correct MenuItem when Back is pressed in NawDrawer

Signed-off-by: goapunk <noobie@goapunks.net>
This commit is contained in:
goapunk
2016-11-26 23:09:07 +01:00
parent 6fc42f7296
commit 47171f3e18

View File

@@ -183,12 +183,19 @@ public class NavDrawerActivity extends BriarFragmentActivity implements
drawerLayout.closeDrawer(START);
clearBackStack();
loadFragment(item.getItemId());
//Don't display the Settings Item as checked
if(item.getItemId() == R.id.nav_btn_settings){
return false;
}
return true;
}
@Override
public void onBackPressed() {
// Check the Contacts item because we always return to Contacts here
NavigationView navigation = (NavigationView) findViewById(R.id.navigation);
navigation.getMenu().findItem(R.id.nav_btn_contacts).setChecked(true);
if (getSupportFragmentManager().getBackStackEntryCount() == 0
&& drawerLayout.isDrawerOpen(START)) {
drawerLayout.closeDrawer(START);