LuckSiege / LuckSiege/PictureSelector

override `onSelectFilter` function is not working, my plan is to create limit assets for image and video separately.

Open
#2,954 0 comments 0 reactions 0 assignees View on GitHub

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?
#### 当前使用的版本是多少?

```
v3.11.2
```

## Will this problem occur in demo?
#### Demo能否复现这问题?
override `onSelectFilter` function is not working, my plan is to create limit assets for image and video separately.
```
PictureSelector.create(activity)
.openGallery(if (mediaType == "video") SelectMimeType.ofVideo() else if (mediaType == "image") SelectMimeType.ofImage() else SelectMimeType.ofAll())
.setImageEngine(imageEngine)
.setSelectFilterListener(object : OnSelectFilterListener {
override fun onSelectFilter(media: LocalMedia?): Boolean {
Log.d("MultipleImagePicker", "media: ${media?.isChecked} ${media?.mimeType}")
return false
}
})
.setMaxSelectNum(maxSelectedAssets)
.setImageSpanCount(numberOfColumn)
.setCropEngine(onSetCropEngine())
.isDirectReturnSingle(true)
.isSelectZoomAnim(true)
.isPageStrategy(true, 50)
.isWithSelectVideoImage(true)
.setRecordVideoMaxSecond(maxVideoDuration)
.setMaxVideoSelectNum(if (maxVideo != 20) maxVideo else maxSelectedAssets)
.isMaxSelectEnabledMask(true)
.setSelectedData(selectedAssets)
.setSelectorUIStyle(style)
.isPreviewImage(isPreview)
.isPreviewVideo(isPreview)
.isDisplayCamera(isCamera)
.setAttachViewLifecycle(customAttachViewLifecycle)
.setInjectLayoutResourceListener(customLayoutResourceListener)
.setSelectionMode(if (singleSelectedMode) SelectModeConfig.SINGLE else SelectModeConfig.MULTIPLE)
.forResult(object : OnResultCallbackListener {
override fun onResult(result: ArrayList?) {
val localMedia: WritableArray = WritableNativeArray()
if (result?.size == 0) {
promise.resolve(localMedia)
return
}
if (result?.size == selectedAssets.size && (result[result.size - 1] as LocalMedia).id == (selectedAssets[selectedAssets.size - 1].id)) {
return
}
if (result != null) {
for (i in 0 until result.size) {
val item: LocalMedia = result[i] as LocalMedia
val media: WritableMap = createAttachmentResponse(item)
localMedia.pushMap(media)
}
}
promise.resolve(localMedia)
}

override fun onCancel() {
promise.reject("PICKER_CANCELLED", "User has canceled", null)
}
})
```

## Describe the problem or provide an error log?
#### 描述问题或提供错误log?

```

```

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with PictureSelector v3.11.2 using the shown setSelectFilterListener configuration, comparing image and video selections. Trace how onSelectFilter interacts with setMaxSelectNum and setMaxVideoSelectNum, then define the expected separate image and video limits before adding a focused regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.