check thumbnail scrolling on resume

This commit is contained in:
tibbi 2017-06-18 23:13:06 +02:00
parent 6dd4be62d8
commit 1402de7a3d
2 changed files with 18 additions and 0 deletions

View File

@ -50,6 +50,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
private var mIsGettingDirs = false private var mIsGettingDirs = false
private var mStoredAnimateGifs = true private var mStoredAnimateGifs = true
private var mStoredCropThumbnails = true private var mStoredCropThumbnails = true
private var mStoredScrollHorizontally = true
private var mLoadedInitialPhotos = false private var mLoadedInitialPhotos = false
private var mLastMediaModified = 0 private var mLastMediaModified = 0
private var mLastMediaHandler = Handler() private var mLastMediaHandler = Handler()
@ -73,6 +74,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
mDirs = ArrayList<Directory>() mDirs = ArrayList<Directory>()
mStoredAnimateGifs = config.animateGifs mStoredAnimateGifs = config.animateGifs
mStoredCropThumbnails = config.cropThumbnails mStoredCropThumbnails = config.cropThumbnails
mStoredScrollHorizontally = config.scrollHorizontally
storeStoragePaths() storeStoragePaths()
checkWhatsNewDialog() checkWhatsNewDialog()
} }
@ -113,6 +115,12 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
if (mStoredCropThumbnails != config.cropThumbnails) { if (mStoredCropThumbnails != config.cropThumbnails) {
directories_grid.adapter.notifyDataSetChanged() directories_grid.adapter.notifyDataSetChanged()
} }
if (mStoredScrollHorizontally != config.scrollHorizontally) {
(directories_grid.adapter as DirectoryAdapter).scrollVertically = !config.scrollHorizontally
directories_grid.adapter.notifyDataSetChanged()
}
tryloadGallery() tryloadGallery()
invalidateOptionsMenu() invalidateOptionsMenu()
} }
@ -125,6 +133,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
mIsGettingDirs = false mIsGettingDirs = false
mStoredAnimateGifs = config.animateGifs mStoredAnimateGifs = config.animateGifs
mStoredCropThumbnails = config.cropThumbnails mStoredCropThumbnails = config.cropThumbnails
mStoredScrollHorizontally = config.scrollHorizontally
MyScalableRecyclerView.mListener = null MyScalableRecyclerView.mListener = null
mLastMediaHandler.removeCallbacksAndMessages(null) mLastMediaHandler.removeCallbacksAndMessages(null)
} }

View File

@ -48,6 +48,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
private var mLoadedInitialPhotos = false private var mLoadedInitialPhotos = false
private var mStoredAnimateGifs = true private var mStoredAnimateGifs = true
private var mStoredCropThumbnails = true private var mStoredCropThumbnails = true
private var mStoredScrollHorizontally = true
private var mLastDrawnHashCode = 0 private var mLastDrawnHashCode = 0
private var mLastMediaModified = 0 private var mLastMediaModified = 0
private var mLastMediaHandler = Handler() private var mLastMediaHandler = Handler()
@ -69,6 +70,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
mPath = intent.getStringExtra(DIRECTORY) mPath = intent.getStringExtra(DIRECTORY)
mStoredAnimateGifs = config.animateGifs mStoredAnimateGifs = config.animateGifs
mStoredCropThumbnails = config.cropThumbnails mStoredCropThumbnails = config.cropThumbnails
mStoredScrollHorizontally = config.scrollHorizontally
mShowAll = config.showAll mShowAll = config.showAll
if (mShowAll) if (mShowAll)
supportActionBar?.setDisplayHomeAsUpEnabled(false) supportActionBar?.setDisplayHomeAsUpEnabled(false)
@ -83,6 +85,12 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
if (mStoredCropThumbnails != config.cropThumbnails) { if (mStoredCropThumbnails != config.cropThumbnails) {
media_grid.adapter.notifyDataSetChanged() media_grid.adapter.notifyDataSetChanged()
} }
if (mStoredScrollHorizontally != config.scrollHorizontally) {
(media_grid.adapter as MediaAdapter).scrollVertically = !config.scrollHorizontally
media_grid.adapter.notifyDataSetChanged()
}
tryloadGallery() tryloadGallery()
invalidateOptionsMenu() invalidateOptionsMenu()
} }
@ -93,6 +101,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
media_refresh_layout.isRefreshing = false media_refresh_layout.isRefreshing = false
mStoredAnimateGifs = config.animateGifs mStoredAnimateGifs = config.animateGifs
mStoredCropThumbnails = config.cropThumbnails mStoredCropThumbnails = config.cropThumbnails
mStoredScrollHorizontally = config.scrollHorizontally
MyScalableRecyclerView.mListener = null MyScalableRecyclerView.mListener = null
mLastMediaHandler.removeCallbacksAndMessages(null) mLastMediaHandler.removeCallbacksAndMessages(null)
} }