LuckSiege / LuckSiege/PictureSelector

在代码发现了一个代码问题,另想提3个小建议

Open
#2,271 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
13.6k
Forks
3.1k
PR merge metrics
No merged PRs in 30d

Description

## 当前使用的版本是多少?

``` 3.0.3

```

## Demo能否复现这问题?

``` 可

```

## 描述问题或提供错误log?
在 PictureSelectorPreviewFragment 的 648 行到 656 行,多了层判断

```
if (tvSelected.getLayoutParams() instanceof ConstraintLayout.LayoutParams) {
if (tvSelected.getLayoutParams() instanceof ConstraintLayout.LayoutParams) {
ConstraintLayout.LayoutParams layoutParams = (ConstraintLayout.LayoutParams) tvSelected.getLayoutParams();
layoutParams.rightMargin = selectMainStyle.getPreviewSelectMarginRight();
} else if (tvSelected.getLayoutParams() instanceof RelativeLayout.LayoutParams) {
RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) tvSelected.getLayoutParams();
layoutParams.rightMargin = selectMainStyle.getPreviewSelectMarginRight();
}
}
```

建议:
1、可以添加一个换肤的 ISkinDelegate,这样可以从外部获取自定义的换肤实现
2、可以添加只选择的模式,场景:有时候需要选择内容(如需要选择1-9张图片),回传了旧的数据(如网络的数据,或上次选中的数据,通过转换后的 LocalMedia list )这时是不需要对旧的数据进行编辑的,不管数据里面是否有多个重复的内容,只需要处理新选择的内容,
我想到的办法是在 SelectedManager 加一个 回传数据的list,但 selectCount 会 加上这个 list 的size,防止与用户的maxSelectNum 冲突,在最终 onCallBackResult 回调中处理两个list的合并处理
3、第三个应该算是bug吧,在选择到 selectCount -1 张图时点了确定,然后又打开页重新选最后一张时,使用了多手指点击,会出现 selectCount + 手指个数的选中,然后导致出问题,建议在 RecyclerPreloadView 里添加 setMotionEventSplittingEnabled(false)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in PictureSelectorPreviewFragment around lines 648-656 and inspect the nested layout-parameter checks, then review SelectedManager and RecyclerPreloadView for the two additional proposals. Reproduce the reported multi-touch selection case with the provided version and confirm which behavior is intended. Done requires a maintainer decision on the three separate suggestions and verified tests or reproduction results for any accepted change.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.