Java Code Examples for com.luck.picture.lib.config.PictureMimeType#ofVideo()
The following examples show how to use
com.luck.picture.lib.config.PictureMimeType#ofVideo() .
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: 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 2
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 3
Source File: CloudActivity.java From tysq-android with GNU General Public License v3.0 | 4 votes |
@Override public void onModifyArticle(int type) { if (type == FileTypeDialog.OTHER) { new LFilePicker() .withActivity(this) .withRequestCode(REQUEST_FILE_CODE) .withStartPath(Environment.getExternalStorageDirectory().getAbsolutePath()) .withMutilyMode(true) .withMaxNum(9) .start(); // .withActivity(this) // .withRequestCode(REQUEST_FILE_CODE) // .withTitle("文件选择") // .withIconStyle(Constant.ICON_STYLE_YELLOW) // // //指定初始显示路径 // .withIsGreater(false)//过滤文件大小 小于指定大小的文件 // .withFileSize(1024 * 1024 * 1024)//指定文件大小为1G` // .withChooseMode(false)//文件夹选择模式 // //.withFileFilter(new String[]{"txt", "png", "docx"}) // .start(); return; } int mimeType; switch (type) { case FileTypeDialog.PIC: mimeType = PictureMimeType.ofImage(); break; case FileTypeDialog.VIDEO: mimeType = PictureMimeType.ofVideo(); break; case FileTypeDialog.AUDIO: mimeType = PictureMimeType.ofAudio(); break; default: mimeType = PictureMimeType.ofImage(); break; } int picWidth = UIUtils.dip2px(this, 50); PictureSelector.create(this) .openGallery(mimeType)// 全部.PictureMimeType.ofAll()、图片.ofImage()、视频.ofVideo()、音频.ofAudio() .maxSelectNum(9)// 最大图片选择数量 .minSelectNum(1)// 最小选择数量 .imageSpanCount(3)// 每行显示个数 .selectionMode(PictureConfig.MULTIPLE)// 多选 or 单选 .previewImage(mimeType == PictureMimeType.ofImage())// 是否可预览图片 true or false .previewVideo(mimeType == PictureMimeType.ofVideo())// 是否可预览视频 .enablePreviewAudio(mimeType == PictureMimeType.ofAudio())// 是否可播放音频 true or false .isZoomAnim(true)// 图片列表点击 缩放效果 默认true .synOrAsy(true)//同步true或异步false 压缩 默认同步 .glideOverride(picWidth, picWidth)// glide 加载宽高,越小图片列表越流畅,但会影响列表图片浏览的清晰度 .hideBottomControls(false)// 是否显示uCrop工具栏,默认不显示 .isGif(false)// 是否显示gif图片 .freeStyleCropEnabled(true)// 裁剪框是否可拖拽 .minimumCompressSize(100)// 小于100kb的图片不压缩 .forResult(REQUEST_MEDIA_CODE);//结果回调onActivityResult code }
Example 4
Source File: CustomCameraView.java From PictureSelector with Apache License 2.0 | 4 votes |
private Uri getOutUri(int type) { return type == PictureMimeType.ofVideo() ? MediaUtils.createVideoUri(getContext(), mConfig.suffixType) : MediaUtils.createImageUri(getContext(), mConfig.suffixType); }
Example 5
Source File: PictureBaseActivity.java From PictureSelector with Apache License 2.0 | 4 votes |
/** * start to camera、video */ protected void startOpenCameraVideo() { Intent cameraIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); if (cameraIntent.resolveActivity(getPackageManager()) != null) { Uri videoUri; if (SdkVersionUtils.checkedAndroid_Q()) { videoUri = MediaUtils.createVideoUri(getApplicationContext(), config.suffixType); if (videoUri != null) { config.cameraPath = videoUri.toString(); } else { ToastUtils.s(getContext(), "open is camera error,the uri is empty "); if (config.camera) { closeActivity(); } return; } } else { int chooseMode = config.chooseMode == PictureConfig.TYPE_ALL ? PictureConfig.TYPE_VIDEO : config.chooseMode; String cameraFileName = ""; if (!TextUtils.isEmpty(config.cameraFileName)) { boolean isSuffixOfImage = PictureMimeType.isSuffixOfImage(config.cameraFileName); config.cameraFileName = isSuffixOfImage ? StringUtils.renameSuffix(config.cameraFileName, PictureMimeType.MP4) : config.cameraFileName; cameraFileName = config.camera ? config.cameraFileName : StringUtils.rename(config.cameraFileName); } File cameraFile = PictureFileUtils.createCameraFile(getApplicationContext(), chooseMode, cameraFileName, config.suffixType, config.outPutCameraPath); if (cameraFile != null) { config.cameraPath = cameraFile.getAbsolutePath(); videoUri = PictureFileUtils.parUri(this, cameraFile); } else { ToastUtils.s(getContext(), "open is camera error,the uri is empty "); if (config.camera) { closeActivity(); } return; } } config.cameraMimeType = PictureMimeType.ofVideo(); cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, videoUri); if (config.isCameraAroundState) { cameraIntent.putExtra(PictureConfig.CAMERA_FACING, PictureConfig.CAMERA_BEFORE); } cameraIntent.putExtra(PictureConfig.EXTRA_QUICK_CAPTURE, config.isQuickCapture); cameraIntent.putExtra(MediaStore.EXTRA_DURATION_LIMIT, config.recordVideoSecond); cameraIntent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, config.videoQuality); startActivityForResult(cameraIntent, PictureConfig.REQUEST_CAMERA); } }