use of com.github.pockethub.android.ui.user.HomePagerFragment in project PocketHub by pockethub.
the class MainActivity method onLoadFinished.
@Override
public void onLoadFinished(Loader<List<User>> listLoader, final List<User> orgs) {
if (orgs.isEmpty()) {
return;
}
org = orgs.get(0);
this.orgs = orgs;
setUpNavigationView();
Window window = getWindow();
if (window == null) {
return;
}
View view = window.getDecorView();
if (view == null) {
return;
}
view.post(new Runnable() {
@Override
public void run() {
MainActivity.this.switchFragment(new HomePagerFragment(), org);
if (!userLearnedDrawer) {
drawerLayout.openDrawer(GravityCompat.START);
}
}
});
}
use of com.github.pockethub.android.ui.user.HomePagerFragment 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