lmw
2025-04-24 718f31c92e2029d05260810435a2c70cef6e6ce5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
package com.ypx.imagepicker.bean.selectconfig;
 
import android.content.Context;
 
import com.ypx.imagepicker.bean.ImageItem;
import com.ypx.imagepicker.bean.MimeType;
import com.ypx.imagepicker.bean.SelectMode;
import com.ypx.imagepicker.utils.PDateUtil;
 
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Set;
 
/**
 * Time: 2019/9/30 11:05
 * Author:ypx
 * Description: 配置类基类
 */
public class BaseSelectConfig implements Serializable {
    private int maxCount;
    private int minCount;
    private long minVideoDuration = 0;
    private long maxVideoDuration = 1200000000L;
    private int columnCount = 4;
    private boolean isShowCamera;
    private boolean isShowCameraInAllMedia;
    private boolean isVideoSinglePick = true;
    private boolean isShowVideo = true;
    private boolean isShowImage = true;
    private boolean isLoadGif = false;
 
    private boolean isSinglePickAutoComplete = false;
 
    /**
     * 图片和视频只能选择一个
     */
    private boolean isSinglePickImageOrVideoType = false;
    private Set<MimeType> mimeTypes = MimeType.ofAll();
    private ArrayList<ImageItem> shieldImageList = new ArrayList<>();
 
    public boolean isShowCameraInAllMedia() {
        return isShowCameraInAllMedia;
    }
 
    public void setShowCameraInAllMedia(boolean showCameraInAllMedia) {
        isShowCameraInAllMedia = showCameraInAllMedia;
    }
 
    public ArrayList<ImageItem> getShieldImageList() {
        return shieldImageList;
    }
 
    public void setShieldImageList(ArrayList<ImageItem> shieldImageList) {
        this.shieldImageList = shieldImageList;
    }
 
    public boolean isSinglePickImageOrVideoType() {
        return isSinglePickImageOrVideoType;
    }
 
    public void setSinglePickImageOrVideoType(boolean singlePickImageOrVideoType) {
        isSinglePickImageOrVideoType = singlePickImageOrVideoType;
    }
 
    public int getMinCount() {
        return minCount;
    }
 
    public void setMinCount(int minCount) {
        this.minCount = minCount;
    }
 
    public long getMinVideoDuration() {
        return minVideoDuration;
    }
 
    public void setMinVideoDuration(long minVideoDuration) {
        this.minVideoDuration = minVideoDuration;
    }
 
    public long getMaxVideoDuration() {
        return maxVideoDuration;
    }
 
    public String getMaxVideoDurationFormat(Context context) {
        return PDateUtil.formatTime(context, maxVideoDuration);
    }
 
    public String getMinVideoDurationFormat(Context context) {
        return PDateUtil.formatTime(context, minVideoDuration);
    }
 
    public void setMaxVideoDuration(long maxVideoDuration) {
        this.maxVideoDuration = maxVideoDuration;
    }
 
    public int getColumnCount() {
        return columnCount;
    }
 
    public void setColumnCount(int columnCount) {
        this.columnCount = columnCount;
    }
 
    public int getMaxCount() {
        return maxCount;
    }
 
    public void setMaxCount(int maxCount) {
        this.maxCount = maxCount;
    }
 
    public boolean isShowCamera() {
        return isShowCamera;
    }
 
    public void setShowCamera(boolean showCamera) {
        isShowCamera = showCamera;
    }
 
    public boolean isVideoSinglePick() {
        return isVideoSinglePick;
    }
 
    public void setVideoSinglePick(boolean videoSinglePick) {
        isVideoSinglePick = videoSinglePick;
    }
 
    public boolean isShowVideo() {
        return isShowVideo;
    }
 
    public void setShowVideo(boolean showVideo) {
        isShowVideo = showVideo;
    }
 
    public boolean isShowImage() {
        return isShowImage;
    }
 
    public boolean isOnlyShowImage() {
        return isShowImage && !isShowVideo;
    }
 
    public boolean isOnlyShowVideo() {
        return isShowVideo && !isShowImage;
    }
 
    public void setShowImage(boolean showImage) {
        isShowImage = showImage;
    }
 
    public boolean isLoadGif() {
        return isLoadGif;
    }
 
    public void setLoadGif(boolean loadGif) {
        isLoadGif = loadGif;
    }
 
    public Set<MimeType> getMimeTypes() {
        return mimeTypes;
    }
 
    public void setMimeTypes(Set<MimeType> mimeTypes) {
        this.mimeTypes = mimeTypes;
    }
 
    public boolean isSinglePickAutoComplete() {
        return isSinglePickAutoComplete;
    }
 
    public void setSinglePickAutoComplete(boolean singlePickAutoComplete) {
        isSinglePickAutoComplete = singlePickAutoComplete;
    }
 
    public boolean isVideoSinglePickAndAutoComplete() {
        return isVideoSinglePick() && isSinglePickAutoComplete();
    }
 
    /**
     * 是否屏蔽某个URL
     */
    public boolean isShieldItem(ImageItem imageItem) {
        if (shieldImageList == null || shieldImageList.size() == 0) {
            return false;
        }
        for (ImageItem item : shieldImageList) {
            if (item.equals(imageItem)) {
                return true;
            }
        }
        return false;
    }
}