public void onLongTap(int slotIndex) {
   if (mGetContent) return;
   MediaItem item = mAlbumDataAdapter.get(slotIndex);
   if (item == null) return;
   mSelectionManager.setAutoLeaveSelectionMode(true);
   mSelectionManager.toggle(item.getPath());
   mSlotView.invalidate();
 }
 public void onLongTap(int slotIndex) {
   if (mGetContent || mGetAlbum) return;
   MediaSet set = mAlbumSetDataAdapter.getMediaSet(slotIndex);
   if (set == null) return;
   mSelectionManager.setAutoLeaveSelectionMode(true);
   mSelectionManager.toggle(set.getPath());
   mSlotView.invalidate();
 }
 @Override
 protected boolean onItemSelected(MenuItem item) {
   Activity activity = mActivity;
   switch (item.getItemId()) {
     case R.id.action_more_image:
       Uri moreUri = Uri.parse(mActivity.getString(R.string.website_for_more_image));
       Intent moreIntent = new Intent(Intent.ACTION_VIEW, moreUri);
       mActivity.startActivity(moreIntent);
       return true;
     case R.id.action_cancel:
       activity.setResult(Activity.RESULT_CANCELED);
       activity.finish();
       return true;
     case R.id.action_select:
       mSelectionManager.setAutoLeaveSelectionMode(false);
       mSelectionManager.enterSelectionMode();
       return true;
     case R.id.action_details:
       if (mAlbumSetDataAdapter.size() != 0) {
         if (mShowDetails) {
           hideDetails();
         } else {
           showDetails();
         }
       } else {
         Toast.makeText(activity, activity.getText(R.string.no_albums_alert), Toast.LENGTH_SHORT)
             .show();
       }
       return true;
     case R.id.action_camera:
       {
         GalleryUtils.startCameraActivity(activity);
         return true;
       }
     case R.id.action_manage_offline:
       {
         Bundle data = new Bundle();
         String mediaPath = mActivity.getDataManager().getTopSetPath(DataManager.INCLUDE_ALL);
         data.putString(AlbumSetPage.KEY_MEDIA_PATH, mediaPath);
         mActivity.getStateManager().startState(ManageCachePage.class, data);
         return true;
       }
     case R.id.action_sync_picasa_albums:
       {
         PicasaSource.requestSync(activity);
         return true;
       }
     case R.id.action_settings:
       {
         activity.startActivity(new Intent(activity, GallerySettings.class));
         return true;
       }
     default:
       return false;
   }
 }
Пример #4
0
  @Override
  protected boolean onItemSelected(MenuItem item) {
    Activity activity = mActivity;
    switch (item.getItemId()) {
      case R.id.action_cancel:
        activity.setResult(Activity.RESULT_CANCELED);
        activity.finish();
        return true;
      case R.id.action_select:
        mSelectionManager.setAutoLeaveSelectionMode(false);
        mSelectionManager.enterSelectionMode();
        return true;
      case R.id.action_details:
        if (mAlbumSetDataAdapter.size() != 0) {
          if (mShowDetails) {
            hideDetails();
          } else {
            showDetails();
          }
        } else {
          Toast.makeText(activity, activity.getText(R.string.no_albums_alert), Toast.LENGTH_SHORT)
              .show();
        }
        return true;
      case R.id.action_camera:
        {
          GalleryUtils.startCameraActivity(activity);
          return true;
        }
      case R.id.action_manage_offline:
        {
          Bundle data = new Bundle();
          String mediaPath = mActivity.getDataManager().getTopSetPath(DataManager.INCLUDE_ALL);
          data.putString(AlbumSetPage.KEY_MEDIA_PATH, mediaPath);
          mActivity.getStateManager().startState(ManageCachePage.class, data);
          return true;
        }
      case R.id.action_sync_picasa_albums:
        {
          PicasaSource.requestSync(activity);
          return true;
        }
        /*   Comment out to enable Settings in menu. This should be done when
             GallerySettings.java has content, as it is currently empty.
             Also comment out the settings item at albumset.xml menu.

                    case R.id.action_settings: {
                        activity.startActivity(new Intent(activity, GallerySettings.class));
                        return true;
                    }
        */
      default:
        return false;
    }
  }
 @Override
 protected boolean onItemSelected(MenuItem item) {
   switch (item.getItemId()) {
     case android.R.id.home:
       {
         onUpPressed();
         return true;
       }
     case R.id.action_cancel:
       mActivity.getStateManager().finishState(this);
       return true;
     case R.id.action_select:
       mSelectionManager.setAutoLeaveSelectionMode(false);
       mSelectionManager.enterSelectionMode();
       return true;
     case R.id.action_group_by:
       {
         mActivity.getGalleryActionBar().showClusterDialog(this);
         return true;
       }
     case R.id.action_slideshow:
       {
         mInCameraAndWantQuitOnPause = false;
         Bundle data = new Bundle();
         data.putString(SlideshowPage.KEY_SET_PATH, mMediaSetPath.toString());
         data.putBoolean(SlideshowPage.KEY_REPEAT, true);
         mActivity
             .getStateManager()
             .startStateForResult(SlideshowPage.class, REQUEST_SLIDESHOW, data);
         return true;
       }
     case R.id.action_details:
       {
         if (mShowDetails) {
           hideDetails();
         } else {
           showDetails();
         }
         return true;
       }
     case R.id.action_camera:
       {
         GalleryUtils.startCameraActivity(mActivity);
         return true;
       }
     default:
       return false;
   }
 }