@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; } }
@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; } }