Java Code Examples for com.luck.picture.lib.tools.PictureFileUtils#getDiskCacheDir()
The following examples show how to use
com.luck.picture.lib.tools.PictureFileUtils#getDiskCacheDir() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PictureBaseActivity.java From PictureSelector with Apache License 2.0 | 6 votes |
/** * single crop * * @param originalPath * @param cachePath * @param mimeType * @param options */ private void startSingleCropActivity(String originalPath, String cachePath, String mimeType, UCrop.Options options) { boolean isHttp = PictureMimeType.isHasHttp(originalPath); String suffix = mimeType.replace("image/", "."); File file = new File(PictureFileUtils.getDiskCacheDir(getContext()), TextUtils.isEmpty(config.renameCropFileName) ? DateUtils.getCreateFileName("IMG_CROP_") + suffix : config.renameCropFileName); Uri uri; if (!TextUtils.isEmpty(cachePath)) { uri = Uri.fromFile(new File(cachePath)); } else { uri = isHttp || SdkVersionUtils.checkedAndroid_Q() ? Uri.parse(originalPath) : Uri.fromFile(new File(originalPath)); } UCrop.of(uri, Uri.fromFile(file)) .withOptions(options) .startAnimationActivity(this, config.windowAnimationStyle != null ? config.windowAnimationStyle.activityCropEnterAnimation : R.anim.picture_anim_enter); }
Example 2
Source File: PictureBaseActivity.java From PictureSelector with Apache License 2.0 | 6 votes |
/** * startMultipleCropActivity * * @param cutInfo * @param options */ private void startMultipleCropActivity(CutInfo cutInfo, int count, UCrop.Options options) { String path = cutInfo.getPath(); String mimeType = cutInfo.getMimeType(); boolean isHttp = PictureMimeType.isHasHttp(path); Uri uri; if (!TextUtils.isEmpty(cutInfo.getAndroidQToPath())) { uri = Uri.fromFile(new File(cutInfo.getAndroidQToPath())); } else { uri = isHttp || SdkVersionUtils.checkedAndroid_Q() ? Uri.parse(path) : Uri.fromFile(new File(path)); } String suffix = mimeType.replace("image/", "."); File file = new File(PictureFileUtils.getDiskCacheDir(this), TextUtils.isEmpty(config.renameCropFileName) ? DateUtils.getCreateFileName("IMG_CROP_") + suffix : config.camera || count == 1 ? config.renameCropFileName : StringUtils.rename(config.renameCropFileName)); UCrop.of(uri, Uri.fromFile(file)) .withOptions(options) .startAnimationMultipleCropActivity(this, config.windowAnimationStyle != null ? config.windowAnimationStyle.activityCropEnterAnimation : R.anim.picture_anim_enter); }