From 55812e1794d43575f9d5b588f527418049a8f474 Mon Sep 17 00:00:00 2001 From: molihuan <1492906929@qq.com> Date: Tue, 27 Dec 2022 16:57:15 +0800 Subject: [PATCH] :fire:Fix fragment mode shows replacement bugs and optimization details --- .idea/deploymentTargetDropDown.xml | 17 ------------ README.md | 6 +++-- README_EN.md | 8 ++++-- .../pathselectdemo/activity/MainActivity.java | 22 +++++++++++++-- app/src/main/res/layout/activity_main.xml | 8 ++++++ pathselector/build.gradle | 4 +-- .../configs/PathSelectorConfig.java | 6 +++++ .../controller/impl/FragmentController.java | 23 ++++------------ .../pathselector/dao/SelectConfigData.java | 3 +-- .../fragment/impl/PathSelectFragment.java | 24 +++++++++++++++-- .../pathselector/utils/FragmentTools.java | 22 +++++++++++++++ .../molihuan/pathselector/utils/Mtools.java | 6 ++++- .../pathselector/utils/PermissionsTools.java | 27 ++++++++++++++----- 13 files changed, 121 insertions(+), 55 deletions(-) delete mode 100644 .idea/deploymentTargetDropDown.xml diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml deleted file mode 100644 index ac6bf40..0000000 --- a/.idea/deploymentTargetDropDown.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/README.md b/README.md index 9a3b257..7268dc3 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ ## 特性 -- [x] 自动申请存储权限 +- [x] 自动申请存储权限(可以控制) - [x] 安卓 4.4 ~ 13 - [x] Android/data和Android/obb目录访问和操作 - [x] SD卡 @@ -39,6 +39,8 @@ #### 在开始之前可以给项目一个Star吗?非常感谢,你的支持是我唯一的动力。欢迎Star和Issues! +#### 欢迎Pr,请Pr提交到dev分支 + #### 项目地址: ##### [Github地址](https://github.com/molihuan/mlhfileselectorlib) ##### [Gitee地址](https://gitee.com/molihuan/mlhfileselectorlib) @@ -88,7 +90,7 @@ dependencyResolutionManagement { ```java dependencies { ... - // 请将"版本"替换成具体的版本号,如 1.1.3 + // 请将"版本"替换成具体的版本号,如 1.1.7 implementation 'io.github.molihuan:pathselector:版本' } ``` diff --git a/README_EN.md b/README_EN.md index e18a2a9..2307755 100644 --- a/README_EN.md +++ b/README_EN.md @@ -21,13 +21,15 @@ Automatically apply storage permission, support Android4.4 ~ 13, no longer need ## Characteristics -- [x] Automatically request storage permissions +- [x] Automatically request storage permissions(Can control) - [x] Android 4.4 ~ 13 - [x] Android/data and Android/obb directory access and manipulation - [x] SD Card - [x] Highly customizable UI - [x] Internationalization - [ ] Search function +- [ ] Custom icon +- [ ] Show hidden files ## Language(语言) @@ -37,6 +39,8 @@ Automatically apply storage permission, support Android4.4 ~ 13, no longer need #### Can you give the project a Star before starting? Thank you very much, your support is the only thing that keeps me going. Welcome Star and Issues! +#### Welcome to Pr, please submit to the dev branch + #### Project Address: ##### [Github](https://github.com/molihuan/mlhfileselectorlib) ##### [Gitee](https://gitee.com/molihuan/mlhfileselectorlib) @@ -86,7 +90,7 @@ dependencyResolutionManagement { ```java dependencies { ... - // Please replace "version" with a specific version number, e.g. 1.1.2 + // Please replace "version" with a specific version number, e.g. 1.1.7 implementation 'io.github.molihuan:pathselector:version' } ``` 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 200e98d..25e59d3 100644 --- a/app/src/main/java/com/molihuan/pathselectdemo/activity/MainActivity.java +++ b/app/src/main/java/com/molihuan/pathselectdemo/activity/MainActivity.java @@ -19,6 +19,7 @@ import com.molihuan.pathselector.fragment.impl.PathSelectFragment; import com.molihuan.pathselector.listener.CommonItemListener; import com.molihuan.pathselector.listener.FileItemListener; +import com.molihuan.pathselector.utils.FragmentTools; import com.molihuan.pathselector.utils.MConstants; import com.molihuan.pathselector.utils.Mtools; @@ -37,8 +38,10 @@ public class MainActivity extends AppCompatActivity implements View.OnClickListe private Button btnFragmentSelector; private Button btnDialogSelector; private Button btnCustomSelector; + private Button btnTest; private PathSelectFragment selector; + private long firstBackTime; @Override @@ -57,6 +60,7 @@ private void getComponents() { btnFragmentSelector = findViewById(R.id.btn_fragment_selector); btnDialogSelector = findViewById(R.id.btn_dialog_selector); btnCustomSelector = findViewById(R.id.btn_custom_toolbar_selector); + btnTest = findViewById(R.id.btn_test); } private void initData() { @@ -73,6 +77,7 @@ private void setListeners() { btnFragmentSelector.setOnClickListener(this); btnDialogSelector.setOnClickListener(this); btnCustomSelector.setOnClickListener(this); + btnTest.setOnClickListener(this); } @Override @@ -97,7 +102,14 @@ public void onClick(View v) { case R.id.btn_custom_toolbar_selector: customTitlebarSelectShow(); // t1(); - + break; + case R.id.btn_test: + FragmentTools.fragmentReplace( + getSupportFragmentManager(), + R.id.fragment_select_show_area, + new CustomTitlebarFragment(), + "55" + ); break; } } @@ -117,7 +129,7 @@ public boolean onClick(View v, List selectedFiles, String currentPath, * pathSelectFragment.getSelectConfigData().buildController.getDialogFragment().dismiss(); */ - pathSelectFragment.selectAllFile(true); + //pathSelectFragment.selectAllFile(true); return false; } }, @@ -346,6 +358,12 @@ public void onBackPressed() { return; } + if (System.currentTimeMillis() - firstBackTime > 2000) { + Mtools.toast("再按一次返回键退出程序"); + firstBackTime = System.currentTimeMillis(); + return; + } + super.onBackPressed(); } diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 3b8bacc..9531c9a 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -3,6 +3,13 @@ android:layout_width="match_parent" xmlns:android="http://schemas.android.com/apk/res/android"> +