mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-30 00:17:58 +01:00
lets use the new GridDecoration only when needed, not by default
This commit is contained in:
parent
bd60592188
commit
fde725e98e
3 changed files with 15 additions and 3 deletions
|
@ -157,13 +157,13 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mStoredThumbnailSpacing != config.thumbnailSpacing) {
|
if (mStoredThumbnailSpacing != config.thumbnailSpacing) {
|
||||||
handleGridSpacing()
|
media_grid.adapter = null
|
||||||
|
setupAdapter()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mStoredRoundedCorners != config.fileRoundedCorners) {
|
if (mStoredRoundedCorners != config.fileRoundedCorners) {
|
||||||
handleGridSpacing()
|
|
||||||
media_grid.adapter = null
|
media_grid.adapter = null
|
||||||
getMedia()
|
setupAdapter()
|
||||||
}
|
}
|
||||||
|
|
||||||
media_horizontal_fastscroller.updateBubbleColors()
|
media_horizontal_fastscroller.updateBubbleColors()
|
||||||
|
|
|
@ -499,6 +499,14 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: ArrayList<ThumbnailI
|
||||||
private fun setupThumbnail(view: View, medium: Medium) {
|
private fun setupThumbnail(view: View, medium: Medium) {
|
||||||
val isSelected = selectedKeys.contains(medium.path.hashCode())
|
val isSelected = selectedKeys.contains(medium.path.hashCode())
|
||||||
view.apply {
|
view.apply {
|
||||||
|
val padding = if (config.thumbnailSpacing <= 1) {
|
||||||
|
config.thumbnailSpacing
|
||||||
|
} else {
|
||||||
|
0
|
||||||
|
}
|
||||||
|
|
||||||
|
media_item_holder.setPadding(padding, padding, padding, padding)
|
||||||
|
|
||||||
play_outline.beVisibleIf(medium.isVideo() || medium.isPortrait())
|
play_outline.beVisibleIf(medium.isVideo() || medium.isPortrait())
|
||||||
if (medium.isVideo()) {
|
if (medium.isVideo()) {
|
||||||
play_outline.setImageResource(R.drawable.ic_play_outline_vector)
|
play_outline.setImageResource(R.drawable.ic_play_outline_vector)
|
||||||
|
|
|
@ -13,6 +13,10 @@ class GridSpacingItemDecoration(val spanCount: Int, val spacing: Int, val isScro
|
||||||
"items: ${items.hashCode()}, useGridPosition: $useGridPosition"
|
"items: ${items.hashCode()}, useGridPosition: $useGridPosition"
|
||||||
|
|
||||||
override fun getItemOffsets(outRect: Rect, view: View, parent: RecyclerView, state: RecyclerView.State) {
|
override fun getItemOffsets(outRect: Rect, view: View, parent: RecyclerView, state: RecyclerView.State) {
|
||||||
|
if (spacing <= 1) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
val position = parent.getChildAdapterPosition(view)
|
val position = parent.getChildAdapterPosition(view)
|
||||||
val medium = items.getOrNull(position) as? Medium ?: return
|
val medium = items.getOrNull(position) as? Medium ?: return
|
||||||
val gridPositionToUse = if (useGridPosition) medium.gridPosition else position
|
val gridPositionToUse = if (useGridPosition) medium.gridPosition else position
|
||||||
|
|
Loading…
Reference in a new issue