mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 03:09:04 +01:00
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: goapunk <noobie@goapunks.net> Closes #889 See merge request !481
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user