From 26a5ec917ef854fcc093d8ea55242632a8f2f6fe Mon Sep 17 00:00:00 2001 From: thatCbin <1172816325@qq.com> Date: Tue, 13 Apr 2021 21:10:07 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=B7=BB=E5=8A=A0=E8=A7=86=E9=A2=91=E7=9A=84?= =?UTF-8?q?=E5=85=B6=E4=BB=96=E6=96=87=E4=BB=B6=E5=A4=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 ++ .../imagepicker/loader/MediaHandler.java | 19 +++++++++++++++++++ imagepicker/src/main/res/values/strings.xml | 2 +- 3 files changed, 22 insertions(+), 1 deletion(-) 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 文件 没有扫描到图片 全部 所有视频