diff --git a/LICENSE b/LICENSE index 261eeb9..1aa3861 100644 --- a/LICENSE +++ b/LICENSE @@ -186,7 +186,7 @@ same "printed page" as the copyright notice for easier identification within third-party archives. - Copyright [yyyy] [name of copyright owner] + Copyright [2020] molihuan Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/README.md b/README.md index 7268dc3..c1215b5 100644 --- a/README.md +++ b/README.md @@ -90,7 +90,7 @@ dependencyResolutionManagement { ```java dependencies { ... - // 请将"版本"替换成具体的版本号,如 1.1.7 + // 请将"版本"替换成具体的版本号,如 1.1.11 implementation 'io.github.molihuan:pathselector:版本' } ``` @@ -103,10 +103,10 @@ PathSelector.build(this, MConstants.BUILD_DIALOG)//Dialog构建方式 .setMorePopupItemListeners( new CommonItemListener("OK") { @Override - public boolean onClick(View v, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { + public boolean onClick(View v, TextView tv, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { /**取消dialog弹窗 - * pathSelectFragment.getSelectConfigData().buildController.getDialogFragment().dismiss(); + * pathSelectFragment.dismiss(); */ StringBuilder builder = new StringBuilder(); @@ -144,7 +144,7 @@ PathSelectFragment selector = PathSelector.build(this, MConstants.BUILD_ACTIVITY .setMorePopupItemListeners( new CommonItemListener("OK") { @Override - public boolean onClick(View v, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { + public boolean onClick(View v, TextView tv, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { StringBuilder builder = new StringBuilder(); builder.append("you selected:\n"); @@ -180,7 +180,7 @@ PathSelectFragment selector = PathSelector.build(this, MConstants.BUILD_FRAGMENT .setMorePopupItemListeners( new CommonItemListener("OK") { @Override - public boolean onClick(View v, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { + public boolean onClick(View v, TextView tv, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { StringBuilder builder = new StringBuilder(); builder.append("you selected:\n"); @@ -250,14 +250,14 @@ PathSelectFragment selector = PathSelector.build(this, MConstants.BUILD_DIALOG) .setMorePopupItemListeners(//设置右上角选项回调 new CommonItemListener("SelectAll") { @Override - public boolean onClick(View v, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { + public boolean onClick(View v, TextView tv, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { pathSelectFragment.selectAllFile(true); return false; } }, new CommonItemListener("DeselectAll") { @Override - public boolean onClick(View v, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { + public boolean onClick(View v, TextView tv, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { pathSelectFragment.selectAllFile(false); return false; } @@ -266,7 +266,7 @@ PathSelectFragment selector = PathSelector.build(this, MConstants.BUILD_DIALOG) .setHandleItemListeners(//设置长按弹出选项回调 new CommonItemListener("OK") { @Override - public boolean onClick(View v, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { + public boolean onClick(View v, TextView tv, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { StringBuilder builder = new StringBuilder(); builder.append("you selected:\n"); for (FileBean fileBean : selectedFiles) { @@ -278,7 +278,7 @@ PathSelectFragment selector = PathSelector.build(this, MConstants.BUILD_DIALOG) }, new CommonItemListener("cancel") { @Override - public boolean onClick(View v, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { + public boolean onClick(View v, TextView tv, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { pathSelectFragment.openCloseMultipleMode(false); return false; } @@ -304,7 +304,7 @@ PathSelectFragment selector = PathSelector.build(this, MConstants.BUILD_DIALOG) //R.drawable.ic_test_mlh是你自己的图片资源id new CommonItemListener(new FontBean("OK", 18, Color.RED, R.drawable.ic_test_mlh)) { @Override - public boolean onClick(View v, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { + public boolean onClick(View v, TextView tv, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { Mtools.toast("You Click"); return false; } @@ -335,7 +335,7 @@ PathSelectFragment selector = PathSelector.build(this, MConstants.BUILD_DIALOG) } @Override - public boolean onClick(View v, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { + public boolean onClick(View v, TextView tv, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { Mtools.toast("You Click"); return false; } @@ -508,4 +508,21 @@ PathSelectFragment selector = PathSelector.build(this, MConstants.BUILD_DIALOG) 开源项目以及其依赖项目。 -### [LICENSE ](https://github.com/molihuan/mlhfileselectorlib/blob/master/LICENSE) +### LICENSE + +``` + Copyright [2020] molihuan + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +``` + diff --git a/README_EN.md b/README_EN.md index 2307755..068d819 100644 --- a/README_EN.md +++ b/README_EN.md @@ -90,7 +90,7 @@ dependencyResolutionManagement { ```java dependencies { ... - // Please replace "version" with a specific version number, e.g. 1.1.7 + // Please replace "version" with a specific version number, e.g. 1.1.11 implementation 'io.github.molihuan:pathselector:version' } ``` @@ -103,10 +103,10 @@ PathSelector.build(this, MConstants.BUILD_DIALOG)//Dialog build mode .setMorePopupItemListeners( new CommonItemListener("OK") { @Override - public boolean onClick(View v, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { + public boolean onClick(View v, TextView tv, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { - /**dialog.dismiss() - * pathSelectFragment.getSelectConfigData().buildController.getDialogFragment().dismiss(); + /**Dialog dismiss + * pathSelectFragment.dismiss(); */ StringBuilder builder = new StringBuilder(); @@ -144,7 +144,7 @@ PathSelectFragment selector = PathSelector.build(this, MConstants.BUILD_ACTIVITY .setMorePopupItemListeners( new CommonItemListener("OK") { @Override - public boolean onClick(View v, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { + public boolean onClick(View v, TextView tv, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { StringBuilder builder = new StringBuilder(); builder.append("you selected:\n"); @@ -180,7 +180,7 @@ PathSelectFragment selector = PathSelector.build(this, MConstants.BUILD_FRAGMENT .setMorePopupItemListeners( new CommonItemListener("OK") { @Override - public boolean onClick(View v, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { + public boolean onClick(View v, TextView tv, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { StringBuilder builder = new StringBuilder(); builder.append("you selected:\n"); @@ -250,14 +250,14 @@ PathSelectFragment selector = PathSelector.build(this, MConstants.BUILD_DIALOG) .setMorePopupItemListeners(//Set the top right option callback new CommonItemListener("SelectAll") { @Override - public boolean onClick(View v, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { + public boolean onClick(View v, TextView tv, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { pathSelectFragment.selectAllFile(true); return false; } }, new CommonItemListener("DeselectAll") { @Override - public boolean onClick(View v, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { + public boolean onClick(View v, TextView tv, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { pathSelectFragment.selectAllFile(false); return false; } @@ -266,7 +266,7 @@ PathSelectFragment selector = PathSelector.build(this, MConstants.BUILD_DIALOG) .setHandleItemListeners(//Set long press pop-up option callback new CommonItemListener("OK") { @Override - public boolean onClick(View v, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { + public boolean onClick(View v, TextView tv, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { StringBuilder builder = new StringBuilder(); builder.append("you selected:\n"); for (FileBean fileBean : selectedFiles) { @@ -278,7 +278,7 @@ PathSelectFragment selector = PathSelector.build(this, MConstants.BUILD_DIALOG) }, new CommonItemListener("cancel") { @Override - public boolean onClick(View v, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { + public boolean onClick(View v, TextView tv, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { pathSelectFragment.openCloseMultipleMode(false); return false; } @@ -304,7 +304,7 @@ PathSelectFragment selector = PathSelector.build(this, MConstants.BUILD_DIALOG) //R.drawable.ic_test_mlh is your own image resource id new CommonItemListener(new FontBean("OK", 18, Color.RED, R.drawable.ic_test_mlh)) { @Override - public boolean onClick(View v, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { + public boolean onClick(View v, TextView tv, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { Mtools.toast("You Click"); return false; } @@ -335,7 +335,7 @@ PathSelectFragment selector = PathSelector.build(this, MConstants.BUILD_DIALOG) } @Override - public boolean onClick(View v, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { + public boolean onClick(View v, TextView tv, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { Mtools.toast("You Click"); return false; } @@ -509,4 +509,20 @@ PathSelectFragment selector = PathSelector.build(this, MConstants.BUILD_DIALOG) Open source projects and their dependencies. -### [LICENSE ](https://github.com/molihuan/mlhfileselectorlib/blob/master/LICENSE) +### LICENSE + +``` + Copyright [2020] molihuan + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +``` diff --git a/app/release/app-release.apk b/app/release/app-release.apk index 631ab75..ad1f9c7 100644 Binary files a/app/release/app-release.apk and b/app/release/app-release.apk differ diff --git a/app/src/main/java/com/molihuan/pathselectdemo/activity/MainActivity.java b/app/src/main/java/com/molihuan/pathselectdemo/activity/MainActivity.java index 25e59d3..633072c 100644 --- a/app/src/main/java/com/molihuan/pathselectdemo/activity/MainActivity.java +++ b/app/src/main/java/com/molihuan/pathselectdemo/activity/MainActivity.java @@ -5,6 +5,7 @@ import android.os.Bundle; import android.view.View; import android.widget.Button; +import android.widget.TextView; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; @@ -124,18 +125,16 @@ private void dialogSelectShow() { .setMorePopupItemListeners( new CommonItemListener("SelectAll") { @Override - public boolean onClick(View v, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { + public boolean onClick(View v, TextView tv, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { /**取消dialog弹窗 - * pathSelectFragment.getSelectConfigData().buildController.getDialogFragment().dismiss(); + * pathSelectFragment.dismiss(); */ - - //pathSelectFragment.selectAllFile(true); return false; } }, new CommonItemListener("DeselectAll") { @Override - public boolean onClick(View v, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { + public boolean onClick(View v, TextView tv, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { pathSelectFragment.selectAllFile(false); return false; } @@ -144,7 +143,7 @@ public boolean onClick(View v, List selectedFiles, String currentPath, .setHandleItemListeners( new CommonItemListener("OK") { @Override - public boolean onClick(View v, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { + public boolean onClick(View v, TextView tv, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { StringBuilder builder = new StringBuilder(); builder.append("you selected:\n"); for (FileBean fileBean : selectedFiles) { @@ -156,8 +155,9 @@ public boolean onClick(View v, List selectedFiles, String currentPath, }, new CommonItemListener("cancel") { @Override - public boolean onClick(View v, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { + public boolean onClick(View v, TextView tv, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { pathSelectFragment.openCloseMultipleMode(false); + return false; } } @@ -180,7 +180,7 @@ private void fragmentSelectShow() { .setMorePopupItemListeners( new CommonItemListener("SelectAll") { @Override - public boolean onClick(View v, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { + public boolean onClick(View v, TextView tv, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { pathSelectFragment.selectAllFile(true); @@ -189,7 +189,7 @@ public boolean onClick(View v, List selectedFiles, String currentPath, }, new CommonItemListener("DeselectAll") { @Override - public boolean onClick(View v, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { + public boolean onClick(View v, TextView tv, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { pathSelectFragment.selectAllFile(false); return false; } @@ -198,7 +198,7 @@ public boolean onClick(View v, List selectedFiles, String currentPath, .setHandleItemListeners( new CommonItemListener("OK") { @Override - public boolean onClick(View v, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { + public boolean onClick(View v, TextView tv, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { StringBuilder builder = new StringBuilder(); builder.append("you selected:\n"); for (FileBean fileBean : selectedFiles) { @@ -210,7 +210,7 @@ public boolean onClick(View v, List selectedFiles, String currentPath, }, new CommonItemListener("cancel") { @Override - public boolean onClick(View v, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { + public boolean onClick(View v, TextView tv, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { pathSelectFragment.openCloseMultipleMode(false); return false; } @@ -231,7 +231,7 @@ private void activitySelectShow() { .setMorePopupItemListeners( new CommonItemListener("SelectAll") { @Override - public boolean onClick(View v, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { + public boolean onClick(View v, TextView tv, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { pathSelectFragment.selectAllFile(true); @@ -240,7 +240,7 @@ public boolean onClick(View v, List selectedFiles, String currentPath, }, new CommonItemListener("DeselectAll") { @Override - public boolean onClick(View v, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { + public boolean onClick(View v, TextView tv, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { pathSelectFragment.selectAllFile(false); return false; } @@ -249,7 +249,7 @@ public boolean onClick(View v, List selectedFiles, String currentPath, .setHandleItemListeners( new CommonItemListener("OK") { @Override - public boolean onClick(View v, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { + public boolean onClick(View v, TextView tv, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { StringBuilder builder = new StringBuilder(); builder.append("you selected:\n"); for (FileBean fileBean : selectedFiles) { @@ -262,7 +262,7 @@ public boolean onClick(View v, List selectedFiles, String currentPath, }, new CommonItemListener("cancel") { @Override - public boolean onClick(View v, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { + public boolean onClick(View v, TextView tv, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { pathSelectFragment.openCloseMultipleMode(false); return false; } @@ -312,14 +312,14 @@ public boolean onClick(View v, FileBean file, String currentPath, BasePathSelect .setMorePopupItemListeners(//设置右上角选项回调 new CommonItemListener("SelectAll") { @Override - public boolean onClick(View v, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { + public boolean onClick(View v, TextView tv, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { pathSelectFragment.selectAllFile(true); return false; } }, new CommonItemListener("DeselectAll") { @Override - public boolean onClick(View v, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { + public boolean onClick(View v, TextView tv, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { pathSelectFragment.selectAllFile(false); return false; } @@ -328,7 +328,7 @@ public boolean onClick(View v, List selectedFiles, String currentPath, .setHandleItemListeners(//设置长按弹出选项回调 new CommonItemListener("OK") { @Override - public boolean onClick(View v, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { + public boolean onClick(View v, TextView tv, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { StringBuilder builder = new StringBuilder(); builder.append("you selected:\n"); for (FileBean fileBean : selectedFiles) { @@ -340,7 +340,7 @@ public boolean onClick(View v, List selectedFiles, String currentPath, }, new CommonItemListener("cancel") { @Override - public boolean onClick(View v, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { + public boolean onClick(View v, TextView tv, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { pathSelectFragment.openCloseMultipleMode(false); return false; } diff --git a/pathselector/src/main/java/com/molihuan/pathselector/entity/FontBean.java b/pathselector/src/main/java/com/molihuan/pathselector/entity/FontBean.java index 4a97845..dcf50f8 100644 --- a/pathselector/src/main/java/com/molihuan/pathselector/entity/FontBean.java +++ b/pathselector/src/main/java/com/molihuan/pathselector/entity/FontBean.java @@ -13,31 +13,31 @@ * @Description: 字---样式实体 */ public class FontBean implements Serializable { - private String text;//文本 + private CharSequence text;//文本 private Integer size;//大小 private Integer color;//颜色 private Integer leftIcoResId;//左边图片资源id - public FontBean(String text) { + public FontBean(CharSequence text) { this(text, 18); } - public FontBean(String text, Integer size) { + public FontBean(CharSequence text, Integer size) { this(text, size, Color.BLACK); } - public FontBean(String text, Integer size, Integer color) { + public FontBean(CharSequence text, Integer size, Integer color) { this(text, size, color, null); } - public FontBean(String text, Integer size, Integer color, @DrawableRes Integer leftIcoResId) { + public FontBean(CharSequence text, Integer size, Integer color, @DrawableRes Integer leftIcoResId) { this.text = text; this.size = size; this.color = color; this.leftIcoResId = leftIcoResId; } - public String getText() { + public CharSequence getText() { return text; } diff --git a/pathselector/src/main/java/com/molihuan/pathselector/fragment/AbstractHandleFragment.java b/pathselector/src/main/java/com/molihuan/pathselector/fragment/AbstractHandleFragment.java index 6d27e32..d857ad1 100644 --- a/pathselector/src/main/java/com/molihuan/pathselector/fragment/AbstractHandleFragment.java +++ b/pathselector/src/main/java/com/molihuan/pathselector/fragment/AbstractHandleFragment.java @@ -2,9 +2,13 @@ import androidx.annotation.CallSuper; +import com.molihuan.pathselector.adapter.HandleListAdapter; import com.molihuan.pathselector.interfaces.IHandleFragment; +import com.molihuan.pathselector.listener.CommonItemListener; import com.molihuan.pathselector.utils.MConstants; +import java.util.List; + /** * @ClassName: AbstractHandleFragment * @Author: molihuan @@ -19,4 +23,19 @@ public abstract class AbstractHandleFragment extends AbstractFragment implements public void initData() { psf = (BasePathSelectFragment) mConfigData.fragmentManager.findFragmentByTag(MConstants.TAG_ACTIVITY_FRAGMENT); } + + @Override + public List getHandleItemListeners() { + return null; + } + + @Override + public HandleListAdapter getHandleListAdapter() { + return null; + } + + @Override + public void refreshHandleList() { + + } } diff --git a/pathselector/src/main/java/com/molihuan/pathselector/fragment/AbstractTabbarFragment.java b/pathselector/src/main/java/com/molihuan/pathselector/fragment/AbstractTabbarFragment.java index d59166d..65d13c8 100644 --- a/pathselector/src/main/java/com/molihuan/pathselector/fragment/AbstractTabbarFragment.java +++ b/pathselector/src/main/java/com/molihuan/pathselector/fragment/AbstractTabbarFragment.java @@ -2,9 +2,13 @@ import androidx.annotation.CallSuper; +import com.molihuan.pathselector.adapter.TabbarListAdapter; +import com.molihuan.pathselector.entity.TabbarFileBean; import com.molihuan.pathselector.interfaces.ITabbarFragment; import com.molihuan.pathselector.utils.MConstants; +import java.util.List; + /** * @ClassName: AbstractTabbarFragment * @Author: molihuan @@ -19,4 +23,24 @@ public abstract class AbstractTabbarFragment extends AbstractFragment implements public void initData() { psf = (BasePathSelectFragment) mConfigData.fragmentManager.findFragmentByTag(MConstants.TAG_ACTIVITY_FRAGMENT); } + + @Override + public TabbarListAdapter getTabbarListAdapter() { + return null; + } + + @Override + public List getTabbarList() { + return null; + } + + @Override + public List updateTabbarList() { + return null; + } + + @Override + public void refreshTabbarList() { + + } } diff --git a/pathselector/src/main/java/com/molihuan/pathselector/fragment/AbstractTitlebarFragment.java b/pathselector/src/main/java/com/molihuan/pathselector/fragment/AbstractTitlebarFragment.java index 004c41e..2b57f99 100644 --- a/pathselector/src/main/java/com/molihuan/pathselector/fragment/AbstractTitlebarFragment.java +++ b/pathselector/src/main/java/com/molihuan/pathselector/fragment/AbstractTitlebarFragment.java @@ -1,10 +1,16 @@ package com.molihuan.pathselector.fragment; +import android.widget.TextView; + import androidx.annotation.CallSuper; +import com.molihuan.pathselector.adapter.MorePopupAdapter; import com.molihuan.pathselector.interfaces.ITitlebarFragment; +import com.molihuan.pathselector.listener.CommonItemListener; import com.molihuan.pathselector.utils.MConstants; +import java.util.List; + /** * @ClassName: AbstractTitlebarFragment * @Author: molihuan @@ -20,4 +26,24 @@ public abstract class AbstractTitlebarFragment extends AbstractFragment implemen public void initData() { psf = (BasePathSelectFragment) mConfigData.fragmentManager.findFragmentByTag(MConstants.TAG_ACTIVITY_FRAGMENT); } + + @Override + public MorePopupAdapter getMorePopupAdapter() { + return null; + } + + @Override + public List getMorePopupItemListeners() { + return null; + } + + @Override + public void refreshMorePopup() { + + } + + @Override + public TextView getOnlyOneMorePopupTextView() { + return null; + } } diff --git a/pathselector/src/main/java/com/molihuan/pathselector/fragment/BasePathSelectFragment.java b/pathselector/src/main/java/com/molihuan/pathselector/fragment/BasePathSelectFragment.java index a91bf9f..a595d94 100644 --- a/pathselector/src/main/java/com/molihuan/pathselector/fragment/BasePathSelectFragment.java +++ b/pathselector/src/main/java/com/molihuan/pathselector/fragment/BasePathSelectFragment.java @@ -1,5 +1,8 @@ package com.molihuan.pathselector.fragment; +import android.app.Dialog; + +import com.molihuan.pathselector.controller.impl.DialogController; import com.molihuan.pathselector.dao.SelectConfigData; import com.molihuan.pathselector.interfaces.IFileShowFragment; import com.molihuan.pathselector.interfaces.IHandleFragment; @@ -14,13 +17,38 @@ * @Description: 拥有了她就拥有了它就拥有了全世界(具体方法可以看她的实现类或者她的接口) */ public abstract class BasePathSelectFragment extends AbstractFragment implements IFileShowFragment, IHandleFragment, ITabbarFragment, ITitlebarFragment { + + public abstract void returnDataToActivityResult(); + + public abstract SelectConfigData getSelectConfigData(); + + public abstract AbstractTitlebarFragment getTitlebarFragment(); + + public abstract AbstractTabbarFragment getTabbarFragment(); + + public abstract AbstractFileShowFragment getFileShowFragment(); + + public abstract AbstractHandleFragment getHandleFragment(); + public abstract IFileDataManager getPathFileManager(); public abstract IFileDataManager getUriFileManager(); - public abstract void returnDataToActivityResult(); + @Override + public void dismiss() { + if (mConfigData.buildController instanceof DialogController) { + mConfigData.buildController.getDialogFragment().dismiss(); + } + } + + @Override + public Dialog getDialog() { + if (mConfigData.buildController instanceof DialogController) { + return mConfigData.buildController.getDialogFragment().getDialog(); + } + return null; + } - public abstract SelectConfigData getSelectConfigData(); /** * 显示或隐藏handleFragment diff --git a/pathselector/src/main/java/com/molihuan/pathselector/fragment/impl/FileShowFragment.java b/pathselector/src/main/java/com/molihuan/pathselector/fragment/impl/FileShowFragment.java index b333032..30a9ea1 100644 --- a/pathselector/src/main/java/com/molihuan/pathselector/fragment/impl/FileShowFragment.java +++ b/pathselector/src/main/java/com/molihuan/pathselector/fragment/impl/FileShowFragment.java @@ -206,6 +206,11 @@ public void onTaskChainCompleted(@NonNull ITaskChainEngine engine, @NonNull ITas return allFileList; } + @Override + public void refreshFileList() { + pathFileManager.refreshFileTabbar(fileListAdapter, psf.getTabbarListAdapter(), PathFileManager.TYPE_REFRESH_FILE_TABBAR); + } + @Override public FileListAdapter getFileListAdapter() { return this.fileListAdapter; diff --git a/pathselector/src/main/java/com/molihuan/pathselector/fragment/impl/HandleFragment.java b/pathselector/src/main/java/com/molihuan/pathselector/fragment/impl/HandleFragment.java index 0fb0bda..26e5d9c 100644 --- a/pathselector/src/main/java/com/molihuan/pathselector/fragment/impl/HandleFragment.java +++ b/pathselector/src/main/java/com/molihuan/pathselector/fragment/impl/HandleFragment.java @@ -1,6 +1,8 @@ package com.molihuan.pathselector.fragment.impl; +import android.annotation.SuppressLint; import android.view.View; +import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.LinearLayoutManager; @@ -17,7 +19,8 @@ import com.molihuan.pathselector.listener.CommonItemListener; import com.molihuan.pathselector.utils.MConstants; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; /** * @ClassName: HandleFragment @@ -28,10 +31,11 @@ public class HandleFragment extends AbstractHandleFragment implements OnItemClickListener, OnItemLongClickListener { protected RecyclerView mRecView; + protected TextView handleItemTv; + protected List handleItemListeners; //选项列表 + protected HandleListAdapter handleListAdapter; //选项适配器 - protected CommonItemListener[] itemListeners; //选项数组 - protected HandleListAdapter handleListAdapter; //适配器 protected FontBean fontBean; //字样式 protected boolean isDialogBuild; //是否是dialog模式 @@ -50,8 +54,17 @@ public void getComponents(View view) { public void initData() { super.initData(); - itemListeners = mConfigData.handleItemListeners; - fontBean = itemListeners[0].getFontBean();//只需要一份样式 + //将监听回调列表转换为数组 + if (handleItemListeners == null) { + handleItemListeners = new ArrayList<>(); + fontBean = mConfigData.handleItemListeners[0].getFontBean();//只需要一份样式 + if (mConfigData.handleItemListeners != null) { + for (CommonItemListener listener : mConfigData.handleItemListeners) { + handleItemListeners.add(listener); + } + } + + } if (mConfigData.buildType == MConstants.BUILD_DIALOG) { isDialogBuild = true; @@ -68,11 +81,11 @@ public void initView() { @Override public void onGetSize(View view) { //计算 mRecView item宽度 - int width = view.getMeasuredWidth() / itemListeners.length; + int width = view.getMeasuredWidth() / handleItemListeners.size(); //设置适配器 mRecView.setLayoutManager(new LinearLayoutManager(mActivity, LinearLayoutManager.HORIZONTAL, false)); //TODO Arrays.asList 返回的类型不是 java.util.ArrayList 而是 java.util.Arrays.ArrayList 返回的 ArrayList 对象是只读的 - handleListAdapter = new HandleListAdapter(R.layout.item_handle_mlh, Arrays.asList(itemListeners), width); + handleListAdapter = new HandleListAdapter(R.layout.item_handle_mlh, handleItemListeners, width); mRecView.setAdapter(handleListAdapter); handleListAdapter.setOnItemClickListener(HandleFragment.this); handleListAdapter.setOnItemLongClickListener(HandleFragment.this); @@ -86,10 +99,27 @@ public void setListeners() { } + @Override + public List getHandleItemListeners() { + return handleItemListeners; + } + + @Override + public HandleListAdapter getHandleListAdapter() { + return handleListAdapter; + } + + @SuppressLint("NotifyDataSetChanged") + @Override + public void refreshHandleList() { + handleListAdapter.notifyDataSetChanged(); + } + @Override public void onItemClick(@NonNull BaseQuickAdapter adapter, @NonNull View v, int position) { if (adapter instanceof HandleListAdapter) { - optionItemClick(v, position); + handleItemTv = v.findViewById(R.id.item_handle_tv_mlh); + optionItemClick(v, handleItemTv, position); } } @@ -99,8 +129,9 @@ public void onItemClick(@NonNull BaseQuickAdapter adapter, @NonNull View v * @param v 点击的视图 * @param i 点击的索引 */ - protected void optionItemClick(View v, int i) { - itemListeners[i].onClick(v, + protected void optionItemClick(View v, TextView tv, int i) { + handleItemListeners.get(i).onClick(v, + tv, psf.getSelectedFileList(), psf.getCurrentPath(), psf @@ -111,7 +142,8 @@ protected void optionItemClick(View v, int i) { @Override public boolean onItemLongClick(@NonNull BaseQuickAdapter adapter, @NonNull View v, int position) { if (adapter instanceof HandleListAdapter) { - return optionItemLongClick(v, position); + handleItemTv = v.findViewById(R.id.item_handle_tv_mlh); + return optionItemLongClick(v, handleItemTv, position); } return false; @@ -123,8 +155,9 @@ public boolean onItemLongClick(@NonNull BaseQuickAdapter adapter, @NonNull * @param v 点击的视图 * @param i 点击的索引 */ - protected boolean optionItemLongClick(View v, int i) { - return itemListeners[i].onLongClick(v, + protected boolean optionItemLongClick(View v, TextView tv, int i) { + return handleItemListeners.get(i).onLongClick(v, + tv, psf.getSelectedFileList(), psf.getCurrentPath(), psf diff --git a/pathselector/src/main/java/com/molihuan/pathselector/fragment/impl/PathSelectFragment.java b/pathselector/src/main/java/com/molihuan/pathselector/fragment/impl/PathSelectFragment.java index a687a1f..f90b901 100644 --- a/pathselector/src/main/java/com/molihuan/pathselector/fragment/impl/PathSelectFragment.java +++ b/pathselector/src/main/java/com/molihuan/pathselector/fragment/impl/PathSelectFragment.java @@ -4,6 +4,7 @@ import android.content.Intent; import android.net.Uri; import android.view.View; +import android.widget.TextView; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -12,6 +13,8 @@ import com.hjq.permissions.OnPermissionCallback; import com.molihuan.pathselector.R; import com.molihuan.pathselector.adapter.FileListAdapter; +import com.molihuan.pathselector.adapter.HandleListAdapter; +import com.molihuan.pathselector.adapter.MorePopupAdapter; import com.molihuan.pathselector.adapter.TabbarListAdapter; import com.molihuan.pathselector.configs.PathSelectorConfig; import com.molihuan.pathselector.dao.SelectConfigData; @@ -22,6 +25,7 @@ import com.molihuan.pathselector.fragment.AbstractTabbarFragment; import com.molihuan.pathselector.fragment.AbstractTitlebarFragment; import com.molihuan.pathselector.fragment.BasePathSelectFragment; +import com.molihuan.pathselector.listener.CommonItemListener; import com.molihuan.pathselector.service.IFileDataManager; import com.molihuan.pathselector.service.impl.PathFileManager; import com.molihuan.pathselector.service.impl.UriFileManager; @@ -41,12 +45,13 @@ */ public class PathSelectFragment extends BasePathSelectFragment { + private FragmentManager fragmentManager; + private AbstractTitlebarFragment titlebarFragment; private AbstractTabbarFragment tabbarFragment; private AbstractFileShowFragment fileShowFragment; private AbstractHandleFragment handleFragment; - - private FragmentManager fragmentManager; + //路径管理者 private IFileDataManager pathFileManager; //uri管理者 @@ -107,6 +112,38 @@ public void setListeners() { } + //************************** 自身的属性获取方法 **************************** + @Override + public AbstractTitlebarFragment getTitlebarFragment() { + return titlebarFragment; + } + + @Override + public AbstractTabbarFragment getTabbarFragment() { + return tabbarFragment; + } + + @Override + public AbstractFileShowFragment getFileShowFragment() { + return fileShowFragment; + } + + @Override + public AbstractHandleFragment getHandleFragment() { + return handleFragment; + } + + @Override + public IFileDataManager getPathFileManager() { + return pathFileManager; + } + + @Override + public IFileDataManager getUriFileManager() { + return uriFileManager; + } + + //************************** 其他接口实现(方法的作用请看具体的接口) **************************** @Override public void setInitPath(String initPath) { fileShowFragment.setInitPath(initPath); @@ -137,6 +174,11 @@ public List updateFileList(String currentPath) { return fileShowFragment.updateFileList(currentPath); } + @Override + public void refreshFileList() { + fileShowFragment.refreshFileList(); + } + @Override public FileListAdapter getFileListAdapter() { return fileShowFragment.getFileListAdapter(); @@ -183,15 +225,46 @@ public List updateTabbarList() { } @Override - public IFileDataManager getPathFileManager() { - return pathFileManager; + public void refreshTabbarList() { + tabbarFragment.refreshTabbarList(); } @Override - public IFileDataManager getUriFileManager() { - return uriFileManager; + public List getHandleItemListeners() { + return handleFragment.getHandleItemListeners(); + } + + @Override + public HandleListAdapter getHandleListAdapter() { + return handleFragment.getHandleListAdapter(); } + @Override + public void refreshHandleList() { + handleFragment.refreshHandleList(); + } + + @Override + public MorePopupAdapter getMorePopupAdapter() { + return titlebarFragment.getMorePopupAdapter(); + } + + @Override + public List getMorePopupItemListeners() { + return titlebarFragment.getMorePopupItemListeners(); + } + + @Override + public void refreshMorePopup() { + titlebarFragment.refreshMorePopup(); + } + + @Override + public TextView getOnlyOneMorePopupTextView() { + return titlebarFragment.getOnlyOneMorePopupTextView(); + } + + /** * 返回数据给onActivityResult(int requestCode, int resultCode, Intent data) * 不建议使用,建议在一些按钮点击回调中获取选择的数据 @@ -287,4 +360,6 @@ public void handleShowHide(boolean isShow) { public boolean onBackPressed() { return fileShowFragment.onBackPressed(); } + + } diff --git a/pathselector/src/main/java/com/molihuan/pathselector/fragment/impl/TabbarFragment.java b/pathselector/src/main/java/com/molihuan/pathselector/fragment/impl/TabbarFragment.java index 0e8484c..bb7bb0f 100644 --- a/pathselector/src/main/java/com/molihuan/pathselector/fragment/impl/TabbarFragment.java +++ b/pathselector/src/main/java/com/molihuan/pathselector/fragment/impl/TabbarFragment.java @@ -1,5 +1,6 @@ package com.molihuan.pathselector.fragment.impl; +import android.annotation.SuppressLint; import android.view.View; import android.widget.ImageView; @@ -145,6 +146,12 @@ public void onTaskChainCompleted(@NonNull ITaskChainEngine engine, @NonNull ITas return tabbarList; } + @SuppressLint("NotifyDataSetChanged") + @Override + public void refreshTabbarList() { + tabbarListAdapter.notifyDataSetChanged(); + } + @Override public void onItemClick(@NonNull BaseQuickAdapter adapter, @NonNull View v, int position) { if (adapter instanceof TabbarListAdapter) { diff --git a/pathselector/src/main/java/com/molihuan/pathselector/fragment/impl/TitlebarFragment.java b/pathselector/src/main/java/com/molihuan/pathselector/fragment/impl/TitlebarFragment.java index dd6cf17..4e30218 100644 --- a/pathselector/src/main/java/com/molihuan/pathselector/fragment/impl/TitlebarFragment.java +++ b/pathselector/src/main/java/com/molihuan/pathselector/fragment/impl/TitlebarFragment.java @@ -1,5 +1,6 @@ package com.molihuan.pathselector.fragment.impl; +import android.annotation.SuppressLint; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; @@ -24,7 +25,8 @@ import com.molihuan.pathselector.listener.CommonItemListener; import com.molihuan.pathselector.utils.MConstants; -import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; /** * @ClassName: TitlebarFragment @@ -39,18 +41,22 @@ public class TitlebarFragment extends AbstractTitlebarFragment implements View.O protected ImageView backImgView; //返回按钮 protected ImageView storageImgView; //内存卡按钮 - protected ImageView searchImgView; //搜索按钮 + protected ImageView searchImgView; //搜索按钮 protected ImageView moreImgView; //更多选项 protected TextView mainTitleTv; //主标题 protected TextView subtitleTv; //副标题(跑马灯还没实现) protected TextView oneOptionTv; //一个选项 protected PopupWindow optionsPopup; //选项 PopupWindow + protected MorePopupAdapter morePopupAdapter; //选项 PopupWindow数据适配器 - protected CommonItemListener[] itemListeners; //选项数组 + protected List morePopupItemListeners; //选项列表 + protected FontBean mainTitle; //主标题字样式 protected FontBean subtitle; //副标题字样式 protected boolean isDialogBuild; //是否是dialog模式 + protected TextView morePopupItemTv; + protected SelectStorageDialog selectStorageDialog; @@ -78,7 +84,16 @@ public void initData() { super.initData(); mainTitle = mConfigData.titlebarMainTitle; subtitle = mConfigData.titlebarSubtitleTitle; - itemListeners = mConfigData.morePopupItemListeners; + + //将监听回调列表转换为数组 + if (morePopupItemListeners == null) { + morePopupItemListeners = new ArrayList<>(); + if (mConfigData.morePopupItemListeners != null) { + for (CommonItemListener listener : mConfigData.morePopupItemListeners) { + morePopupItemListeners.add(listener); + } + } + } if (mConfigData.buildType == MConstants.BUILD_DIALOG) { isDialogBuild = true; @@ -123,14 +138,14 @@ protected void setOptions() { storageImgView.setVisibility(View.GONE); } - if (itemListeners == null || itemListeners.length == 0) { + if (morePopupItemListeners == null || morePopupItemListeners.size() == 0) { //没有选项 moreImgView.setVisibility(View.GONE); - } else if (itemListeners.length == 1) { + } else if (morePopupItemListeners.size() == 1) { //一个选项 moreImgView.setVisibility(View.INVISIBLE); oneOptionTv.setVisibility(View.VISIBLE); - FontBean font = itemListeners[0].getFontBean(); + FontBean font = morePopupItemListeners.get(0).getFontBean(); oneOptionTv.setText(font.getText()); oneOptionTv.setTextColor(font.getColor()); @@ -184,7 +199,7 @@ public void onClick(View v) { } else if (id == R.id.tv_one_option_titlebar) { //一个选项按钮 - optionItemClick(v, 0); + optionItemClick(v, (TextView) v, 0); } else if (id == R.id.imgv_seach_titlebar) { //搜索按钮 @@ -209,8 +224,8 @@ protected void showPopupWindow() { optionsPopup.setElevation(3);//设置阴影 (注意阴影穿透---父组件和子组件必须都设置阴影) RecyclerView recyclerView = popView.findViewById(R.id.general_recyclerview_mlh); recyclerView.setLayoutManager(new LinearLayoutManager(mActivity)); - //TODO Arrays.asList 返回的类型不是 java.util.ArrayList 而是 java.util.Arrays.ArrayList 返回的 ArrayList 对象是只读的 - morePopupAdapter = new MorePopupAdapter(R.layout.general_item_tv_mlh, Arrays.asList(itemListeners)); + + morePopupAdapter = new MorePopupAdapter(R.layout.general_item_tv_mlh, morePopupItemListeners); recyclerView.setAdapter(morePopupAdapter); morePopupAdapter.setOnItemClickListener(this);//设置监听 morePopupAdapter.setOnItemLongClickListener(this);//设置监听 @@ -221,10 +236,11 @@ protected void showPopupWindow() { } @Override - public void onItemClick(@NonNull BaseQuickAdapter adapter, @NonNull View view, int i) { + public void onItemClick(@NonNull BaseQuickAdapter adapter, @NonNull View v, int i) { if (adapter instanceof MorePopupAdapter) { optionsPopup.dismiss(); - optionItemClick(view, i); + morePopupItemTv = v.findViewById(R.id.general_item_textview_mlh); + optionItemClick(v, mainTitleTv, i); } } @@ -234,8 +250,9 @@ public void onItemClick(@NonNull BaseQuickAdapter adapter, @NonNull View v * @param v 点击的视图 * @param i 点击的索引 */ - protected void optionItemClick(View v, int i) { - itemListeners[i].onClick(v, + protected void optionItemClick(View v, TextView tv, int i) { + morePopupItemListeners.get(i).onClick(v, + tv, psf.getSelectedFileList(), psf.getCurrentPath(), psf @@ -245,7 +262,8 @@ protected void optionItemClick(View v, int i) { @Override public boolean onItemLongClick(@NonNull BaseQuickAdapter adapter, @NonNull View v, int position) { if (adapter instanceof MorePopupAdapter) { - return optionItemLongClick(v, position); + morePopupItemTv = v.findViewById(R.id.general_item_textview_mlh); + return optionItemLongClick(v, morePopupItemTv, position); } return false; @@ -257,11 +275,33 @@ public boolean onItemLongClick(@NonNull BaseQuickAdapter adapter, @NonNull * @param v 点击的视图 * @param i 点击的索引 */ - protected boolean optionItemLongClick(View v, int i) { - return itemListeners[i].onLongClick(v, + protected boolean optionItemLongClick(View v, TextView tv, int i) { + return morePopupItemListeners.get(i).onLongClick(v, + tv, psf.getSelectedFileList(), psf.getCurrentPath(), psf ); } + + @Override + public MorePopupAdapter getMorePopupAdapter() { + return morePopupAdapter; + } + + @Override + public List getMorePopupItemListeners() { + return morePopupItemListeners; + } + + @SuppressLint("NotifyDataSetChanged") + @Override + public void refreshMorePopup() { + morePopupAdapter.notifyDataSetChanged(); + } + + @Override + public TextView getOnlyOneMorePopupTextView() { + return this.oneOptionTv; + } } diff --git a/pathselector/src/main/java/com/molihuan/pathselector/interfaces/IFileShowFragment.java b/pathselector/src/main/java/com/molihuan/pathselector/interfaces/IFileShowFragment.java index 17e03c5..7e64985 100644 --- a/pathselector/src/main/java/com/molihuan/pathselector/interfaces/IFileShowFragment.java +++ b/pathselector/src/main/java/com/molihuan/pathselector/interfaces/IFileShowFragment.java @@ -38,7 +38,7 @@ public interface IFileShowFragment { List getFileList(); /** - * 刷新当前路径 + * 更新当前路径 * * @return */ @@ -52,6 +52,14 @@ public interface IFileShowFragment { */ List updateFileList(String currentPath); + /** + * 更新ui + * + * @return + */ + void refreshFileList(); + + /** * 获取FileListAdapter * diff --git a/pathselector/src/main/java/com/molihuan/pathselector/interfaces/IHandleFragment.java b/pathselector/src/main/java/com/molihuan/pathselector/interfaces/IHandleFragment.java index ec180b8..4e4cbf8 100644 --- a/pathselector/src/main/java/com/molihuan/pathselector/interfaces/IHandleFragment.java +++ b/pathselector/src/main/java/com/molihuan/pathselector/interfaces/IHandleFragment.java @@ -1,5 +1,10 @@ package com.molihuan.pathselector.interfaces; +import com.molihuan.pathselector.adapter.HandleListAdapter; +import com.molihuan.pathselector.listener.CommonItemListener; + +import java.util.List; + /** * @ClassName: AbstractHandleFragment * @Author: molihuan @@ -7,4 +12,14 @@ * @Description: 底部按钮显示的Fragment */ public interface IHandleFragment { + List getHandleItemListeners(); + + HandleListAdapter getHandleListAdapter(); + + /** + * 刷新 HandleList ui + * + * @return + */ + void refreshHandleList(); } diff --git a/pathselector/src/main/java/com/molihuan/pathselector/interfaces/ITabbarFragment.java b/pathselector/src/main/java/com/molihuan/pathselector/interfaces/ITabbarFragment.java index b03ef7b..634272a 100644 --- a/pathselector/src/main/java/com/molihuan/pathselector/interfaces/ITabbarFragment.java +++ b/pathselector/src/main/java/com/molihuan/pathselector/interfaces/ITabbarFragment.java @@ -19,4 +19,11 @@ public interface ITabbarFragment { List updateTabbarList(); + /** + * 刷新 TabbarList ui + * + * @return + */ + void refreshTabbarList(); + } diff --git a/pathselector/src/main/java/com/molihuan/pathselector/interfaces/ITitlebarFragment.java b/pathselector/src/main/java/com/molihuan/pathselector/interfaces/ITitlebarFragment.java index aa5862b..dd9769a 100644 --- a/pathselector/src/main/java/com/molihuan/pathselector/interfaces/ITitlebarFragment.java +++ b/pathselector/src/main/java/com/molihuan/pathselector/interfaces/ITitlebarFragment.java @@ -1,5 +1,12 @@ package com.molihuan.pathselector.interfaces; +import android.widget.TextView; + +import com.molihuan.pathselector.adapter.MorePopupAdapter; +import com.molihuan.pathselector.listener.CommonItemListener; + +import java.util.List; + /** * @ClassName: AbstractTitlebarFragment * @Author: molihuan @@ -7,6 +14,24 @@ * @Description: 标题区域 Fragment */ public interface ITitlebarFragment { + MorePopupAdapter getMorePopupAdapter(); + + List getMorePopupItemListeners(); + + /** + * 刷新 MorePopup ui + * + * @return + */ + void refreshMorePopup(); + /** + * 此方法只适用仅仅设置了一个morePopup即setMorePopupItemListeners()中只设置了一个 + * 当只设置了一个MorePopupItem就会返回这个设置的TextView + * 当设置了多个则返回的TextView是隐藏的不建议操作 + * + * @return + */ + TextView getOnlyOneMorePopupTextView(); } diff --git a/pathselector/src/main/java/com/molihuan/pathselector/listener/BaseItemListener.java b/pathselector/src/main/java/com/molihuan/pathselector/listener/BaseItemListener.java index 04253db..e54022b 100644 --- a/pathselector/src/main/java/com/molihuan/pathselector/listener/BaseItemListener.java +++ b/pathselector/src/main/java/com/molihuan/pathselector/listener/BaseItemListener.java @@ -11,7 +11,7 @@ public class BaseItemListener { protected FontBean fontBean; - public BaseItemListener(String text) { + public BaseItemListener(CharSequence text) { fontBean = new FontBean(text); } diff --git a/pathselector/src/main/java/com/molihuan/pathselector/listener/CommonItemListener.java b/pathselector/src/main/java/com/molihuan/pathselector/listener/CommonItemListener.java index 9da68ad..134ccdb 100644 --- a/pathselector/src/main/java/com/molihuan/pathselector/listener/CommonItemListener.java +++ b/pathselector/src/main/java/com/molihuan/pathselector/listener/CommonItemListener.java @@ -21,11 +21,11 @@ public abstract class CommonItemListener extends BaseItemListener { //是否离开返回 protected Boolean needReturnNow; - public CommonItemListener(String text) { + public CommonItemListener(CharSequence text) { this(text, false); } - public CommonItemListener(String text, Boolean needReturnNow) { + public CommonItemListener(CharSequence text, Boolean needReturnNow) { super(text); this.needReturnNow = needReturnNow; } @@ -59,14 +59,15 @@ public boolean setViewStyle(RelativeLayout container, ImageView leftImg, TextVie /** * 重写此方法可以进行回调 * - * @param v 点击的视图 + * @param v 点击的总视图(即视图容器) + * @param tv 从总视图中findViewById拿到的TextView(其他视图的获取也可以参照此思路) * @param selectedFiles 选择的fileBean * @param currentPath 当前路径 * @return */ - public abstract boolean onClick(View v, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment); + public abstract boolean onClick(View v, TextView tv, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment); - public boolean onLongClick(View v, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { + public boolean onLongClick(View v, TextView tv, List selectedFiles, String currentPath, BasePathSelectFragment pathSelectFragment) { return false; } diff --git a/pathselector/src/main/java/com/molihuan/pathselector/listener/FileItemListener.java b/pathselector/src/main/java/com/molihuan/pathselector/listener/FileItemListener.java index 36bc31e..2b1576c 100644 --- a/pathselector/src/main/java/com/molihuan/pathselector/listener/FileItemListener.java +++ b/pathselector/src/main/java/com/molihuan/pathselector/listener/FileItemListener.java @@ -20,7 +20,7 @@ public FileItemListener() { /** * 点击回调 * - * @param v 点击的视图(更新UI) + * @param v 点击的总视图(即视图容器,可以通过findViewById拿到其他视图)(更新UI) * @param file 文件实体(可以获取DocumentFile操作Android/data目录) * @param currentPath 当前路径 * @return 不需要进行下一步处理则返回true, 一般都需要返回false @@ -28,7 +28,7 @@ public FileItemListener() { public abstract boolean onClick(View v, FileBean file, String currentPath, BasePathSelectFragment pathSelectFragment); /** - * @param v + * @param v 点击的总视图(即视图容器)(更新UI) * @param file * @param currentPath * @return 不需要进行下一步处理则返回true, 一般都需要返回false, 并不是已经处理完了不让单击监听处理,特别注意 diff --git a/pathselector/src/main/java/com/molihuan/pathselector/utils/Mtools.java b/pathselector/src/main/java/com/molihuan/pathselector/utils/Mtools.java index ad335e7..9a3c95c 100644 --- a/pathselector/src/main/java/com/molihuan/pathselector/utils/Mtools.java +++ b/pathselector/src/main/java/com/molihuan/pathselector/utils/Mtools.java @@ -32,15 +32,15 @@ public static void toast(Context context, String text) { toast(context, text, Toast.LENGTH_SHORT); } - public static void toast(String text) { + public static void toast(CharSequence text) { toast(text, Toast.LENGTH_SHORT); } - - public static void toast(String text, int time) { + + public static void toast(CharSequence text, int time) { toast(ReflectTools.getApplicationByReflect(), text, time); } - public static void toast(Context context, String text, int time) { + public static void toast(Context context, CharSequence text, int time) { // if (!debug) { // return; // }