From 1402de7a3d3491b3c53a21bc70e7973bda08d4ed Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 18 Jun 2017 23:13:06 +0200 Subject: [PATCH] check thumbnail scrolling on resume --- .../simplemobiletools/gallery/activities/MainActivity.kt | 9 +++++++++ .../gallery/activities/MediaActivity.kt | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt index 0520b8d99..85d5bc3f6 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -50,6 +50,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { private var mIsGettingDirs = false private var mStoredAnimateGifs = true private var mStoredCropThumbnails = true + private var mStoredScrollHorizontally = true private var mLoadedInitialPhotos = false private var mLastMediaModified = 0 private var mLastMediaHandler = Handler() @@ -73,6 +74,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { mDirs = ArrayList() mStoredAnimateGifs = config.animateGifs mStoredCropThumbnails = config.cropThumbnails + mStoredScrollHorizontally = config.scrollHorizontally storeStoragePaths() checkWhatsNewDialog() } @@ -113,6 +115,12 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { if (mStoredCropThumbnails != config.cropThumbnails) { directories_grid.adapter.notifyDataSetChanged() } + + if (mStoredScrollHorizontally != config.scrollHorizontally) { + (directories_grid.adapter as DirectoryAdapter).scrollVertically = !config.scrollHorizontally + directories_grid.adapter.notifyDataSetChanged() + } + tryloadGallery() invalidateOptionsMenu() } @@ -125,6 +133,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { mIsGettingDirs = false mStoredAnimateGifs = config.animateGifs mStoredCropThumbnails = config.cropThumbnails + mStoredScrollHorizontally = config.scrollHorizontally MyScalableRecyclerView.mListener = null mLastMediaHandler.removeCallbacksAndMessages(null) } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt index 9e5f7ccc1..2d90e98c7 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -48,6 +48,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { private var mLoadedInitialPhotos = false private var mStoredAnimateGifs = true private var mStoredCropThumbnails = true + private var mStoredScrollHorizontally = true private var mLastDrawnHashCode = 0 private var mLastMediaModified = 0 private var mLastMediaHandler = Handler() @@ -69,6 +70,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { mPath = intent.getStringExtra(DIRECTORY) mStoredAnimateGifs = config.animateGifs mStoredCropThumbnails = config.cropThumbnails + mStoredScrollHorizontally = config.scrollHorizontally mShowAll = config.showAll if (mShowAll) supportActionBar?.setDisplayHomeAsUpEnabled(false) @@ -83,6 +85,12 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { if (mStoredCropThumbnails != config.cropThumbnails) { media_grid.adapter.notifyDataSetChanged() } + + if (mStoredScrollHorizontally != config.scrollHorizontally) { + (media_grid.adapter as MediaAdapter).scrollVertically = !config.scrollHorizontally + media_grid.adapter.notifyDataSetChanged() + } + tryloadGallery() invalidateOptionsMenu() } @@ -93,6 +101,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { media_refresh_layout.isRefreshing = false mStoredAnimateGifs = config.animateGifs mStoredCropThumbnails = config.cropThumbnails + mStoredScrollHorizontally = config.scrollHorizontally MyScalableRecyclerView.mListener = null mLastMediaHandler.removeCallbacksAndMessages(null) }