mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 22:47:59 +01:00
set thumbnail holder properties based on the scroll orientation
This commit is contained in:
parent
88de8a4d2a
commit
5be34f27ee
2 changed files with 24 additions and 6 deletions
|
@ -14,6 +14,8 @@ import android.support.v4.app.ActivityCompat
|
|||
import android.support.v7.widget.GridLayoutManager
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import android.view.ViewGroup
|
||||
import android.widget.FrameLayout
|
||||
import com.google.gson.Gson
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.models.Release
|
||||
|
@ -138,7 +140,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
|||
showAllMedia()
|
||||
else
|
||||
getDirectories()
|
||||
handleZooming()
|
||||
setupLayoutManager()
|
||||
checkIfColorChanged()
|
||||
} else {
|
||||
ActivityCompat.requestPermissions(this, arrayOf(Manifest.permission.WRITE_EXTERNAL_STORAGE), STORAGE_PERMISSION)
|
||||
|
@ -218,9 +220,16 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
|||
|
||||
private fun getRecyclerAdapter() = (directories_grid.adapter as DirectoryAdapter)
|
||||
|
||||
private fun handleZooming() {
|
||||
private fun setupLayoutManager() {
|
||||
val layoutManager = directories_grid.layoutManager as GridLayoutManager
|
||||
layoutManager.orientation = if (config.scrollHorizontally) GridLayoutManager.HORIZONTAL else GridLayoutManager.VERTICAL
|
||||
if (config.scrollHorizontally) {
|
||||
layoutManager.orientation = GridLayoutManager.HORIZONTAL
|
||||
directories_refresh_layout.layoutParams = FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT)
|
||||
} else {
|
||||
layoutManager.orientation = GridLayoutManager.VERTICAL
|
||||
directories_refresh_layout.layoutParams = FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
||||
}
|
||||
|
||||
layoutManager.spanCount = config.dirColumnCnt
|
||||
MyScalableRecyclerView.mListener = object : MyScalableRecyclerView.MyScalableRecyclerViewListener {
|
||||
override fun zoomIn() {
|
||||
|
|
|
@ -12,6 +12,8 @@ import android.support.v7.widget.GridLayoutManager
|
|||
import android.util.Log
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import android.view.ViewGroup
|
||||
import android.widget.FrameLayout
|
||||
import com.bumptech.glide.Glide
|
||||
import com.bumptech.glide.request.animation.GlideAnimation
|
||||
import com.bumptech.glide.request.target.SimpleTarget
|
||||
|
@ -107,7 +109,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
|||
val dirName = getHumanizedFilename(mPath)
|
||||
title = if (mShowAll) resources.getString(R.string.all_folders) else dirName
|
||||
getMedia()
|
||||
handleZooming()
|
||||
setupLayoutManager()
|
||||
checkIfColorChanged()
|
||||
} else {
|
||||
finish()
|
||||
|
@ -294,9 +296,16 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
|||
|
||||
private fun getRecyclerAdapter() = (media_grid.adapter as MediaAdapter)
|
||||
|
||||
private fun handleZooming() {
|
||||
private fun setupLayoutManager() {
|
||||
val layoutManager = media_grid.layoutManager as GridLayoutManager
|
||||
layoutManager.orientation = if (config.scrollHorizontally) GridLayoutManager.HORIZONTAL else GridLayoutManager.VERTICAL
|
||||
if (config.scrollHorizontally) {
|
||||
layoutManager.orientation = GridLayoutManager.HORIZONTAL
|
||||
media_refresh_layout.layoutParams = FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT)
|
||||
} else {
|
||||
layoutManager.orientation = GridLayoutManager.VERTICAL
|
||||
media_refresh_layout.layoutParams = FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
||||
}
|
||||
|
||||
layoutManager.spanCount = config.mediaColumnCnt
|
||||
MyScalableRecyclerView.mListener = object : MyScalableRecyclerView.MyScalableRecyclerViewListener {
|
||||
override fun zoomIn() {
|
||||
|
|
Loading…
Reference in a new issue