From 2138c1bf98fffe54781ef2216cc7791d7fd0abb1 Mon Sep 17 00:00:00 2001 From: Sendtion <524100248@qq.com> Date: Fri, 28 Dec 2018 11:52:21 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=9C=80=E5=A4=A7=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E6=95=B0=E9=87=8F=E9=99=90=E5=88=B6=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../filepicker/controller/adapters/FileListAdapter.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/filepicker/src/main/java/com/github/angads25/filepicker/controller/adapters/FileListAdapter.java b/filepicker/src/main/java/com/github/angads25/filepicker/controller/adapters/FileListAdapter.java index b82dd39..1768029 100644 --- a/filepicker/src/main/java/com/github/angads25/filepicker/controller/adapters/FileListAdapter.java +++ b/filepicker/src/main/java/com/github/angads25/filepicker/controller/adapters/FileListAdapter.java @@ -155,7 +155,13 @@ public View getView(final int i, View view, ViewGroup viewGroup) { holder.fmark.setOnCheckedChangedListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(MaterialCheckbox checkbox, boolean isChecked) { - item.setMarked(isChecked); + //限制最大选择数量 + if (MarkedItemList.getFileCount() < properties.max_count){ + item.setMarked(isChecked); + } else { + item.setMarked(false); + holder.fmark.setChecked(false); + } if (item.isMarked()) { if(properties.selection_mode == DialogConfigs.MULTI_MODE) { MarkedItemList.addSelectedItem(item); From a1c5d09b49a39489cb86087b007d8c00b3dea6a2 Mon Sep 17 00:00:00 2001 From: Sendtion <524100248@qq.com> Date: Fri, 28 Dec 2018 11:54:21 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=9C=80=E5=A4=A7?= =?UTF-8?q?=E9=80=89=E6=8B=A9=E6=95=B0=E9=87=8F=E5=8F=98=E9=87=8F=EF=BC=8C?= =?UTF-8?q?=E9=BB=98=E8=AE=A49?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/github/angads25/filepicker/model/DialogConfigs.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/filepicker/src/main/java/com/github/angads25/filepicker/model/DialogConfigs.java b/filepicker/src/main/java/com/github/angads25/filepicker/model/DialogConfigs.java index 5e351c2..48b189c 100644 --- a/filepicker/src/main/java/com/github/angads25/filepicker/model/DialogConfigs.java +++ b/filepicker/src/main/java/com/github/angads25/filepicker/model/DialogConfigs.java @@ -52,6 +52,11 @@ public abstract class DialogConfigs { * can be selected. */ public static final int FILE_AND_DIR_SELECT = 2; + + /* + * Max Select Count , defalut 9 + */ + public static final int MAX_COUNT = 9; /* PARENT_DIRECTORY*/ public static final String DIRECTORY_SEPERATOR = "/"; From b509cba47df8c6b0d61fb5f4ecfcf57e9fdb93d9 Mon Sep 17 00:00:00 2001 From: Sendtion <524100248@qq.com> Date: Fri, 28 Dec 2018 11:55:56 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E4=B8=AD=E6=B7=BB=E5=8A=A0=E6=9C=80=E5=A4=A7=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E6=95=B0=E9=87=8F=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../angads25/filepicker/model/DialogProperties.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/filepicker/src/main/java/com/github/angads25/filepicker/model/DialogProperties.java b/filepicker/src/main/java/com/github/angads25/filepicker/model/DialogProperties.java index bea7093..81424b8 100644 --- a/filepicker/src/main/java/com/github/angads25/filepicker/model/DialogProperties.java +++ b/filepicker/src/main/java/com/github/angads25/filepicker/model/DialogProperties.java @@ -42,6 +42,11 @@ public class DialogProperties { * See DialogConfigs for more info. Set to FILE_SELECT as default value by constructor. */ public int selection_type; + + /** + * add property max_count + */ + public int max_count; /** The Parent/Root Directory. List of Files are populated from here. Can be set * to any readable directory. /sdcard is the default location. @@ -78,8 +83,9 @@ public DialogProperties() { selection_mode = DialogConfigs.SINGLE_MODE; selection_type = DialogConfigs.FILE_SELECT; root = new File(DialogConfigs.DEFAULT_DIR); + max_count = DialogConfigs.MAX_COUNT; error_dir = new File(DialogConfigs.DEFAULT_DIR); offset = new File(DialogConfigs.DEFAULT_DIR); extensions = null; } -} \ No newline at end of file +}