@Override
 public void onSyncDone(final MediaSet mediaSet, final int resultCode) {
   if (resultCode == MediaSet.SYNC_RESULT_ERROR) {
     Log.d(
         TAG, "onSyncDone: " + Utils.maskDebugInfo(mediaSet.getName()) + " result=" + resultCode);
   }
   ((Activity) mActivity)
       .runOnUiThread(
           new Runnable() {
             @Override
             public void run() {
               GLRoot root = mActivity.getGLRoot();
               root.lockRenderThread();
               try {
                 if (resultCode == MediaSet.SYNC_RESULT_SUCCESS) {
                   mInitialSynced = true;
                 }
                 clearLoadingBit(BIT_LOADING_SYNC);
                 if (resultCode == MediaSet.SYNC_RESULT_ERROR && mIsActive) {
                   Log.w(TAG, "failed to load album set");
                 }
               } finally {
                 root.unlockRenderThread();
               }
             }
           });
 }
  @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
 public void onSyncDone(final MediaSet mediaSet, final int resultCode) {
   Log.d(TAG, "onSyncDone: " + Utils.maskDebugInfo(mediaSet.getName()) + " result=" + resultCode);
   ((Activity) mActivity)
       .runOnUiThread(
           new Runnable() {
             @Override
             public void run() {
               GLRoot root = mActivity.getGLRoot();
               root.lockRenderThread();
               mSyncResult = resultCode;
               try {
                 if (resultCode == MediaSet.SYNC_RESULT_SUCCESS) {
                   mInitialSynced = true;
                 }
                 clearLoadingBit(BIT_LOADING_SYNC);
                 showSyncErrorIfNecessary(mLoadingFailed);
               } finally {
                 root.unlockRenderThread();
               }
             }
           });
 }
  @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;
  }
Пример #5
0
 @Override
 public int compare(MediaSet set1, MediaSet set2) {
   int result = set1.getName().compareToIgnoreCase(set2.getName());
   if (result != 0) return result;
   return set1.getPath().toString().compareTo(set2.getPath().toString());
 }