LuckSiege / LuckSiege/PictureSelector
cancelTextView怎样在图片单选&点击图片直接返回的模式下隐藏
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 13.6k
- Forks
- 3.1k
- PR merge metrics
- No merged PRs in 30d
Description
## Current use version?
#### 当前使用的版本是多少?
```
3.10.6
```
## Will this problem occur in demo?
#### Demo能否复现这问题?
```
可以
```
## Describe the problem or provide an error log?
#### 描述问题或提供错误log?
```
我想实现TitleBar的cancelTextView在图片单选&点击图片直接返回的模式下隐藏,于是有下面的写法:
val cusTitleStyle = TitleBarStyle().apply {
isHideCancelButton = true
}
val selectorStyle = PictureSelectorStyle().apply {
titleBarStyle = cusTitleStyle
}
PictureSelector.create(context)
.openGallery(SelectMimeType.ofImage())
.setFilterMaxFileSize(ISelector.GLOBAL_MAX_SIZE_KB.toLong())
.setSelectorUIStyle(selectorStyle)
.setCompressEngine(DefaultCompressEngine.create())
.setImageEngine(GlideEngine.create())
.setQueryFilterListener(QueryFilter.create())
.isDisplayCamera(false)
.isDirectReturnSingle(true)
.setCropEngine(ThemeCropFileEngine.create())
.forResult(listener)
但是始终无法生效,后面看了下源码发现isDirectReturnSingle(true)、setSelectionMode(SelectModeConfig.SINGLE) 设置单选后,PictureSelectorFragment中initComplete()有判断:
if (selectorConfig.selectionMode == SelectModeConfig.SINGLE && selectorConfig.isDirectReturnSingle) {
selectorConfig.selectorStyle.getTitleBarStyle().setHideCancelButton(false);
titleBar.getTitleCancelView().setVisibility(View.VISIBLE);
completeSelectView.setVisibility(View.GONE);
}
这个判断使之前的.setSelectorUIStyle(selectorStyle)里设置isHideCancelButton=true失效,且时序永远是initComplete()在后,这样无论PictureSelector.create(context)后续api怎么调都是无效的。
我看了下cancelTextView点击事件实际和返回箭头一致,所以这里可以优化下吗?或者有其他方式提供吗
```
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading PictureSelectorFragment.initComplete() and the TitleBarStyle handling described in the issue. Reproduce single-image direct-return mode with isHideCancelButton enabled, then verify the cancel text view and completion controls match the intended behavior while the existing return action still works.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100