Ejemplo n.º 1
0
  /** When user click a category in listview */
  @Override
  public void gotoCategoryPage(NavigationDrawerAdapter.ItemAdapter.TYPE pageType, int position) {
    Log.e("DEBUG", "category: " + pageType);
    Fragment fragment = null;
    Bundle arguments = new Bundle();
    switch (pageType) {
      case HOME:
        fragment = new WelcomeFragment();
        break;
      case SONGS:
        fragment = new SongListFragment();
        break;
      case MYPLAYLIST:
        fragment = new PlaylistManagerFragment();
        break;
      case FAVORITE:
        fragment = new FavoriteManagerFragment();
        break;
      case FIND_BY_CHORD:
        fragment = new SearchChordFragment();
        break;
      case SEARCH_CHORD:
        fragment = new ChordViewFragment();
        break;
      case SETTING:
        // fragment = new SettingFragment();
        break;
    }

    // assign parameters to fragment
    fragment.setArguments(arguments);

    // close Drawer List View
    if (mDrawerListView != null) {
      LogUtils.LOGE("TRUNGDQ", "NavDrawer set category: " + position);
      mDrawerListView.setItemChecked(position, true);
    }
    if (mDrawerLayout != null) {
      mDrawerLayout.closeDrawer(mFragmentContainerView);
    }

    // assign this work to main mActivity
    if (mCallbacks != null) {
      mCallbacks.onNavigationDrawerItemSelected(fragment);
    }
  }
Ejemplo n.º 2
0
  /** When user click to a playlist row and want to show detail */
  @Override
  public void gotoPlayList(int playlistId) {
    Playlist playlist = playlistList.get(playlistId);
    PlaylistDetailFragment fragment = new PlaylistDetailFragment();
    // setting parameters
    Bundle arguments = new Bundle();
    arguments.putParcelable("playlist", playlist);
    fragment.setArguments(arguments);

    // setting for Drawer List View
    if (mDrawerListView != null) {
      LogUtils.LOGE("TRUNGDQ", "NavDrawer set playlist: " + playlistId);
      mDrawerListView.setItemChecked(playlistId, true);
    }
    if (mDrawerLayout != null) {
      mDrawerLayout.closeDrawer(mFragmentContainerView);
    }

    // assign this work to main mActivity
    if (mCallbacks != null) {
      mCallbacks.onNavigationDrawerItemSelected(fragment);
    }
  }