Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1465,4 +1465,14 @@ public void externalPictureVideo(String path) {
throw new NullPointerException("This PictureSelector is Null");
}
}

/**
* @param show whether to show too long and too short videos
* @return
*/
public PictureSelectionModel isShowOutLengthVideos(boolean show) {
selectionConfig.showOutLengthVideos = show;
return this;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ public final class PictureSelectionConfig implements Parcelable {
public boolean isAndroidQChangeWH;
public boolean isAndroidQChangeVideoWH;
public boolean isQuickCapture;
public boolean showOutLengthVideos;
/**
* 内测专用###########
*/
Expand Down Expand Up @@ -265,6 +266,7 @@ protected void initDefaultValue() {
isAndroidQChangeWH = true;
isAndroidQChangeVideoWH = false;
isQuickCapture = true;
showOutLengthVideos = false;
}

public static PictureSelectionConfig getInstance() {
Expand Down Expand Up @@ -404,6 +406,7 @@ public void writeToParcel(Parcel dest, int flags) {
dest.writeByte(this.isFallbackVersion ? (byte) 1 : (byte) 0);
dest.writeByte(this.isFallbackVersion2 ? (byte) 1 : (byte) 0);
dest.writeByte(this.isFallbackVersion3 ? (byte) 1 : (byte) 0);
dest.writeByte(this.showOutLengthVideos ? (byte) 1 : (byte) 0);
}

protected PictureSelectionConfig(Parcel in) {
Expand Down Expand Up @@ -508,6 +511,7 @@ protected PictureSelectionConfig(Parcel in) {
this.isFallbackVersion = in.readByte() != 0;
this.isFallbackVersion2 = in.readByte() != 0;
this.isFallbackVersion3 = in.readByte() != 0;
this.showOutLengthVideos = in.readByte() != 0;
}

public static final Creator<PictureSelectionConfig> CREATOR = new Creator<PictureSelectionConfig>() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,13 +394,14 @@ private LocalMediaFolder getImageFolder(String path, String folderName, List<Loc
* @return
*/
private String getDurationCondition(long exMaxLimit, long exMinLimit) {
long maxS = config.videoMaxSecond == 0 ? Long.MAX_VALUE : config.videoMaxSecond;
long maxS = config.videoMaxSecond;
maxS = ( maxS == 0 || (maxS != 0 && config.showOutLengthVideos)) ? Long.MAX_VALUE : config.videoMaxSecond;
if (exMaxLimit != 0) {
maxS = Math.min(maxS, exMaxLimit);
}
return String.format(Locale.CHINA, "%d <%s " + MediaStore.MediaColumns.DURATION + " and " + MediaStore.MediaColumns.DURATION + " <= %d",
Math.max(exMinLimit, config.videoMinSecond),
Math.max(exMinLimit, config.videoMinSecond) == 0 ? "" : "=",
config.showOutLengthVideos? 0:Math.max(exMinLimit, config.videoMinSecond),
Math.max(exMinLimit, config.videoMinSecond) == 0 || (Math.max(exMinLimit, config.videoMinSecond) != 0 && config.showOutLengthVideos) ? "" : "=",
maxS);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,11 +333,11 @@ public MediaData doInBackground() {
}
}
if (PictureMimeType.isHasVideo(mimeType)) {
if (config.videoMinSecond > 0 && duration < config.videoMinSecond) {
if (config.videoMinSecond > 0 && duration < config.videoMinSecond && !config.showOutLengthVideos) {
// If you set the minimum number of seconds of video to display
continue;
}
if (config.videoMaxSecond > 0 && duration > config.videoMaxSecond) {
if (config.videoMaxSecond > 0 && duration > config.videoMaxSecond && !config.showOutLengthVideos) {
// If you set the maximum number of seconds of video to display
continue;
}
Expand Down Expand Up @@ -697,13 +697,15 @@ private static String getRealPathAndroid_Q(long id) {
* @return
*/
private String getDurationCondition(long exMaxLimit, long exMinLimit) {
long maxS = config.videoMaxSecond == 0 ? Long.MAX_VALUE : config.videoMaxSecond;
long maxS = config.videoMaxSecond;
maxS = ( maxS == 0 || (maxS != 0 && config.showOutLengthVideos)) ? Long.MAX_VALUE : config.videoMaxSecond;
if (exMaxLimit != 0) {
maxS = Math.min(maxS, exMaxLimit);
}

return String.format(Locale.CHINA, "%d <%s " + MediaStore.MediaColumns.DURATION + " and " + MediaStore.MediaColumns.DURATION + " <= %d",
Math.max(exMinLimit, config.videoMinSecond),
Math.max(exMinLimit, config.videoMinSecond) == 0 ? "" : "=",
config.showOutLengthVideos? 0:Math.max(exMinLimit, config.videoMinSecond),
Math.max(exMinLimit, config.videoMinSecond) == 0 || (Math.max(exMinLimit, config.videoMinSecond) != 0 && config.showOutLengthVideos) ? "" : "=",
maxS);
}

Expand Down