Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

添加视频的其他文件夹 #47

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
3、添加媒体库加载策略,开发者可自行配置加载图片或者视频,灵活运用于不同业务实现。
4、完善大图预览功能,完善部分UI界面的显示。

### Version2.0.1:
1、添加视频的其他文件夹同图片

# 使用方式:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,25 @@ public int compare(MediaFile o1, MediaFile o2) {
}
}

//对视频进行文件夹分类
if (videoFileList != null && !videoFileList.isEmpty()) {
int size = videoFileList.size();
//添加其他的视频文件夹
for (int i = 0; i < size; i++) {
MediaFile mediaFile = videoFileList.get(i);
int videoFolderId = mediaFile.getFolderId();
MediaFolder mediaFolder = mediaFolderMap.get(videoFolderId);
if (mediaFolder == null) {
mediaFolder = new MediaFolder(videoFolderId, mediaFile.getFolderName(), mediaFile.getPath(), new ArrayList<MediaFile>());
}
ArrayList<MediaFile> videoList = mediaFolder.getMediaFileList();
videoList.add(mediaFile);
mediaFolder.setMediaFileList(videoList);
mediaFolder.setMediaFileList(videoList);
mediaFolderMap.put(videoFolderId, mediaFolder);
}
}

//整理聚类数据
List<MediaFolder> mediaFolderList = new ArrayList<>();
for (Integer folderId : mediaFolderMap.keySet()) {
Expand Down
2 changes: 1 addition & 1 deletion imagepicker/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<string name="select_image_max">最多选择%1$d张图片</string>
<string name="confirm">确定</string>
<string name="confirm_msg">确定(%1$d/%2$d)</string>
<string name="image_num">%d张</string>
<string name="image_num">%d 文件</string>
<string name="scanner_image_no_found">没有扫描到图片</string>
<string name="all_media">全部</string>
<string name="all_video">所有视频</string>
Expand Down