send the scroll orientation to thumbnails

This commit is contained in:
tibbi 2017-06-18 21:44:53 +02:00
parent 5319a184f3
commit 435a7693e5
2 changed files with 8 additions and 6 deletions

View File

@ -41,6 +41,7 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList<Direc
val selectedPositions = HashSet<Int>()
var foregroundColor = 0
var pinnedFolders = config.pinnedFolders
var scrollVertically = !config.scrollHorizontally
fun toggleItemSelection(select: Boolean, pos: Int) {
if (itemViews[pos] != null)
@ -366,7 +367,7 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList<Direc
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val dir = dirs[position]
itemViews.put(position, holder.bindView(dir, pinnedFolders.contains(dir.path)))
itemViews.put(position, holder.bindView(dir, pinnedFolders.contains(dir.path), scrollVertically))
toggleItemSelection(selectedPositions.contains(position), position)
holder.itemView.tag = holder
}
@ -425,12 +426,12 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList<Direc
class ViewHolder(val view: View, val adapter: MyAdapterListener, val activity: SimpleActivity, val multiSelectorCallback: ModalMultiSelectorCallback,
val multiSelector: MultiSelector, val listener: DirOperationsListener?, val itemClick: (Directory) -> (Unit)) :
SwappingHolder(view, MultiSelector()) {
fun bindView(directory: Directory, isPinned: Boolean): View {
fun bindView(directory: Directory, isPinned: Boolean, scrollVertically: Boolean): View {
itemView.apply {
dir_name.text = directory.name
photo_cnt.text = directory.mediaCnt.toString()
dir_pin.visibility = if (isPinned) View.VISIBLE else View.GONE
activity.loadImage(directory.tmb, dir_thumbnail, true)
activity.loadImage(directory.tmb, dir_thumbnail, scrollVertically)
setOnClickListener { viewClicked(directory) }
setOnLongClickListener { viewLongClicked(); true }

View File

@ -34,6 +34,7 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList<Medium>,
val selectedPositions = HashSet<Int>()
var foregroundColor = 0
var displayFilenames = config.displayFileNames
var scrollVertically = !config.scrollHorizontally
fun toggleItemSelection(select: Boolean, pos: Int) {
if (itemViews[pos] != null)
@ -274,7 +275,7 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList<Medium>,
}
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
itemViews.put(position, holder.bindView(media[position], displayFilenames))
itemViews.put(position, holder.bindView(media[position], displayFilenames, scrollVertically))
toggleItemSelection(selectedPositions.contains(position), position)
holder.itemView.tag = holder
}
@ -337,12 +338,12 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList<Medium>,
class ViewHolder(val view: View, val adapter: MyAdapterListener, val activity: SimpleActivity, val multiSelectorCallback: ModalMultiSelectorCallback,
val multiSelector: MultiSelector, val listener: MediaOperationsListener?, val itemClick: (Medium) -> (Unit)) : SwappingHolder(view, MultiSelector()) {
fun bindView(medium: Medium, displayFilenames: Boolean): View {
fun bindView(medium: Medium, displayFilenames: Boolean, scrollVertically: Boolean): View {
itemView.apply {
play_outline.visibility = if (medium.video) View.VISIBLE else View.GONE
photo_name.beVisibleIf(displayFilenames)
photo_name.text = medium.name
activity.loadImage(medium.path, medium_thumbnail, true)
activity.loadImage(medium.path, medium_thumbnail, scrollVertically)
setOnClickListener { viewClicked(medium) }
setOnLongClickListener { viewLongClicked(); true }