Java Code Examples for com.luck.picture.lib.config.PictureConfig#TYPE_ALL
The following examples show how to use
com.luck.picture.lib.config.PictureConfig#TYPE_ALL .
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: PictureSelectorCameraEmptyActivity.java From PictureSelector with Apache License 2.0 | 6 votes |
/** * Open the Camera by type */ private void startCamera() { switch (config.chooseMode) { case PictureConfig.TYPE_ALL: case PictureConfig.TYPE_IMAGE: startOpenCamera(); break; case PictureConfig.TYPE_VIDEO: startOpenCameraVideo(); break; case PictureConfig.TYPE_AUDIO: startOpenCameraAudio(); break; default: break; } }
Example 2
Source File: LocalMediaLoader.java From PictureSelector with Apache License 2.0 | 5 votes |
private String getSelection() { switch (config.chooseMode) { case PictureConfig.TYPE_ALL: // Get all, not including audio return getSelectionArgsForAllMediaCondition(getDurationCondition(0, 0), config.isGif); case PictureConfig.TYPE_IMAGE: if (!TextUtils.isEmpty(config.specifiedFormat)) { // Gets the image of the specified type return SELECTION_SPECIFIED_FORMAT + "='" + config.specifiedFormat + "'"; } return config.isGif ? SELECTION : SELECTION_NOT_GIF; case PictureConfig.TYPE_VIDEO: // Access to video if (!TextUtils.isEmpty(config.specifiedFormat)) { // Gets the image of the specified type return SELECTION_SPECIFIED_FORMAT + "='" + config.specifiedFormat + "'"; } return getSelectionArgsForSingleMediaCondition(); case PictureConfig.TYPE_AUDIO: // Access to the audio if (!TextUtils.isEmpty(config.specifiedFormat)) { // Gets the image of the specified type return SELECTION_SPECIFIED_FORMAT + "='" + config.specifiedFormat + "'"; } return getSelectionArgsForSingleMediaCondition(getDurationCondition(0, AUDIO_DURATION)); } return null; }
Example 3
Source File: LocalMediaLoader.java From PictureSelector with Apache License 2.0 | 5 votes |
private String[] getSelectionArgs() { switch (config.chooseMode) { case PictureConfig.TYPE_ALL: return SELECTION_ALL_ARGS; case PictureConfig.TYPE_IMAGE: // Get Image return getSelectionArgsForSingleMediaType(MediaStore.Files.FileColumns.MEDIA_TYPE_IMAGE); case PictureConfig.TYPE_VIDEO: // Get Video return getSelectionArgsForSingleMediaType(MediaStore.Files.FileColumns.MEDIA_TYPE_VIDEO); case PictureConfig.TYPE_AUDIO: return getSelectionArgsForSingleMediaType(MediaStore.Files.FileColumns.MEDIA_TYPE_AUDIO); } return null; }
Example 4
Source File: LocalMediaPageLoader.java From PictureSelector with Apache License 2.0 | 5 votes |
private String[] getPageSelectionArgs(long bucketId) { switch (config.chooseMode) { case PictureConfig.TYPE_ALL: if (bucketId == -1) { // ofAll return new String[]{ String.valueOf(MediaStore.Files.FileColumns.MEDIA_TYPE_IMAGE), String.valueOf(MediaStore.Files.FileColumns.MEDIA_TYPE_VIDEO), }; } // Gets the specified album directory return new String[]{ String.valueOf(MediaStore.Files.FileColumns.MEDIA_TYPE_IMAGE), String.valueOf(MediaStore.Files.FileColumns.MEDIA_TYPE_VIDEO), ValueOf.toString(bucketId) }; case PictureConfig.TYPE_IMAGE: // Get photo return getSelectionArgsForPageSingleMediaType(MediaStore.Files.FileColumns.MEDIA_TYPE_IMAGE, bucketId); case PictureConfig.TYPE_VIDEO: // Get video return getSelectionArgsForPageSingleMediaType(MediaStore.Files.FileColumns.MEDIA_TYPE_VIDEO, bucketId); case PictureConfig.TYPE_AUDIO: // Get audio return getSelectionArgsForPageSingleMediaType(MediaStore.Files.FileColumns.MEDIA_TYPE_AUDIO, bucketId); } return null; }
Example 5
Source File: LocalMediaPageLoader.java From PictureSelector with Apache License 2.0 | 5 votes |
private String getSelection() { switch (config.chooseMode) { case PictureConfig.TYPE_ALL: // Get all, not including audio return getSelectionArgsForAllMediaCondition(getDurationCondition(0, 0), config.isGif); case PictureConfig.TYPE_IMAGE: if (!TextUtils.isEmpty(config.specifiedFormat)) { // 获取指定类型的图片 if (SdkVersionUtils.checkedAndroid_Q()) { return SELECTION_SPECIFIED_FORMAT_29 + "='" + config.specifiedFormat + "' AND " + MediaStore.MediaColumns.SIZE + ">0"; } return SELECTION_SPECIFIED_FORMAT + "='" + config.specifiedFormat + "') AND " + MediaStore.MediaColumns.SIZE + ">0)" + GROUP_BY_BUCKET_Id; } if (SdkVersionUtils.checkedAndroid_Q()) { return config.isGif ? SELECTION_29 : SELECTION_NOT_GIF_29; } return config.isGif ? SELECTION : SELECTION_NOT_GIF; case PictureConfig.TYPE_VIDEO: // 获取视频 if (!TextUtils.isEmpty(config.specifiedFormat)) { // Gets the specified album directory if (SdkVersionUtils.checkedAndroid_Q()) { return SELECTION_SPECIFIED_FORMAT_29 + "='" + config.specifiedFormat + "' AND " + MediaStore.MediaColumns.SIZE + ">0"; } return SELECTION_SPECIFIED_FORMAT + "='" + config.specifiedFormat + "') AND " + MediaStore.MediaColumns.SIZE + ">0)" + GROUP_BY_BUCKET_Id; } return getSelectionArgsForSingleMediaCondition(getDurationCondition(0, 0)); case PictureConfig.TYPE_AUDIO: // Get Audio if (!TextUtils.isEmpty(config.specifiedFormat)) { // Gets the specified album directory if (SdkVersionUtils.checkedAndroid_Q()) { return SELECTION_SPECIFIED_FORMAT_29 + "='" + config.specifiedFormat + "' AND " + MediaStore.MediaColumns.SIZE + ">0"; } return SELECTION_SPECIFIED_FORMAT + "='" + config.specifiedFormat + "') AND " + MediaStore.MediaColumns.SIZE + ">0)" + GROUP_BY_BUCKET_Id; } return getSelectionArgsForSingleMediaCondition(getDurationCondition(0, AUDIO_DURATION)); } return null; }
Example 6
Source File: LocalMediaPageLoader.java From PictureSelector with Apache License 2.0 | 5 votes |
private String[] getSelectionArgs() { switch (config.chooseMode) { case PictureConfig.TYPE_ALL: return SELECTION_ALL_ARGS; case PictureConfig.TYPE_IMAGE: // Get photo return getSelectionArgsForSingleMediaType(MediaStore.Files.FileColumns.MEDIA_TYPE_IMAGE); case PictureConfig.TYPE_VIDEO: // Get video return getSelectionArgsForSingleMediaType(MediaStore.Files.FileColumns.MEDIA_TYPE_VIDEO); case PictureConfig.TYPE_AUDIO: return getSelectionArgsForSingleMediaType(MediaStore.Files.FileColumns.MEDIA_TYPE_AUDIO); } return null; }
Example 7
Source File: PictureBaseActivity.java From PictureSelector with Apache License 2.0 | 4 votes |
/** * start to camera、preview、crop */ protected void startOpenCamera() { Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); if (cameraIntent.resolveActivity(getPackageManager()) != null) { Uri imageUri; if (SdkVersionUtils.checkedAndroid_Q()) { imageUri = MediaUtils.createImageUri(getApplicationContext(), config.suffixType); if (imageUri != null) { config.cameraPath = imageUri.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_IMAGE : config.chooseMode; String cameraFileName = ""; if (!TextUtils.isEmpty(config.cameraFileName)) { boolean isSuffixOfImage = PictureMimeType.isSuffixOfImage(config.cameraFileName); config.cameraFileName = !isSuffixOfImage ? StringUtils.renameSuffix(config.cameraFileName, PictureMimeType.JPEG) : 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(); imageUri = PictureFileUtils.parUri(this, cameraFile); } else { ToastUtils.s(getContext(), "open is camera error,the uri is empty "); if (config.camera) { closeActivity(); } return; } } config.cameraMimeType = PictureMimeType.ofImage(); if (config.isCameraAroundState) { cameraIntent.putExtra(PictureConfig.CAMERA_FACING, PictureConfig.CAMERA_BEFORE); } cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri); startActivityForResult(cameraIntent, PictureConfig.REQUEST_CAMERA); } }
Example 8
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); } }
Example 9
Source File: LocalMediaPageLoader.java From PictureSelector with Apache License 2.0 | 4 votes |
private String getPageSelection(long bucketId) { String durationCondition = getDurationCondition(0, 0); boolean isSpecifiedFormat = !TextUtils.isEmpty(config.specifiedFormat); switch (config.chooseMode) { case PictureConfig.TYPE_ALL: if (bucketId == -1) { // ofAll return "(" + MediaStore.Files.FileColumns.MEDIA_TYPE + "=?" + (config.isGif ? "" : " AND " + MediaStore.MediaColumns.MIME_TYPE + NOT_GIF) + " OR " + MediaStore.Files.FileColumns.MEDIA_TYPE + "=? AND " + durationCondition + ") AND " + MediaStore.MediaColumns.SIZE + ">0"; } // Gets the specified album directory return "(" + MediaStore.Files.FileColumns.MEDIA_TYPE + "=?" + (config.isGif ? "" : " AND " + MediaStore.MediaColumns.MIME_TYPE + NOT_GIF) + " OR " + MediaStore.Files.FileColumns.MEDIA_TYPE + "=? AND " + durationCondition + ") AND " + COLUMN_BUCKET_ID + "=? AND " + MediaStore.MediaColumns.SIZE + ">0"; case PictureConfig.TYPE_IMAGE: // Gets the image of the specified type if (bucketId == -1) { // ofAll if (isSpecifiedFormat) { return "(" + MediaStore.Files.FileColumns.MEDIA_TYPE + "=?" + (config.isGif ? "" : " AND " + MediaStore.MediaColumns.MIME_TYPE + NOT_GIF + " AND " + MediaStore.MediaColumns.MIME_TYPE + "='" + config.specifiedFormat + "'") + ") AND " + MediaStore.MediaColumns.SIZE + ">0"; } return "(" + MediaStore.Files.FileColumns.MEDIA_TYPE + "=?" + (config.isGif ? "" : " AND " + MediaStore.MediaColumns.MIME_TYPE + NOT_GIF) + ") AND " + MediaStore.MediaColumns.SIZE + ">0"; } // Gets the specified album directory if (isSpecifiedFormat) { return "(" + MediaStore.Files.FileColumns.MEDIA_TYPE + "=?" + (config.isGif ? "" : " AND " + MediaStore.MediaColumns.MIME_TYPE + NOT_GIF + " AND " + MediaStore.MediaColumns.MIME_TYPE + "='" + config.specifiedFormat + "'") + ") AND " + COLUMN_BUCKET_ID + "=? AND " + MediaStore.MediaColumns.SIZE + ">0"; } return "(" + MediaStore.Files.FileColumns.MEDIA_TYPE + "=?" + (config.isGif ? "" : " AND " + MediaStore.MediaColumns.MIME_TYPE + NOT_GIF) + ") AND " + COLUMN_BUCKET_ID + "=? AND " + MediaStore.MediaColumns.SIZE + ">0"; case PictureConfig.TYPE_VIDEO: case PictureConfig.TYPE_AUDIO: if (bucketId == -1) { // ofAll if (isSpecifiedFormat) { return "(" + MediaStore.Files.FileColumns.MEDIA_TYPE + "=? AND " + MediaStore.MediaColumns.MIME_TYPE + "='" + config.specifiedFormat + "'" + " AND " + durationCondition + ") AND " + MediaStore.MediaColumns.SIZE + ">0"; } return "(" + MediaStore.Files.FileColumns.MEDIA_TYPE + "=? AND " + durationCondition + ") AND " + MediaStore.MediaColumns.SIZE + ">0"; } // Gets the specified album directory if (isSpecifiedFormat) { return "(" + MediaStore.Files.FileColumns.MEDIA_TYPE + "=? AND " + MediaStore.MediaColumns.MIME_TYPE + "='" + config.specifiedFormat + "'" + " AND " + durationCondition + ") AND " + COLUMN_BUCKET_ID + "=? AND " + MediaStore.MediaColumns.SIZE + ">0"; } return "(" + MediaStore.Files.FileColumns.MEDIA_TYPE + "=? AND " + durationCondition + ") AND " + COLUMN_BUCKET_ID + "=? AND " + MediaStore.MediaColumns.SIZE + ">0"; } return null; }