send the scroll orientation to thumbnails
This commit is contained in:
parent
5319a184f3
commit
435a7693e5
2 changed files with 8 additions and 6 deletions
|
@ -41,6 +41,7 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList<Direc
|
||||||
val selectedPositions = HashSet<Int>()
|
val selectedPositions = HashSet<Int>()
|
||||||
var foregroundColor = 0
|
var foregroundColor = 0
|
||||||
var pinnedFolders = config.pinnedFolders
|
var pinnedFolders = config.pinnedFolders
|
||||||
|
var scrollVertically = !config.scrollHorizontally
|
||||||
|
|
||||||
fun toggleItemSelection(select: Boolean, pos: Int) {
|
fun toggleItemSelection(select: Boolean, pos: Int) {
|
||||||
if (itemViews[pos] != null)
|
if (itemViews[pos] != null)
|
||||||
|
@ -366,7 +367,7 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList<Direc
|
||||||
|
|
||||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
||||||
val dir = dirs[position]
|
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)
|
toggleItemSelection(selectedPositions.contains(position), position)
|
||||||
holder.itemView.tag = holder
|
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,
|
class ViewHolder(val view: View, val adapter: MyAdapterListener, val activity: SimpleActivity, val multiSelectorCallback: ModalMultiSelectorCallback,
|
||||||
val multiSelector: MultiSelector, val listener: DirOperationsListener?, val itemClick: (Directory) -> (Unit)) :
|
val multiSelector: MultiSelector, val listener: DirOperationsListener?, val itemClick: (Directory) -> (Unit)) :
|
||||||
SwappingHolder(view, MultiSelector()) {
|
SwappingHolder(view, MultiSelector()) {
|
||||||
fun bindView(directory: Directory, isPinned: Boolean): View {
|
fun bindView(directory: Directory, isPinned: Boolean, scrollVertically: Boolean): View {
|
||||||
itemView.apply {
|
itemView.apply {
|
||||||
dir_name.text = directory.name
|
dir_name.text = directory.name
|
||||||
photo_cnt.text = directory.mediaCnt.toString()
|
photo_cnt.text = directory.mediaCnt.toString()
|
||||||
dir_pin.visibility = if (isPinned) View.VISIBLE else View.GONE
|
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) }
|
setOnClickListener { viewClicked(directory) }
|
||||||
setOnLongClickListener { viewLongClicked(); true }
|
setOnLongClickListener { viewLongClicked(); true }
|
||||||
|
|
|
@ -34,6 +34,7 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList<Medium>,
|
||||||
val selectedPositions = HashSet<Int>()
|
val selectedPositions = HashSet<Int>()
|
||||||
var foregroundColor = 0
|
var foregroundColor = 0
|
||||||
var displayFilenames = config.displayFileNames
|
var displayFilenames = config.displayFileNames
|
||||||
|
var scrollVertically = !config.scrollHorizontally
|
||||||
|
|
||||||
fun toggleItemSelection(select: Boolean, pos: Int) {
|
fun toggleItemSelection(select: Boolean, pos: Int) {
|
||||||
if (itemViews[pos] != null)
|
if (itemViews[pos] != null)
|
||||||
|
@ -274,7 +275,7 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList<Medium>,
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
|
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)
|
toggleItemSelection(selectedPositions.contains(position), position)
|
||||||
holder.itemView.tag = holder
|
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,
|
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()) {
|
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 {
|
itemView.apply {
|
||||||
play_outline.visibility = if (medium.video) View.VISIBLE else View.GONE
|
play_outline.visibility = if (medium.video) View.VISIBLE else View.GONE
|
||||||
photo_name.beVisibleIf(displayFilenames)
|
photo_name.beVisibleIf(displayFilenames)
|
||||||
photo_name.text = medium.name
|
photo_name.text = medium.name
|
||||||
activity.loadImage(medium.path, medium_thumbnail, true)
|
activity.loadImage(medium.path, medium_thumbnail, scrollVertically)
|
||||||
|
|
||||||
setOnClickListener { viewClicked(medium) }
|
setOnClickListener { viewClicked(medium) }
|
||||||
setOnLongClickListener { viewLongClicked(); true }
|
setOnLongClickListener { viewLongClicked(); true }
|
||||||
|
|
Loading…
Reference in a new issue