set scrolling orientation based on the user setting

This commit is contained in:
tibbi 2017-06-18 20:52:21 +02:00
parent f740150d49
commit 88de8a4d2a
4 changed files with 7 additions and 0 deletions

View file

@ -220,6 +220,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
private fun handleZooming() {
val layoutManager = directories_grid.layoutManager as GridLayoutManager
layoutManager.orientation = if (config.scrollHorizontally) GridLayoutManager.HORIZONTAL else GridLayoutManager.VERTICAL
layoutManager.spanCount = config.dirColumnCnt
MyScalableRecyclerView.mListener = object : MyScalableRecyclerView.MyScalableRecyclerViewListener {
override fun zoomIn() {

View file

@ -296,6 +296,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
private fun handleZooming() {
val layoutManager = media_grid.layoutManager as GridLayoutManager
layoutManager.orientation = if (config.scrollHorizontally) GridLayoutManager.HORIZONTAL else GridLayoutManager.VERTICAL
layoutManager.spanCount = config.mediaColumnCnt
MyScalableRecyclerView.mListener = object : MyScalableRecyclerView.MyScalableRecyclerViewListener {
override fun zoomIn() {

View file

@ -190,4 +190,8 @@ class Config(context: Context) : BaseConfig(context) {
val listType = object : TypeToken<List<AlbumCover>>() {}.type
return Gson().fromJson<ArrayList<AlbumCover>>(albumCovers, listType) ?: ArrayList(1)
}
var scrollHorizontally: Boolean
get() = prefs.getBoolean(SCROLL_HORIZONTALLY, false)
set(scrollHorizontally) = prefs.edit().putBoolean(SCROLL_HORIZONTALLY, scrollHorizontally).apply()
}

View file

@ -26,6 +26,7 @@ val HIDE_FOLDER_TOOLTIP_SHOWN = "hide_folder_tooltip_shown"
val EXCLUDED_FOLDERS = "excluded_folders"
val INCLUDED_FOLDERS = "included_folders"
val ALBUM_COVERS = "album_covers"
val SCROLL_HORIZONTALLY = "scroll_horizontally"
val NOMEDIA = ".nomedia"