set image select state only after its already init
This commit is contained in:
parent
ae6b53d464
commit
311d28242f
2 changed files with 4 additions and 4 deletions
|
@ -312,6 +312,7 @@ class DirectoryAdapter(val activity: SimpleActivity, val dirs: MutableList<Direc
|
|||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
val dir = dirs[position]
|
||||
itemViews.put(position, holder.bindView(activity, multiSelectorMode, multiSelector, dir, position, pinnedFolders.contains(dir.path), listener))
|
||||
toggleItemSelection(selectedPositions.contains(position), position)
|
||||
holder.itemView.tag = holder
|
||||
}
|
||||
|
||||
|
@ -368,7 +369,6 @@ class DirectoryAdapter(val activity: SimpleActivity, val dirs: MutableList<Direc
|
|||
dir_name.text = directory.name
|
||||
photo_cnt.text = directory.mediaCnt.toString()
|
||||
dir_pin.visibility = if (isPinned) View.VISIBLE else View.GONE
|
||||
adapter.toggleItemSelectionAdapter(adapter.getSelectedPositions().contains(pos), pos)
|
||||
activity.loadImage(directory.tmb, dir_thumbnail)
|
||||
|
||||
setOnClickListener { viewClicked(multiSelector, directory, pos) }
|
||||
|
@ -391,7 +391,7 @@ class DirectoryAdapter(val activity: SimpleActivity, val dirs: MutableList<Direc
|
|||
|
||||
fun viewClicked(multiSelector: MultiSelector, directory: Directory, pos: Int) {
|
||||
if (multiSelector.isSelectable) {
|
||||
val isSelected = adapter.getSelectedPositions().contains(layoutPosition)
|
||||
val isSelected = adapter.getSelectedPositions().contains(pos)
|
||||
adapter.toggleItemSelectionAdapter(!isSelected, pos)
|
||||
} else {
|
||||
itemClick(directory)
|
||||
|
|
|
@ -249,6 +249,7 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList<Medium>,
|
|||
|
||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||
itemViews.put(position, holder.bindView(activity, multiSelectorMode, multiSelector, media[position], position, listener, displayFilenames))
|
||||
toggleItemSelection(selectedPositions.contains(position), position)
|
||||
holder.itemView.tag = holder
|
||||
}
|
||||
|
||||
|
@ -315,7 +316,6 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList<Medium>,
|
|||
play_outline.visibility = if (medium.video) View.VISIBLE else View.GONE
|
||||
photo_name.beVisibleIf(displayFilenames)
|
||||
photo_name.text = medium.name
|
||||
adapter.toggleItemSelectionAdapter(adapter.getSelectedPositions().contains(pos), pos)
|
||||
activity.loadImage(medium.path, medium_thumbnail)
|
||||
|
||||
setOnClickListener { viewClicked(multiSelector, medium, pos) }
|
||||
|
@ -338,7 +338,7 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList<Medium>,
|
|||
|
||||
fun viewClicked(multiSelector: MultiSelector, medium: Medium, pos: Int) {
|
||||
if (multiSelector.isSelectable) {
|
||||
val isSelected = adapter.getSelectedPositions().contains(layoutPosition)
|
||||
val isSelected = adapter.getSelectedPositions().contains(pos)
|
||||
adapter.toggleItemSelectionAdapter(!isSelected, pos)
|
||||
} else {
|
||||
itemClick(medium)
|
||||
|
|
Loading…
Reference in a new issue