use of com.github.pockethub.android.ui.gist.GistsPagerFragment in project PocketHub by pockethub.
the class MainActivity method onNavigationItemSelected.
@Override
public boolean onNavigationItemSelected(MenuItem menuItem) {
int itemId = menuItem.getItemId();
if (itemId == R.id.navigation_home) {
switchFragment(new HomePagerFragment(), org);
getSupportActionBar().setTitle(getString(R.string.app_name));
return true;
} else if (itemId == R.id.navigation_gists) {
switchFragment(new GistsPagerFragment(), null);
getSupportActionBar().setTitle(menuItem.getTitle());
return true;
} else if (itemId == R.id.navigation_issue_dashboard) {
switchFragment(new IssueDashboardPagerFragment(), null);
getSupportActionBar().setTitle(menuItem.getTitle());
return true;
} else if (itemId == R.id.navigation_bookmarks) {
switchFragment(new FilterListFragment(), null);
getSupportActionBar().setTitle(menuItem.getTitle());
return true;
} else if (itemId == R.id.navigation_log_out) {
AccountManager accountManager = getAccountManager();
Account[] allGitHubAccounts = accountManager.getAccountsByType(getString(R.string.account_type));
for (Account account : allGitHubAccounts) {
accountManager.removeAccount(account, null, null);
}
Intent in = new Intent(this, LoginActivity.class);
in.addFlags(IntentCompat.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(in);
finish();
return false;
} else if (menuItemOrganizationMap.containsKey(menuItem)) {
switchFragment(new HomePagerFragment(), menuItemOrganizationMap.get(menuItem));
navigationView.getMenu().findItem(R.id.navigation_home).setChecked(true);
return false;
} else {
throw new IllegalStateException("MenuItem " + menuItem + " not known");
}
}
Aggregations