Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix and limit TabbarFragment path beyond #12

Merged
merged 2 commits into from
Jan 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .idea/deploymentTargetDropDown.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

97 changes: 68 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@



## 语言(Language)

#### **[中文](./README.md)** | [English](./README_EN.md)

## 为什么选择我

自动申请存储权限,支持 Android4.4 ~ 13,再也不用为了适配各种版本而苦恼了,快速集成,一句代码搞定,完善的文档,支持无root权限访问和操作Android/data和Android/obb目录(适配Android 13),支持SD卡,高度自定义UI满足你的所有需求,使用非常灵活,支持国际化,对于Android文件选择你只需要关注你的业务代码即可其他的都交给它。
Expand All @@ -28,13 +32,9 @@
- [x] 高度自定义UI
- [x] 国际化
- [ ] 搜索功能
- [ ] 自定义图标
- [x] 自定义图标
- [ ] 显示隐藏文件

## 语言(Language)

#### **[中文](./README.md)** | [English](./README_EN.md)

## 前言

#### 在开始之前可以给项目一个Star吗?非常感谢,你的支持是我唯一的动力。欢迎Star和Issues!
Expand Down Expand Up @@ -234,7 +234,7 @@ PathSelectFragment selector = PathSelector.build(this, MConstants.BUILD_DIALOG)
.setShowFileTypes("", "mp3", "mp4")//只显示(没有后缀)或(后缀为mp3)或(后缀为mp4)的文件
.setSelectFileTypes("", "mp3")//只能选择(没有后缀)或(后缀为mp3)的文件
.setMaxCount(3)//最多可以选择3个文件,默认是-1不限制
.setRadio()//单选
.setRadio()//单选(如果需要单选文件夹请使用setMaxCount(0)来替换)
.setSortType(MConstants.SORT_NAME_ASC)//按名称排序
.setTitlebarMainTitle(new FontBean("My Selector"))//设置标题栏主标题,还可以设置字体大小,颜色等
.setTitlebarBG(Color.GREEN)//设置标题栏颜色
Expand Down Expand Up @@ -412,34 +412,73 @@ PathSelectFragment selector = PathSelector.build(this, MConstants.BUILD_DIALOG)
.show();
```

#### 3、自定义列表item图标

```java
PathSelectFragment selector = PathSelector.build(this, MConstants.BUILD_DIALOG)
.setFileBeanController(new AbstractFileBeanController() {
@Override
public int getFileBeanImageResource(boolean isDir, String extension, FileBean fileBean) {
int resourceId;
switch (extension) {
case "jpg":
case "jpeg":
case "png":
//开发者自己的图片资源id
resourceId = R.drawable.ic_launcher_foreground;
break;
case "mp3":
resourceId = R.drawable.ic_launcher_foreground;
break;
case "mp4":
//也可以使用默认的图片资源id
resourceId = com.molihuan.pathselector.R.mipmap.movie;
break;
default:
if (isDir) {
//开发者自己的图片资源id
resourceId = R.drawable.ml192;
} else {
resourceId = R.drawable.ic_launcher_background;
}
break;
}
return resourceId;
}
})
.show();
```



## 四、接口与方法(尽量看源码,都写了注释,懒得写文档)

##### IConfigDataBuilder


| 方法 | 注释 | 备注 |
| ------------------------------------------------------------ | ---------------------------- | ----------------------------------------------- |
| setFrameLayoutId(int id) | 设置加载位置FrameLayoutID | 当构建模式为MConstants.BUILD_FRAGMENT时必须设置 |
| setRequestCode(int code) | 设置请求码 | 当构建模式为MConstants.BUILD_ACTIVITY时必须设置 |
| setRootPath(String path) | 设置开始默认路径 | 默认为内部存储根路径 |
| setMaxCount(int maxCount) | 设置最大选择数量 | 不设置默认为-1 即无限 |
| setShowFileTypes(String... fileTypes) | 设置显示文件类型 | 没有后缀请用"" |
| setSelectFileTypes(String... fileTypes) | 设置选择文件类型 | 没有后缀请用"" |
| setSortType(int sortType) | 设置排序规则 | 类型请看MConstants |
| setRadio() | 设置单选 | 默认多选 |
| setShowSelectStorageBtn(boolean var) | 设置是否显示内部存储选择按钮 | 默认true |
| setShowTitlebarFragment(boolean var) | 是否显示标题栏 | 默认true |
| setShowTabbarFragment(boolean var) | 是否显示面包屑 | 默认true |
| setAlwaysShowHandleFragment(boolean var) | 是否总是显示长按弹出选项 | 默认false |
| setTitlebarMainTitle(FontBean titlebarMainTitle) | 设置标题栏主标题 | 还可以设置字体大小,颜色等 |
| setTitlebarBG(Integer titlebarBG) | 设置标题栏背景颜色 | |
| setFileItemListener(FileItemListener fileItemListener) | 设置文件item点击回调 | 点击是文件才会回调,如果点击是文件夹则不会 |
| setMorePopupItemListeners(CommonItemListener... morePopupItemListener) | 设置右上角选项回调 | |
| setHandleItemListeners(CommonItemListener... handleItemListener) | 设置长按弹出选项回调 | |
| setTitlebarFragment(AbstractTitlebarFragment titlebarFragment) | 设置自定义标题栏UI | 自己的Fragment必须继承AbstractTitlebarFragment |
| setHandleFragment(AbstractHandleFragment handleFragment) | 设置长按弹出自定义UI | 自己的Fragment必须继承AbstractHandleFragment |
| start() | 开始构建 | 必须调用 |
| ...... | ...... | |
| 方法 | 作用 | 备注 |
| ------------------------------------------------------------ | ------------------------------------------------------ | ----------------------------------------------- |
| setFrameLayoutId(int id) | 设置加载位置FrameLayoutID | 当构建模式为MConstants.BUILD_FRAGMENT时必须设置 |
| setRequestCode(int code) | 设置请求码 | 当构建模式为MConstants.BUILD_ACTIVITY时必须设置 |
| setRootPath(String path) | 设置开始默认路径 | 默认为内部存储根路径 |
| setMaxCount(int maxCount) | 设置最大选择数量 | 不设置默认为-1 即无限 |
| setShowFileTypes(String... fileTypes) | 设置显示文件类型 | 没有后缀请用"" |
| setSelectFileTypes(String... fileTypes) | 设置选择文件类型 | 没有后缀请用"" |
| setSortType(int sortType) | 设置排序规则 | 类型请看MConstants |
| setRadio() | 设置单选(如果需要单选文件夹请使用setMaxCount(0)来替换) | 默认多选 |
| setShowSelectStorageBtn(boolean var) | 设置是否显示内部存储选择按钮 | 默认true |
| setShowTitlebarFragment(boolean var) | 是否显示标题栏 | 默认true |
| setShowTabbarFragment(boolean var) | 是否显示面包屑 | 默认true |
| setAlwaysShowHandleFragment(boolean var) | 是否总是显示长按弹出选项 | 默认false |
| setTitlebarMainTitle(FontBean titlebarMainTitle) | 设置标题栏主标题 | 还可以设置字体大小,颜色等 |
| setTitlebarBG(Integer titlebarBG) | 设置标题栏背景颜色 | |
| setFileItemListener(FileItemListener fileItemListener) | 设置文件item点击回调 | 点击是文件才会回调,如果点击是文件夹则不会 |
| setMorePopupItemListeners(CommonItemListener... morePopupItemListener) | 设置右上角选项回调 | |
| setHandleItemListeners(CommonItemListener... handleItemListener) | 设置长按弹出选项回调 | |
| setTitlebarFragment(AbstractTitlebarFragment titlebarFragment) | 设置自定义标题栏UI | 自己的Fragment必须继承AbstractTitlebarFragment |
| setHandleFragment(AbstractHandleFragment handleFragment) | 设置长按弹出自定义UI | 自己的Fragment必须继承AbstractHandleFragment |
| start() | 开始构建 | 必须调用 |
| ...... | ...... | |

## 五、!!!特别注意 !!!

Expand Down
49 changes: 42 additions & 7 deletions README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
<p align="center">support custom UI,support SD card.</p>
<p align="center">(The Keyword:file selector operator android/data android 11 android 13)</p>

## Language(语言)

#### **[Chinese](./README.md)** | [English](./README_EN.md)

## Why choose me?

Expand All @@ -28,13 +30,9 @@ Automatically apply storage permission, support Android4.4 ~ 13, no longer need
- [x] Highly customizable UI
- [x] Internationalization
- [ ] Search function
- [ ] Custom icon
- [x] Custom icon
- [ ] Show hidden files

## Language(语言)

#### **[Chinese](./README.md)** | [English](./README_EN.md)

## Preface

#### 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!
Expand Down Expand Up @@ -234,7 +232,7 @@ PathSelectFragment selector = PathSelector.build(this, MConstants.BUILD_DIALOG)
.setShowFileTypes("", "mp3", "mp4")//Show only files with (no suffix) or (mp3 suffix) or (mp4 suffix)
.setSelectFileTypes("", "mp3")//Only files with (no suffix) or (mp3 suffix) can be selected
.setMaxCount(3)//You can select up to 3 files. The default is - 1 unlimited
.setRadio()//Single choice
.setRadio()//Single choice(Use setMaxCount(0) to replace it if you need a single-selected folder)
.setSortType(MConstants.SORT_NAME_ASC)//Sort by name
.setTitlebarMainTitle(new FontBean("My Selector"))//Set the title bar main title, you can also set the font size, color, etc.
.setTitlebarBG(Color.GREEN)//Set the title bar background color
Expand Down Expand Up @@ -412,6 +410,43 @@ PathSelectFragment selector = PathSelector.build(this, MConstants.BUILD_DIALOG)
.show();
```

