private void clearLoadingBit(int loadingBit) {
   mLoadingBits &= ~loadingBit;
   if (mLoadingBits == 0 && mIsActive) {
     if (mAlbumSetDataAdapter.size() == 0) {
       // If this is not the top of the gallery folder hierarchy,
       // tell the parent AlbumSetPage instance to handle displaying
       // the empty album toast, otherwise show it within this
       // instance
       if (mActivity.getStateManager().getStateCount() > 1) {
         Intent result = new Intent();
         result.putExtra(AlbumPage.KEY_EMPTY_ALBUM, true);
         setStateResult(Activity.RESULT_OK, result);
         mActivity.getStateManager().finishState(this);
       } else {
         mShowedEmptyToastForSelf = true;
         showEmptyAlbumToast(Toast.LENGTH_LONG);
         mSlotView.invalidate();
         showCameraButton();
       }
       return;
     }
   }
   // Hide the empty album toast if we are in the root instance of
   // AlbumSetPage and the album is no longer empty (for instance,
   // after a sync is completed and web albums have been synced)
   if (mShowedEmptyToastForSelf) {
     mShowedEmptyToastForSelf = false;
     hideEmptyAlbumToast();
     hideCameraButton();
   }
 }
 @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;
   }
 }
Beispiel #3
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;
    }
  }