com.luck.picture.lib.config.PictureMimeType Java Examples
The following examples show how to use
com.luck.picture.lib.config.PictureMimeType.
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 |
/** * 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); }
Example #2
Source File: PictureExternalPreviewActivity.java From PictureSelector with Apache License 2.0 | 6 votes |
/** * 保存相片至本地相册 * * @throws Exception */ private void savePictureAlbum() throws Exception { String suffix = PictureMimeType.getLastImgSuffix(mMimeType); String state = Environment.getExternalStorageState(); File rootDir = state.equals(Environment.MEDIA_MOUNTED) ? Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM) : getContext().getExternalFilesDir(Environment.DIRECTORY_PICTURES); if (rootDir != null && !rootDir.exists() && rootDir.mkdirs()) { } File folderDir = new File(SdkVersionUtils.checkedAndroid_Q() || !state.equals(Environment.MEDIA_MOUNTED) ? rootDir.getAbsolutePath() : rootDir.getAbsolutePath() + File.separator + PictureMimeType.CAMERA + File.separator); if (folderDir != null && !folderDir.exists() && folderDir.mkdirs()) { } String fileName = DateUtils.getCreateFileName("IMG_") + suffix; File file = new File(folderDir, fileName); PictureFileUtils.copyFile(downloadPath, file.getAbsolutePath()); onSuccessful(file.getAbsolutePath()); }
Example #3
Source File: PictureSelectorActivity.java From PictureSelector with Apache License 2.0 | 6 votes |
/** * isSame * * @param newMedia * @return */ private boolean isLocalMediaSame(LocalMedia newMedia) { LocalMedia oldMedia = mAdapter.getItem(0); if (oldMedia == null || newMedia == null) { return false; } if (oldMedia.getPath().equals(newMedia.getPath())) { return true; } // if Content:// type,determines whether the suffix id is consistent, mainly to solve the following two types of problems // content://media/external/images/media/5844 // content://media/external/file/5844 if (PictureMimeType.isContent(newMedia.getPath()) && PictureMimeType.isContent(oldMedia.getPath())) { if (!TextUtils.isEmpty(newMedia.getPath()) && !TextUtils.isEmpty(oldMedia.getPath())) { String newId = newMedia.getPath().substring(newMedia.getPath().lastIndexOf("/") + 1); String oldId = oldMedia.getPath().substring(oldMedia.getPath().lastIndexOf("/") + 1); if (newId.equals(oldId)) { return true; } } } return false; }
Example #4
Source File: PhotoFragmentActivity.java From PictureSelector with Apache License 2.0 | 6 votes |
@Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { super.onRequestPermissionsResult(requestCode, permissions, grantResults); switch (requestCode) { case PictureConfig.APPLY_STORAGE_PERMISSIONS_CODE: // 存储权限 for (int i = 0; i < grantResults.length; i++) { if (grantResults[i] == PackageManager.PERMISSION_GRANTED) { PictureFileUtils.deleteCacheDirFile(PhotoFragmentActivity.this, PictureMimeType.ofImage()); } else { Toast.makeText(PhotoFragmentActivity.this, getString(R.string.picture_jurisdiction), Toast.LENGTH_SHORT).show(); } } break; } }
Example #5
Source File: MainActivity.java From PictureSelector with Apache License 2.0 | 6 votes |
@Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { super.onRequestPermissionsResult(requestCode, permissions, grantResults); switch (requestCode) { case PictureConfig.APPLY_STORAGE_PERMISSIONS_CODE: // 存储权限 for (int i = 0; i < grantResults.length; i++) { if (grantResults[i] == PackageManager.PERMISSION_GRANTED) { PictureFileUtils.deleteCacheDirFile(getContext(), PictureMimeType.ofImage()); } else { Toast.makeText(MainActivity.this, getString(R.string.picture_jurisdiction), Toast.LENGTH_SHORT).show(); } } break; } }
Example #6
Source File: PhotoFragment.java From PictureSelector with Apache License 2.0 | 6 votes |
@Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { super.onRequestPermissionsResult(requestCode, permissions, grantResults); switch (requestCode) { case PictureConfig.APPLY_STORAGE_PERMISSIONS_CODE: // 存储权限 for (int i = 0; i < grantResults.length; i++) { if (grantResults[i] == PackageManager.PERMISSION_GRANTED) { PictureFileUtils.deleteCacheDirFile(getContext(), PictureMimeType.ofImage()); } else { Toast.makeText(getContext(), getString(R.string.picture_jurisdiction), Toast.LENGTH_SHORT).show(); } } break; } }
Example #7
Source File: PictureSelectorActivity.java From PictureSelector with Apache License 2.0 | 6 votes |
@Override public void onPictureClick(LocalMedia media, int position) { if (config.selectionMode == PictureConfig.SINGLE && config.isSingleDirectReturn) { List<LocalMedia> list = new ArrayList<>(); list.add(media); if (config.enableCrop && PictureMimeType.isHasImage(media.getMimeType()) && !config.isCheckOriginalImage) { mAdapter.bindSelectData(list); startCrop(media.getPath(), media.getMimeType()); } else { handlerResult(list); } } else { List<LocalMedia> data = mAdapter.getData(); startPreview(data, position); } }
Example #8
Source File: PictureSelectorActivity.java From PictureSelector with Apache License 2.0 | 6 votes |
/** * Verify the validity of the video * * @param media * @return */ private boolean checkVideoLegitimacy(LocalMedia media) { boolean isEnterNext = true; if (PictureMimeType.isHasVideo(media.getMimeType())) { if (config.videoMinSecond > 0 && config.videoMaxSecond > 0) { // The user sets the minimum and maximum video length to determine whether the video is within the interval if (media.getDuration() < config.videoMinSecond || media.getDuration() > config.videoMaxSecond) { isEnterNext = false; showPromptDialog(getString(R.string.picture_choose_limit_seconds, config.videoMinSecond / 1000, config.videoMaxSecond / 1000)); } } else if (config.videoMinSecond > 0) { // The user has only set a minimum video length limit if (media.getDuration() < config.videoMinSecond) { isEnterNext = false; showPromptDialog(getString(R.string.picture_choose_min_seconds, config.videoMinSecond / 1000)); } } else if (config.videoMaxSecond > 0) { // Only the maximum length of video is set if (media.getDuration() > config.videoMaxSecond) { isEnterNext = false; showPromptDialog(getString(R.string.picture_choose_max_seconds, config.videoMaxSecond / 1000)); } } } return isEnterNext; }
Example #9
Source File: PictureSelectorActivity.java From PictureSelector with Apache License 2.0 | 6 votes |
@Override public void onItemClick(View view, int position) { switch (position) { case PhotoItemSelectedDialog.IMAGE_CAMERA: if (PictureSelectionConfig.onCustomCameraInterfaceListener != null) { PictureSelectionConfig.onCustomCameraInterfaceListener.onCameraClick(getContext(), config, PictureConfig.TYPE_IMAGE); config.cameraMimeType = PictureMimeType.ofImage(); } else { startOpenCamera(); } break; case PhotoItemSelectedDialog.VIDEO_CAMERA: if (PictureSelectionConfig.onCustomCameraInterfaceListener != null) { PictureSelectionConfig.onCustomCameraInterfaceListener.onCameraClick(getContext(), config, PictureConfig.TYPE_IMAGE); config.cameraMimeType = PictureMimeType.ofVideo(); } else { startOpenCameraVideo(); } break; default: break; } }
Example #10
Source File: PictureWeChatPreviewGalleryAdapter.java From PictureSelector with Apache License 2.0 | 6 votes |
@Override public void onBindViewHolder(@NonNull ViewHolder holder, int position) { LocalMedia item = getItem(position); if (item != null) { holder.viewBorder.setVisibility(item.isChecked() ? View.VISIBLE : View.GONE); if (config != null && PictureSelectionConfig.imageEngine != null) { PictureSelectionConfig.imageEngine.loadImage(holder.itemView.getContext(), item.getPath(), holder.ivImage); } holder.ivPlay.setVisibility(PictureMimeType.isHasVideo(item.getMimeType()) ? View.VISIBLE : View.GONE); holder.itemView.setOnClickListener(v -> { if (listener != null && holder.getAdapterPosition() >= 0) { listener.onItemClick(holder.getAdapterPosition(), getItem(position), v); } }); } }
Example #11
Source File: PicassoEngine.java From PictureSelector with Apache License 2.0 | 6 votes |
/** * 加载图片 * * @param context * @param url * @param imageView */ @Override public void loadImage(@NonNull Context context, @NonNull String url, @NonNull ImageView imageView) { VideoRequestHandler videoRequestHandler = new VideoRequestHandler(); if (PictureMimeType.isContent(url)) { Picasso.get() .load(Uri.parse(url)) .into(imageView); } else { if (PictureMimeType.isUrlHasVideo(url)) { Picasso picasso = new Picasso.Builder(context.getApplicationContext()) .addRequestHandler(videoRequestHandler) .build(); picasso.load(videoRequestHandler.SCHEME_VIDEO + ":" + url) .into(imageView); } else { Picasso.get() .load(new File(url)) .into(imageView); } } }
Example #12
Source File: RNSyanImagePickerModule.java From react-native-syan-image-picker with MIT License | 6 votes |
/** * 拍摄视频 */ private void openVideo() { int quality = this.cameraOptions.getInt("quality"); int MaxSecond = this.cameraOptions.getInt("MaxSecond"); int MinSecond = this.cameraOptions.getInt("MinSecond"); int recordVideoSecond = this.cameraOptions.getInt("recordVideoSecond"); int imageCount = this.cameraOptions.getInt("imageCount"); Activity currentActivity = getCurrentActivity(); PictureSelector.create(currentActivity) .openCamera(PictureMimeType.ofVideo())//全部.PictureMimeType.ofAll()、图片.ofImage()、视频.ofVideo()、音频.ofAudio() .loadImageEngine(GlideEngine.createGlideEngine()) .selectionMedia(selectList) // 当前已选中的图片 List .openClickSound(false)// 是否开启点击声音 true or false .maxSelectNum(imageCount)// 最大图片选择数量 int .minSelectNum(0)// 最小选择数量 int .imageSpanCount(4)// 每行显示个数 int .selectionMode(PictureConfig.MULTIPLE)// 多选 or 单选 PictureConfig.MULTIPLE or PictureConfig.SINGLE .previewVideo(true)// 是否可预览视频 true or false .videoQuality(quality)// 视频录制质量 0 or 1 int .videoMaxSecond(MaxSecond)// 显示多少秒以内的视频or音频也可适用 int .videoMinSecond(MinSecond)// 显示多少秒以内的视频or音频也可适用 int .recordVideoSecond(recordVideoSecond)//视频秒数录制 默认60s int .forResult(PictureConfig.REQUEST_CAMERA);//结果回调onActivityResult code }
Example #13
Source File: MediaUtils.java From PictureSelector with Apache License 2.0 | 6 votes |
/** * 创建一条图片地址uri,用于保存拍照后的照片 * * @param context * @param suffixType * @return 图片的uri */ @Nullable public static Uri createImageUri(final Context context, String suffixType) { final Uri[] imageFilePath = {null}; String status = Environment.getExternalStorageState(); String time = ValueOf.toString(System.currentTimeMillis()); // ContentValues是我们希望这条记录被创建时包含的数据信息 ContentValues values = new ContentValues(3); values.put(MediaStore.Images.Media.DISPLAY_NAME, DateUtils.getCreateFileName("IMG_")); values.put(MediaStore.Images.Media.DATE_TAKEN, time); values.put(MediaStore.Images.Media.MIME_TYPE, TextUtils.isEmpty(suffixType) ? PictureMimeType.MIME_TYPE_IMAGE : suffixType); // 判断是否有SD卡,优先使用SD卡存储,当没有SD卡时使用手机存储 if (status.equals(Environment.MEDIA_MOUNTED)) { values.put(MediaStore.Images.Media.RELATIVE_PATH, PictureMimeType.DCIM); imageFilePath[0] = context.getContentResolver() .insert(MediaStore.Images.Media.getContentUri("external"), values); } else { imageFilePath[0] = context.getContentResolver() .insert(MediaStore.Images.Media.getContentUri("internal"), values); } return imageFilePath[0]; }
Example #14
Source File: MediaUtils.java From PictureSelector with Apache License 2.0 | 6 votes |
/** * 创建一条视频地址uri,用于保存录制的视频 * * @param context * @param suffixType * @return 视频的uri */ @Nullable public static Uri createVideoUri(final Context context, String suffixType) { final Uri[] imageFilePath = {null}; String status = Environment.getExternalStorageState(); String time = ValueOf.toString(System.currentTimeMillis()); // ContentValues是我们希望这条记录被创建时包含的数据信息 ContentValues values = new ContentValues(3); values.put(MediaStore.Video.Media.DISPLAY_NAME, DateUtils.getCreateFileName("VID_")); values.put(MediaStore.Video.Media.DATE_TAKEN, time); values.put(MediaStore.Video.Media.MIME_TYPE, TextUtils.isEmpty(suffixType) ? PictureMimeType.MIME_TYPE_VIDEO : suffixType); // 判断是否有SD卡,优先使用SD卡存储,当没有SD卡时使用手机存储 if (status.equals(Environment.MEDIA_MOUNTED)) { values.put(MediaStore.Video.Media.RELATIVE_PATH, Environment.DIRECTORY_MOVIES); imageFilePath[0] = context.getContentResolver() .insert(MediaStore.Video.Media.getContentUri("external"), values); } else { imageFilePath[0] = context.getContentResolver() .insert(MediaStore.Video.Media.getContentUri("internal"), values); } return imageFilePath[0]; }
Example #15
Source File: QRCodeImageActivity.java From DevUtils with Apache License 2.0 | 6 votes |
@OnClick({R.id.vid_aqi_select_btn, R.id.vid_aqi_tv}) @Override public void onClick(View v) { super.onClick(v); switch (v.getId()) { case R.id.vid_aqi_select_btn: // 初始化图片配置 PictureSelectorUtils.PicConfig picConfig = new PictureSelectorUtils.PicConfig() .setCompress(false).setMaxSelectNum(1).setCrop(false).setMimeType(PictureMimeType.ofImage()) .setCamera(true).setGif(false); // 打开图片选择器 PictureSelectorUtils.openGallery(PictureSelector.create(this), picConfig); break; case R.id.vid_aqi_tv: String text = TextViewUtils.getText(vid_aqi_tv); if (TextUtils.isEmpty(text)) return; // 复制到剪切板 ClipboardUtils.copyText(text); // 进行提示 ToastTintUtils.success(ResourceUtils.getString(R.string.copy_suc) + " -> " + text); break; } }
Example #16
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 #17
Source File: ImagePickerHelper.java From FastLib with Apache License 2.0 | 5 votes |
public void selectFile(int requestCode, int count, OnImageSelect onImageSelect) { this.mOnImageSelect = onImageSelect; this.mRequestCode = requestCode; PictureSelector.create(mContext) .openGallery(PictureMimeType.ofImage()) .theme(StatusBarUtil.isSupportStatusBarFontChange() ? R.style.PicturePickerStyle : R.style.PicturePickerStyle_White) .maxSelectNum(count) .selectionMode(PictureConfig.TYPE_ALL) .forResult(mRequestCode); }
Example #18
Source File: ImagePickerHelper.java From FastLib with Apache License 2.0 | 5 votes |
public void selectPicture(int requestCode, int count, OnImageSelect onImageSelect) { this.mOnImageSelect = onImageSelect; this.mRequestCode = requestCode; PictureSelector.create(mContext) .openGallery(PictureMimeType.ofImage()) .theme(StatusBarUtil.isSupportStatusBarFontChange() ? R.style.PicturePickerStyle : R.style.PicturePickerStyle_White) .maxSelectNum(count) .selectionMode(PictureConfig.TYPE_PICTURE) .forResult(mRequestCode); }
Example #19
Source File: StringUtils.java From PictureSelector with Apache License 2.0 | 5 votes |
public static void tempTextFont(TextView tv, int mimeType) { String text = tv.getText().toString().trim(); String str = mimeType == PictureMimeType.ofAudio() ? tv.getContext().getString(R.string.picture_empty_audio_title) : tv.getContext().getString(R.string.picture_empty_title); String sumText = str + text; Spannable placeSpan = new SpannableString(sumText); placeSpan.setSpan(new RelativeSizeSpan(0.8f), str.length(), sumText.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); tv.setText(placeSpan); }
Example #20
Source File: PicturePreviewActivity.java From PictureSelector with Apache License 2.0 | 5 votes |
/** * 同一类型的图片或视频处理逻辑 * * @param mimeType * @param image */ private void separateMimeTypeWith(String mimeType, LocalMedia image) { if (config.enableCrop && PictureMimeType.isHasImage(mimeType)) { isCompleteOrSelected = false; if (config.selectionMode == PictureConfig.SINGLE) { config.originalPath = image.getPath(); startCrop(config.originalPath, image.getMimeType()); } else { // 是图片和选择压缩并且是多张,调用批量压缩 ArrayList<CutInfo> cuts = new ArrayList<>(); int count = selectData.size(); for (int i = 0; i < count; i++) { LocalMedia media = selectData.get(i); if (media == null || TextUtils.isEmpty(media.getPath())) { continue; } CutInfo cutInfo = new CutInfo(); cutInfo.setId(media.getId()); cutInfo.setPath(media.getPath()); cutInfo.setImageWidth(media.getWidth()); cutInfo.setImageHeight(media.getHeight()); cutInfo.setMimeType(media.getMimeType()); cutInfo.setAndroidQToPath(media.getAndroidQToPath()); cutInfo.setId(media.getId()); cutInfo.setDuration(media.getDuration()); cutInfo.setRealPath(media.getRealPath()); cuts.add(cutInfo); } startCrop(cuts); } } else { onBackPressed(); } }
Example #21
Source File: StringUtils.java From PictureSelector with Apache License 2.0 | 5 votes |
/** * 根据类型获取相应的Toast文案 * * @param context * @param mimeType * @param maxSelectNum * @return */ @SuppressLint("StringFormatMatches") public static String getMsg(Context context, String mimeType, int maxSelectNum) { if (PictureMimeType.isHasVideo(mimeType)) { return context.getString(R.string.picture_message_video_max_num, maxSelectNum); } else if (PictureMimeType.isHasAudio(mimeType)) { return context.getString(R.string.picture_message_audio_max_num, maxSelectNum); } else { return context.getString(R.string.picture_message_max_num, maxSelectNum); } }
Example #22
Source File: ImagePickerHelper.java From FastLib with Apache License 2.0 | 5 votes |
public void selectPicture(int requestCode, OnImageSelect onImageSelect) { this.mOnImageSelect = onImageSelect; this.mRequestCode = requestCode; PictureSelector.create(mContext) .openGallery(PictureMimeType.ofImage()) .theme(StatusBarUtil.isSupportStatusBarFontChange() ? R.style.PicturePickerStyle : R.style.PicturePickerStyle_White) .selectionMode(PictureConfig.SINGLE) .forResult(mRequestCode); }
Example #23
Source File: PictureSelectorActivity.java From PictureSelector with Apache License 2.0 | 5 votes |
/** * singleDirectReturn * * @param mimeType */ private void singleDirectReturnCameraHandleResult(String mimeType) { boolean isHasImage = PictureMimeType.isHasImage(mimeType); if (config.enableCrop && isHasImage) { config.originalPath = config.cameraPath; startCrop(config.cameraPath, mimeType); } else if (config.isCompress && isHasImage) { List<LocalMedia> selectedImages = mAdapter.getSelectedData(); compressImage(selectedImages); } else { onResult(mAdapter.getSelectedData()); } }
Example #24
Source File: PictureBaseActivity.java From PictureSelector with Apache License 2.0 | 5 votes |
/** * Insert the image into the camera folder * * @param path * @param imageFolders * @return */ protected LocalMediaFolder getImageFolder(String path, String realPath, List<LocalMediaFolder> imageFolders) { File imageFile = new File(PictureMimeType.isContent(path) ? realPath : path); File folderFile = imageFile.getParentFile(); for (LocalMediaFolder folder : imageFolders) { if (folderFile != null && folder.getName().equals(folderFile.getName())) { return folder; } } LocalMediaFolder newFolder = new LocalMediaFolder(); newFolder.setName(folderFile != null ? folderFile.getName() : ""); newFolder.setFirstImagePath(path); imageFolders.add(newFolder); return newFolder; }
Example #25
Source File: PictureBaseActivity.java From PictureSelector with Apache License 2.0 | 5 votes |
/** * get audio path * * @param data */ protected String getAudioPath(Intent data) { if (data != null && config.chooseMode == PictureMimeType.ofAudio()) { try { Uri uri = data.getData(); if (uri != null) { return Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT ? uri.getPath() : MediaUtils.getAudioFilePathFromUri(getContext(), uri); } } catch (Exception e) { e.printStackTrace(); } } return ""; }
Example #26
Source File: PictureBaseActivity.java From PictureSelector with Apache License 2.0 | 5 votes |
/** * start to camera audio */ public void startOpenCameraAudio() { if (PermissionChecker.checkSelfPermission(this, Manifest.permission.RECORD_AUDIO)) { Intent cameraIntent = new Intent(MediaStore.Audio.Media.RECORD_SOUND_ACTION); if (cameraIntent.resolveActivity(getPackageManager()) != null) { config.cameraMimeType = PictureMimeType.ofAudio(); startActivityForResult(cameraIntent, PictureConfig.REQUEST_CAMERA); } } else { PermissionChecker.requestPermissions(this, new String[]{Manifest.permission.RECORD_AUDIO}, PictureConfig.APPLY_AUDIO_PERMISSIONS_CODE); } }
Example #27
Source File: PictureImageGridAdapter.java From PictureSelector with Apache License 2.0 | 5 votes |
public CameraViewHolder(View itemView) { super(itemView); headerView = itemView; tvCamera = itemView.findViewById(R.id.tvCamera); String title = config.chooseMode == PictureMimeType.ofAudio() ? context.getString(R.string.picture_tape) : context.getString(R.string.picture_take_picture); tvCamera.setText(title); }
Example #28
Source File: PictureSelectionModel.java From PictureSelector with Apache License 2.0 | 5 votes |
/** * @param isOriginalControl Whether the original image is displayed * @return */ public PictureSelectionModel isOriginalImageControl(boolean isOriginalControl) { selectionConfig.isOriginalControl = !selectionConfig.camera && selectionConfig.chooseMode != PictureMimeType.ofVideo() && selectionConfig.chooseMode != PictureMimeType.ofAudio() && isOriginalControl; return this; }
Example #29
Source File: PictureVideoPlayActivity.java From PictureSelector with Apache License 2.0 | 5 votes |
@Override public void onStart() { // Play Video if (SdkVersionUtils.checkedAndroid_Q() && PictureMimeType.isContent(videoPath)) { mVideoView.setVideoURI(Uri.parse(videoPath)); } else { mVideoView.setVideoPath(videoPath); } mVideoView.start(); super.onStart(); }
Example #30
Source File: PictureAlbumDirectoryAdapter.java From PictureSelector with Apache License 2.0 | 5 votes |
@Override public void onBindViewHolder(final ViewHolder holder, int position) { final LocalMediaFolder folder = folders.get(position); String name = folder.getName(); int imageNum = folder.getImageNum(); String imagePath = folder.getFirstImagePath(); boolean isChecked = folder.isChecked(); int checkedNum = folder.getCheckedNum(); holder.tvSign.setVisibility(checkedNum > 0 ? View.VISIBLE : View.INVISIBLE); holder.itemView.setSelected(isChecked); if (config.style != null && config.style.pictureAlbumStyle != 0) { holder.itemView.setBackgroundResource(config.style.pictureAlbumStyle); } if (chooseMode == PictureMimeType.ofAudio()) { holder.ivFirstImage.setImageResource(R.drawable.picture_audio_placeholder); } else { if (PictureSelectionConfig.imageEngine != null) { PictureSelectionConfig.imageEngine.loadFolderImage(holder.itemView.getContext(), imagePath, holder.ivFirstImage); } } Context context = holder.itemView.getContext(); String firstTitle = folder.getOfAllType() != -1 ? folder.getOfAllType() == PictureMimeType.ofAudio() ? context.getString(R.string.picture_all_audio) : context.getString(R.string.picture_camera_roll) : name; holder.tvFolderName.setText(context.getString(R.string.picture_camera_roll_num, firstTitle, imageNum)); holder.itemView.setOnClickListener(view -> { if (onAlbumItemClickListener != null) { int size = folders.size(); for (int i = 0; i < size; i++) { LocalMediaFolder mediaFolder = folders.get(i); mediaFolder.setChecked(false); } folder.setChecked(true); notifyDataSetChanged(); onAlbumItemClickListener.onItemClick(position, folder.isCameraFolder(), folder.getBucketId(), folder.getName(), folder.getData()); } }); }