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
package com.ypx.imagepicker.bean;
 
 
import java.io.Serializable;
import java.util.ArrayList;
 
/**
 * Description: 文件夹信息
 * <p>
 * Author: peixing.yang
 * Date: 2019/2/21
 */
public class ImageSet implements Serializable {
    public static final String ID_ALL_MEDIA = "-1";
    public static final String ID_ALL_VIDEO = "-2";
    public String id;
    public String name;
    public String coverPath;
    public int count;
    public ImageItem cover;
    public ArrayList<ImageItem> imageItems;
    public boolean isSelected = false;
 
    @Override
    public boolean equals(Object o) {
        ImageSet other = (ImageSet) o;
        if (this == o) {
            return true;
        }
        if (this.id != null && other != null && other.id != null) {
            return this.id.equals(other.id);
        }
        return super.equals(o);
    }
 
    public ImageSet copy() {
        ImageSet imageSet = new ImageSet();
        imageSet.name = this.name;
        imageSet.coverPath = this.coverPath;
        imageSet.cover = this.cover;
        imageSet.isSelected = this.isSelected;
        imageSet.imageItems = new ArrayList<>();
        if (this.imageItems != null) {
            imageSet.imageItems.addAll(this.imageItems);
        }
        return imageSet;
    }
 
    public ImageSet copy(boolean isFilterVideo) {
        ImageSet imageSet = new ImageSet();
        imageSet.name = this.name;
        imageSet.coverPath = this.coverPath;
        imageSet.cover = this.cover;
        imageSet.isSelected = this.isSelected;
        imageSet.imageItems = new ArrayList<>();
        if (imageItems != null && imageItems.size() > 0) {
            for (ImageItem item : this.imageItems) {
                if (isFilterVideo && item.isVideo()) {
                    continue;
                }
                ImageItem newItem = item.copy();
                imageSet.imageItems.add(newItem);
            }
        }
        return imageSet;
    }
 
    public static ImageSet allImageSet(String name) {
        ImageSet imageSet = new ImageSet();
        imageSet.id = ImageSet.ID_ALL_MEDIA;
        imageSet.name = name;
        return imageSet;
    }
 
    public boolean isAllMedia() {
        return id == null || id.equals(ID_ALL_MEDIA);
    }
 
    public boolean isAllVideo() {
        return id != null && id.equals(ID_ALL_VIDEO);
    }
 
}