Ejemplo n.º 1
0
  private void selectItem(DrawerListAdapter.DrawerItem drawerItem) {
    int position = drawerItem.getPosition();

    switch (position) {
      case Constants.DRAWER_ITEM_DASHBOARD:
        showDashboardFragment();
        break;

      case Constants.DRAWER_ITEM_PUSHUPS:
        showPushupFragment();
        break;

      case Constants.DRAWER_ITEM_MULTI:
        showMultiPlayerGameFragment();
        break;

      case Constants.DRAWER_ITEM_WRIST:
        showWristGameFragment();
        break;

      case Constants.DRAWER_ITEM_GOOGLE:
        showGameBoardFragment();
        break;

      case Constants.DRAWER_ITEM_LEADERBOARD:
        onShowLeaderboardsRequested();
        break;

      case Constants.DRAWER_ITEM_ARCHIEVEMENT:
        onShowAchievementsRequested();
        break;

      case Constants.DRAWER_ITEM_HELPER:
        showUserGuide();
        break;

      case Constants.DRAWER_ITEM_ABOUT:
        showAbout();
        break;
    }

    // update selected item and title, then close the drawer
    if (position == Constants.DRAWER_ITEM_ABOUT || position == Constants.DRAWER_ITEM_HELPER) {

    } else {
      updateItemSelected(drawerItem);
    }

    mDrawerLayout.closeDrawer(mDrawerList);
  }
Ejemplo n.º 2
0
  private void updateItemSelected(DrawerListAdapter.DrawerItem drawerItem) {
    mDrawerList.setItemChecked(drawerItem.getPosition(), true);

    setTitle(drawerItem.getTitle());
  }