Skip to content
Snippets Groups Projects
Commit d5443e96 authored by akwizgran's avatar akwizgran
Browse files

Merge branch '889-select-navdrawer-item-when-coming-from-notification' into 'master'


Check the blog item in NavDrawer when opening a blog via notification

There are three scenarios where the selected item in the NavDrawer changes:
1. The user selects an item -> the item is checked automatically.
2. The user pressed back -> already handled in onBackPressed (needs to be extended with #606)
3. The user touched a notification -> handled by this commit.
   
Signed-off-by: default avatargoapunk <noobie@goapunks.net>

Closes #889

See merge request !481
parents d5f9a328 09b2ecae
No related branches found
No related tags found
No related merge requests found
......@@ -75,13 +75,13 @@ public class NavDrawerActivity extends BriarActivity implements
exitIfStartupFailed(intent);
// TODO don't create new instances if they are on the stack (#606)
if (intent.getBooleanExtra(INTENT_GROUPS, false)) {
startFragment(GroupListFragment.newInstance());
startFragment(GroupListFragment.newInstance(), R.id.nav_btn_groups);
} else if (intent.getBooleanExtra(INTENT_FORUMS, false)) {
startFragment(ForumListFragment.newInstance());
startFragment(ForumListFragment.newInstance(), R.id.nav_btn_forums);
} else if (intent.getBooleanExtra(INTENT_CONTACTS, false)) {
startFragment(ContactListFragment.newInstance());
startFragment(ContactListFragment.newInstance(), R.id.nav_btn_contacts);
} else if (intent.getBooleanExtra(INTENT_BLOGS, false)) {
startFragment(FeedFragment.newInstance());
startFragment(FeedFragment.newInstance(), R.id.nav_btn_blogs);
}
setIntent(null);
}
......@@ -117,8 +117,7 @@ public class NavDrawerActivity extends BriarActivity implements
transportsView.setAdapter(transportsAdapter);
if (state == null) {
navigation.setCheckedItem(R.id.nav_btn_contacts);
startFragment(ContactListFragment.newInstance());
startFragment(ContactListFragment.newInstance(), R.id.nav_btn_contacts);
}
if (getIntent() != null) {
onNewIntent(getIntent());
......@@ -195,8 +194,7 @@ public class NavDrawerActivity extends BriarActivity implements
* exiting. This models the typical Google navigation behaviour such
* as in Gmail/Inbox.
*/
navigation.setCheckedItem(R.id.nav_btn_contacts);
startFragment(ContactListFragment.newInstance());
startFragment(ContactListFragment.newInstance(), R.id.nav_btn_contacts);
} else {
super.onBackPressed();
}
......@@ -221,6 +219,11 @@ public class NavDrawerActivity extends BriarActivity implements
super.signOut();
}
private void startFragment(BaseFragment fragment, int itemId){
navigation.setCheckedItem(itemId);
startFragment(fragment);
}
private void startFragment(BaseFragment fragment) {
if (getSupportFragmentManager().getBackStackEntryCount() == 0)
startFragment(fragment, false);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment