private void onGetContent(final MediaItem item) {
   DataManager dm = mActivity.getDataManager();
   Activity activity = mActivity;
   if (mData.getString(GalleryActivity.EXTRA_CROP) != null) {
     Uri uri = dm.getContentUri(item.getPath());
     Intent intent =
         new Intent(CropActivity.CROP_ACTION, uri)
             .addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT)
             .putExtras(getData());
     if (mData.getParcelable(MediaStore.EXTRA_OUTPUT) == null) {
       intent.putExtra(CropExtras.KEY_RETURN_DATA, true);
     }
     activity.startActivity(intent);
     activity.finish();
   } else {
     Intent intent =
         new Intent(null, item.getContentUri()).addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
     activity.setResult(Activity.RESULT_OK, intent);
     activity.finish();
   }
 }
Пример #2
0
 private Intent getIntentBySingleSelectedPath(String action) {
   DataManager manager = mActivity.getDataManager();
   Path path = getSingleSelectedPath();
   String mimeType = getMimeType(manager.getMediaType(path));
   return new Intent(action).setDataAndType(manager.getContentUri(path), mimeType);
 }