@Override
 public void doCluster(int clusterType) {
   String basePath = mMediaSet.getPath().toString();
   String newPath = FilterUtils.switchClusterPath(basePath, clusterType);
   Bundle data = new Bundle(getData());
   data.putString(AlbumSetPage.KEY_MEDIA_PATH, newPath);
   data.putInt(KEY_SELECTED_CLUSTER_TYPE, clusterType);
   mActivity.getStateManager().switchState(this, AlbumSetPage.class, data);
 }
  @Override
  protected boolean onCreateActionBar(Menu menu) {
    Activity activity = mActivity;
    final boolean inAlbum = mActivity.getStateManager().hasStateClass(AlbumPage.class);
    MenuInflater inflater = getSupportMenuInflater();

    if (mGetContent) {
      inflater.inflate(R.menu.pickup, menu);
      int typeBits = mData.getInt(GalleryActivity.KEY_TYPE_BITS, DataManager.INCLUDE_IMAGE);
      mActionBar.setTitle(GalleryUtils.getSelectionModePrompt(typeBits));
    } else if (mGetAlbum) {
      inflater.inflate(R.menu.pickup, menu);
      mActionBar.setTitle(R.string.select_album);
    } else {
      inflater.inflate(R.menu.albumset, menu);
      boolean wasShowingClusterMenu = mShowClusterMenu;
      mShowClusterMenu = !inAlbum;
      if (mShowClusterMenu != wasShowingClusterMenu) {
        if (mShowClusterMenu) {
          mActionBar.enableClusterMenu(mSelectedAction, this);
        } else {
          mActionBar.disableClusterMenu(true);
        }
      }
      boolean selectAlbums =
          !inAlbum && mActionBar.getClusterTypeAction() == FilterUtils.CLUSTER_BY_ALBUM;
      MenuItem selectItem = menu.findItem(R.id.action_select);
      selectItem.setTitle(
          activity.getString(selectAlbums ? R.string.select_album : R.string.select_group));

      MenuItem cameraItem = menu.findItem(R.id.action_camera);
      cameraItem.setVisible(GalleryUtils.isCameraAvailable(activity));

      FilterUtils.setupMenuItems(mActionBar, mMediaSet.getPath(), false);

      Intent helpIntent = HelpUtils.getHelpIntent(activity);

      MenuItem helpItem = menu.findItem(R.id.action_general_help);
      helpItem.setVisible(helpIntent != null);
      if (helpIntent != null) helpItem.setIntent(helpIntent);

      MenuItem moreItem = menu.findItem(R.id.action_more_image);
      moreItem.setVisible(mActivity.getResources().getBoolean(R.bool.config_show_more_images));

      mActionBar.setTitle(mTitle);
      mActionBar.setSubtitle(mSubtitle);
    }
    return true;
  }
  @Override
  public void doCluster(int clusterType) {
    String basePath = mMediaSet.getPath().toString();
    String newPath = FilterUtils.newClusterPath(basePath, clusterType);
    Bundle data = new Bundle(getData());
    data.putString(AlbumSetPage.KEY_MEDIA_PATH, newPath);
    if (mShowClusterMenu) {
      Context context = mActivity.getAndroidContext();
      data.putString(AlbumSetPage.KEY_SET_TITLE, mMediaSet.getName());
      data.putString(
          AlbumSetPage.KEY_SET_SUBTITLE,
          GalleryActionBar.getClusterByTypeString(context, clusterType));
    }

    // mAlbumView.savePositions(PositionRepository.getInstance(mActivity));
    mActivity.getStateManager().startStateForResult(AlbumSetPage.class, REQUEST_DO_ANIMATION, data);
  }
  @Override
  protected boolean onCreateActionBar(Menu menu) {
    GalleryActionBar actionBar = mActivity.getGalleryActionBar();
    MenuInflater inflator = getSupportMenuInflater();
    if (mGetContent) {
      inflator.inflate(R.menu.pickup, menu);
      int typeBits = mData.getInt(GalleryActivity.KEY_TYPE_BITS, DataManager.INCLUDE_IMAGE);
      actionBar.setTitle(GalleryUtils.getSelectionModePrompt(typeBits));
    } else {
      inflator.inflate(R.menu.album, menu);
      actionBar.setTitle(mMediaSet.getName());

      FilterUtils.setupMenuItems(actionBar, mMediaSetPath, true);

      menu.findItem(R.id.action_group_by).setVisible(mShowClusterMenu);
      menu.findItem(R.id.action_camera)
          .setVisible(
              MediaSetUtils.isCameraSource(mMediaSetPath)
                  && GalleryUtils.isCameraAvailable(mActivity));
    }
    actionBar.setSubtitle(null);
    return true;
  }