Skip to content

Commit 6f5356b

Browse files
author
fengpeng
committed
修复非追加模式下添加照片有错误的BUG
1 parent 692511a commit 6f5356b

1 file changed

Lines changed: 19 additions & 11 deletions

File tree

picker/src/main/java/pizzk/media/picker/widget/PhotoGroupView.kt

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class PhotoGroupView : RecyclerView {
5757
//选择图片
5858
val selects: List<String> = if (pAdapter.isAppend) pAdapter.selectPaths() else emptyList()
5959
PickChoseActivity.show(special.activity, choiceList) { key ->
60-
showPickPhoto(special.activity, key, selects, special.limit, pAdapter, index,special.crop)
60+
showPickPhoto(special.activity, key, selects, special.limit, pAdapter, index, special.crop)
6161
}
6262
} else {
6363
//预览
@@ -96,22 +96,30 @@ class PhotoGroupView : RecyclerView {
9696
else -> -1
9797
}
9898
if (action < 0) return
99-
PickControl.obtain(true).action(action)
99+
PickControl.obtain(clean = true).action(action)
100100
.selects(selects)
101101
.limit(limit)
102102
.crop(crop)
103103
.callback { code, list ->
104104
if (code == PickControl.ACTION_CAMERA) {
105-
val allOf: MutableList<String> = ArrayList(adapter.selectCount() + 1)
106-
allOf.addAll(adapter.selectPaths())
107-
allOf.addAll(list.map(Uri::toString))
108-
adapter.update(allOf, limit, index)
105+
if (adapter.isAppend) {
106+
val allOf: MutableList<String> = ArrayList(adapter.selectCount() + 1)
107+
allOf.addAll(adapter.selectPaths())
108+
allOf.addAll(list.map(Uri::toString))
109+
adapter.update(allOf, limit, index)
110+
} else {
111+
adapter.update(list.map(Uri::toString), limit, index)
112+
}
109113
} else {
110-
val remotes: List<String> = selects.filter { null == PickUtils.path2Uri(it) }
111-
val allOf: MutableList<String> = ArrayList(limit)
112-
allOf.addAll(remotes)
113-
allOf.addAll(list.map(Uri::toString))
114-
adapter.update(allOf, limit, index)
114+
if (adapter.isAppend) {
115+
val remotes: List<String> = selects.filter { null == PickUtils.path2Uri(it) }
116+
val allOf: MutableList<String> = ArrayList(limit)
117+
allOf.addAll(remotes)
118+
allOf.addAll(list.map(Uri::toString))
119+
adapter.update(allOf, limit, index)
120+
} else {
121+
adapter.update(list.map(Uri::toString), limit, index)
122+
}
115123
}
116124
}.done(activity)
117125
}

0 commit comments

Comments
 (0)