diff --git a/README.md b/README.md index 3e8f38f..ecc9874 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,8 @@ 3、添加媒体库加载策略,开发者可自行配置加载图片或者视频,灵活运用于不同业务实现。 4、完善大图预览功能,完善部分UI界面的显示。 +### Version2.0.1: +1、添加视频的其他文件夹同图片 # 使用方式: diff --git a/imagepicker/src/main/java/com/lcw/library/imagepicker/loader/MediaHandler.java b/imagepicker/src/main/java/com/lcw/library/imagepicker/loader/MediaHandler.java index f247f46..6f92ca3 100644 --- a/imagepicker/src/main/java/com/lcw/library/imagepicker/loader/MediaHandler.java +++ b/imagepicker/src/main/java/com/lcw/library/imagepicker/loader/MediaHandler.java @@ -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()); + } + ArrayList videoList = mediaFolder.getMediaFileList(); + videoList.add(mediaFile); + mediaFolder.setMediaFileList(videoList); + mediaFolder.setMediaFileList(videoList); + mediaFolderMap.put(videoFolderId, mediaFolder); + } + } + //整理聚类数据 List mediaFolderList = new ArrayList<>(); for (Integer folderId : mediaFolderMap.keySet()) { diff --git a/imagepicker/src/main/res/values/strings.xml b/imagepicker/src/main/res/values/strings.xml index baf3ec6..b96c904 100644 --- a/imagepicker/src/main/res/values/strings.xml +++ b/imagepicker/src/main/res/values/strings.xml @@ -6,7 +6,7 @@ 最多选择%1$d张图片 确定 确定(%1$d/%2$d) - %d张 + %d 文件 没有扫描到图片 全部 所有视频