make sure we are selecting existing indexes at media and directory adapters

This commit is contained in:
tibbi 2017-10-24 22:20:50 +02:00
parent 498cd10ba6
commit 7ad578ec2e
2 changed files with 8 additions and 4 deletions

View file

@ -45,8 +45,10 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList<Direc
fun toggleItemSelection(select: Boolean, pos: Int) {
if (select) {
itemViews[pos]?.dir_check?.background?.setColorFilter(primaryColor, PorterDuff.Mode.SRC_IN)
selectedPositions.add(pos)
if (itemViews[pos] != null) {
itemViews[pos].dir_check?.background?.setColorFilter(primaryColor, PorterDuff.Mode.SRC_IN)
selectedPositions.add(pos)
}
} else {
selectedPositions.remove(pos)
}

View file

@ -42,8 +42,10 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList<Medium>,
fun toggleItemSelection(select: Boolean, pos: Int) {
if (select) {
itemViews[pos]?.medium_check?.background?.setColorFilter(primaryColor, PorterDuff.Mode.SRC_IN)
selectedPositions.add(pos)
if (itemViews[pos] != null) {
itemViews[pos].medium_check?.background?.setColorFilter(primaryColor, PorterDuff.Mode.SRC_IN)
selectedPositions.add(pos)
}
} else {
selectedPositions.remove(pos)
}