#### 3、Customize list item icons

```java
PathSelectFragment selector = PathSelector.build(this, MConstants.BUILD_DIALOG)
.setFileBeanController(new AbstractFileBeanController() {
@Override
public int getFileBeanImageResource(boolean isDir, String extension, FileBean fileBean) {
int resourceId;
switch (extension) {
case "jpg":
case "jpeg":
case "png":
//Developer's own image resource id
resourceId = R.drawable.ic_launcher_foreground;
break;
case "mp3":
resourceId = R.drawable.ic_launcher_foreground;
break;
case "mp4":
//You can also use the default image resource id
resourceId = com.molihuan.pathselector.R.mipmap.movie;
break;
default:
if (isDir) {
//Developer's own image resource id
resourceId = R.drawable.ml192;
} else {
resourceId = R.drawable.ic_launcher_background;
}
break;
}
return resourceId;
}
})
.show();
```

## IV.Interface and methods (try to see the source code, are written comments, lazy to write the document)

##### IConfigDataBuilder
Expand All @@ -426,7 +461,7 @@ PathSelectFragment selector = PathSelector.build(this, MConstants.BUILD_DIALOG)
| setShowFileTypes(String... fileTypes) | Set the display file type | No suffix please use "" |
| setSelectFileTypes(String... fileTypes) | Set the selection file type | No suffix please use "" |
| setSortType(int sortType) | Set sorting rules | See MConstants for types |
| setRadio() | Set radio selection | Default Multiple Choice |
| setRadio() | Set radio selection(Use setMaxCount(0) to replace it if you need a single-selected folder) | Default Multiple Choice |
| setShowSelectStorageBtn(boolean var) | Set whether to display the internal storage selection button | Default true |
| setShowTitlebarFragment(boolean var) | Whether to display the title bar | Default true |
| setShowTabbarFragment(boolean var) | Whether to show breadcrumbs | Default true |
Expand Down
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ dependencies {

// implementation fileTree(dir: "../pathselector/build/outputs/aar/", includes: ["*-release.aar", "*.jar"])
// implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:3.0.11'
// implementation 'com.github.getActivity:XXPermissions:16.2'
implementation 'com.github.getActivity:XXPermissions:16.5'

//调试用

Expand Down
Binary file modified app/release/app-release.apk
Binary file not shown.
Loading