clear selection at updating items
This commit is contained in:
parent
4493d9aaa0
commit
30bd5dc250
1 changed files with 5 additions and 3 deletions
|
@ -52,10 +52,11 @@ class ItemsAdapter(val activity: SimpleActivity, var mItems: MutableList<FileDir
|
||||||
lateinit private var fileDrawable: Drawable
|
lateinit private var fileDrawable: Drawable
|
||||||
|
|
||||||
fun toggleItemSelection(select: Boolean, pos: Int) {
|
fun toggleItemSelection(select: Boolean, pos: Int) {
|
||||||
itemViews[pos]?.item_frame?.isSelected = select
|
|
||||||
|
|
||||||
if (select) {
|
if (select) {
|
||||||
selectedPositions.add(pos)
|
if (itemViews[pos] != null) {
|
||||||
|
itemViews[pos].item_frame?.isSelected = select
|
||||||
|
selectedPositions.add(pos)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
selectedPositions.remove(pos)
|
selectedPositions.remove(pos)
|
||||||
}
|
}
|
||||||
|
@ -433,6 +434,7 @@ class ItemsAdapter(val activity: SimpleActivity, var mItems: MutableList<FileDir
|
||||||
fun updateItems(newItems: MutableList<FileDirItem>) {
|
fun updateItems(newItems: MutableList<FileDirItem>) {
|
||||||
mItems = newItems
|
mItems = newItems
|
||||||
notifyDataSetChanged()
|
notifyDataSetChanged()
|
||||||
|
actMode?.finish()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): ViewHolder {
|
override fun onCreateViewHolder(parent: ViewGroup?, viewType: Int): ViewHolder {
|
||||||
|
|
Loading…
Reference in a new issue