@Override
 public void onSelectionModeChange(int mode) {
   switch (mode) {
     case SelectionManager.ENTER_SELECTION_MODE:
       {
         mActionBar.disableClusterMenu(true);
         mActionModeHandler.startActionMode();
         performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
         break;
       }
     case SelectionManager.LEAVE_SELECTION_MODE:
       {
         mActionModeHandler.finishActionMode();
         if (mShowClusterMenu) {
           mActionBar.enableClusterMenu(mSelectedAction, this);
         }
         mRootPane.invalidate();
         break;
       }
     case SelectionManager.SELECT_ALL_MODE:
       {
         mActionModeHandler.updateSupportedOperation();
         mRootPane.invalidate();
         break;
       }
   }
 }
 @Override
 public void onSelectionChange(Path path, boolean selected) {
   int count = mSelectionManager.getSelectedCount();
   String format =
       mActivity.getResources().getQuantityString(R.plurals.number_of_items_selected, count);
   mActionModeHandler.setTitle(String.format(format, count));
   mActionModeHandler.updateSupportedOperation(path, selected);
 }
Beispiel #3
0
  @Override
  public void onResume() {
    super.onResume();
    mIsActive = true;
    setContentPane(mRootPane);

    // Set the reload bit here to prevent it exit this page in clearLoadingBit().
    setLoadingBit(BIT_LOADING_RELOAD);
    mAlbumSetDataAdapter.resume();

    mAlbumSetView.resume();
    mEyePosition.resume();
    mActionModeHandler.resume();
    if (mShowClusterMenu) {
      mActionBar.enableClusterMenu(mSelectedAction, this);
    }
    if (!mInitialSynced) {
      setLoadingBit(BIT_LOADING_SYNC);
      mSyncTask = mMediaSet.requestSync(AlbumSetPage.this);
    }
    // jiangxd add for dockbar
    if (mActivity instanceof Gallery) {
      ((Gallery) mActivity).setDockBarVisible(false);
    }
    // end
  }
 @Override
 protected void onDestroy() {
   super.onDestroy();
   if (mAlbumDataAdapter != null) {
     mAlbumDataAdapter.setLoadingListener(null);
   }
   mActionModeHandler.destroy();
 }
 @Override
 public void onSelectionModeChange(int mode) {
   switch (mode) {
     case SelectionManager.ENTER_SELECTION_MODE:
       {
         mActionModeHandler.startActionMode();
         performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
         break;
       }
     case SelectionManager.LEAVE_SELECTION_MODE:
       {
         mActionModeHandler.finishActionMode();
         mRootPane.invalidate();
         break;
       }
     case SelectionManager.SELECT_ALL_MODE:
       {
         mActionModeHandler.updateSupportedOperation();
         mRootPane.invalidate();
         break;
       }
   }
 }
Beispiel #6
0
  private void initializeViews() {
    mSelectionManager = new SelectionManager(mActivity, true);
    mSelectionManager.setSelectionListener(this);

    mConfig = Config.AlbumSetPage.get(mActivity);
    mSlotView = new SlotView(mActivity, mConfig.slotViewSpec);
    mAlbumSetView =
        new AlbumSetSlotRenderer(
            mActivity, mSelectionManager, mSlotView, mConfig.labelSpec, mConfig.placeholderColor);
    mSlotView.setSlotRenderer(mAlbumSetView);
    mSlotView.setListener(
        new SlotView.SimpleListener() {
          @Override
          public void onDown(int index) {
            AlbumSetPage.this.onDown(index);
          }

          @Override
          public void onUp(boolean followedByLongPress) {
            AlbumSetPage.this.onUp(followedByLongPress);
          }

          @Override
          public void onSingleTapUp(int slotIndex) {
            AlbumSetPage.this.onSingleTapUp(slotIndex);
          }

          @Override
          public void onLongTap(int slotIndex) {
            AlbumSetPage.this.onLongTap(slotIndex);
          }

          @Override
          public void onGestureLongTap(int slotIndex) {
            AlbumSetPage.this.onGestureLongTap(slotIndex);
          }
        });

    mActionModeHandler = new ActionModeHandler(mActivity, mSelectionManager);
    mActionModeHandler.setActionModeListener(
        new ActionModeListener() {
          @Override
          public boolean onActionItemClicked(MenuItem item) {
            return onItemSelected(item);
          }
        });
    mRootPane.addComponent(mSlotView);
  }
 @Override
 public void onPause() {
   super.onPause();
   mIsActive = false;
   mAlbumSetDataAdapter.pause();
   mAlbumSetView.pause();
   mActionModeHandler.pause();
   mEyePosition.pause();
   DetailsHelper.pause();
   // Call disableClusterMenu to avoid receiving callback after paused.
   // Don't hide menu here otherwise the list menu will disappear earlier than
   // the action bar, which is janky and unwanted behavior.
   mActionBar.disableClusterMenu(false);
   if (mSyncTask != null) {
     mSyncTask.cancel();
     mSyncTask = null;
     clearLoadingBit(BIT_LOADING_SYNC);
   }
 }
  @Override
  protected void onPause() {
    super.onPause();
    mIsActive = false;

    if (mSelectionManager.inSelectionMode()) {
      mSelectionManager.leaveSelectionMode();
    }
    mAlbumView.setSlotFilter(null);
    mActionModeHandler.pause();
    mAlbumDataAdapter.pause();
    mAlbumView.pause();
    DetailsHelper.pause();
    if (!mGetContent) {
      mActivity.getGalleryActionBar().disableAlbumModeMenu(true);
    }

    if (mSyncTask != null) {
      mSyncTask.cancel();
      mSyncTask = null;
      clearLoadingBit(BIT_LOADING_SYNC);
    }
  }
  @Override
  protected void onResume() {
    super.onResume();
    mIsActive = true;

    mResumeEffect = mActivity.getTransitionStore().get(KEY_RESUME_ANIMATION);
    if (mResumeEffect != null) {
      mAlbumView.setSlotFilter(mResumeEffect);
      mResumeEffect.setPositionProvider(mPositionProvider);
      mResumeEffect.start();
    }

    setContentPane(mRootPane);

    boolean enableHomeButton =
        (mActivity.getStateManager().getStateCount() > 1) | mParentMediaSetString != null;
    GalleryActionBar actionBar = mActivity.getGalleryActionBar();
    actionBar.setDisplayOptions(enableHomeButton, false);
    if (!mGetContent) {
      actionBar.enableAlbumModeMenu(GalleryActionBar.ALBUM_GRID_MODE_SELECTED, this);
    }

    // Set the reload bit here to prevent it exit this page in clearLoadingBit().
    setLoadingBit(BIT_LOADING_RELOAD);
    mLoadingFailed = false;
    mAlbumDataAdapter.resume();

    mAlbumView.resume();
    mAlbumView.setPressedIndex(-1);
    mActionModeHandler.resume();
    if (!mInitialSynced) {
      setLoadingBit(BIT_LOADING_SYNC);
      mSyncTask = mMediaSet.requestSync(this);
    }
    mInCameraAndWantQuitOnPause = mInCameraApp;
  }
 @Override
 public void onSelectionChange(Path path, boolean selected) {
   mActionModeHandler.setTitle(getSelectedString());
   mActionModeHandler.updateSupportedOperation(path, selected);
 }
 @Override
 public void onDestroy() {
   super.onDestroy();
   cleanupCameraButton();
   mActionModeHandler.destroy();
 }