properly update text color at list view, if it changes
This commit is contained in:
parent
73bcad0f68
commit
3d674c65ba
4 changed files with 30 additions and 6 deletions
|
@ -57,6 +57,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
||||||
private var mStoredAnimateGifs = true
|
private var mStoredAnimateGifs = true
|
||||||
private var mStoredCropThumbnails = true
|
private var mStoredCropThumbnails = true
|
||||||
private var mStoredScrollHorizontally = true
|
private var mStoredScrollHorizontally = true
|
||||||
|
private var mStoredTextColor = 0
|
||||||
private var mLoadedInitialPhotos = false
|
private var mLoadedInitialPhotos = false
|
||||||
private var mLatestMediaId = 0L
|
private var mLatestMediaId = 0L
|
||||||
private var mLastMediaHandler = Handler()
|
private var mLastMediaHandler = Handler()
|
||||||
|
@ -82,6 +83,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
||||||
mStoredAnimateGifs = config.animateGifs
|
mStoredAnimateGifs = config.animateGifs
|
||||||
mStoredCropThumbnails = config.cropThumbnails
|
mStoredCropThumbnails = config.cropThumbnails
|
||||||
mStoredScrollHorizontally = config.scrollHorizontally
|
mStoredScrollHorizontally = config.scrollHorizontally
|
||||||
|
mStoredTextColor = config.textColor
|
||||||
storeStoragePaths()
|
storeStoragePaths()
|
||||||
checkWhatsNewDialog()
|
checkWhatsNewDialog()
|
||||||
|
|
||||||
|
@ -134,13 +136,17 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mStoredScrollHorizontally != config.scrollHorizontally) {
|
if (mStoredScrollHorizontally != config.scrollHorizontally) {
|
||||||
directories_grid.adapter?.let {
|
(directories_grid.adapter as? DirectoryAdapter)?.apply {
|
||||||
(it as DirectoryAdapter).scrollVertically = config.viewTypeFolders == VIEW_TYPE_LIST || !config.scrollHorizontally
|
scrollVertically = config.viewTypeFolders == VIEW_TYPE_LIST || !config.scrollHorizontally
|
||||||
it.notifyDataSetChanged()
|
notifyDataSetChanged()
|
||||||
}
|
}
|
||||||
setupScrollDirection()
|
setupScrollDirection()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mStoredTextColor != config.textColor) {
|
||||||
|
(directories_grid.adapter as? DirectoryAdapter)?.updateTextColor(config.textColor)
|
||||||
|
}
|
||||||
|
|
||||||
tryloadGallery()
|
tryloadGallery()
|
||||||
invalidateOptionsMenu()
|
invalidateOptionsMenu()
|
||||||
directories_empty_text_label.setTextColor(config.textColor)
|
directories_empty_text_label.setTextColor(config.textColor)
|
||||||
|
@ -155,6 +161,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
||||||
mStoredAnimateGifs = config.animateGifs
|
mStoredAnimateGifs = config.animateGifs
|
||||||
mStoredCropThumbnails = config.cropThumbnails
|
mStoredCropThumbnails = config.cropThumbnails
|
||||||
mStoredScrollHorizontally = config.scrollHorizontally
|
mStoredScrollHorizontally = config.scrollHorizontally
|
||||||
|
mStoredTextColor = config.textColor
|
||||||
directories_grid.listener = null
|
directories_grid.listener = null
|
||||||
mLastMediaHandler.removeCallbacksAndMessages(null)
|
mLastMediaHandler.removeCallbacksAndMessages(null)
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,6 +51,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
||||||
private var mStoredAnimateGifs = true
|
private var mStoredAnimateGifs = true
|
||||||
private var mStoredCropThumbnails = true
|
private var mStoredCropThumbnails = true
|
||||||
private var mStoredScrollHorizontally = true
|
private var mStoredScrollHorizontally = true
|
||||||
|
private var mStoredTextColor = 0
|
||||||
private var mLastDrawnHashCode = 0
|
private var mLastDrawnHashCode = 0
|
||||||
private var mLatestMediaId = 0L
|
private var mLatestMediaId = 0L
|
||||||
private var mLastMediaHandler = Handler()
|
private var mLastMediaHandler = Handler()
|
||||||
|
@ -73,6 +74,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
||||||
mStoredAnimateGifs = config.animateGifs
|
mStoredAnimateGifs = config.animateGifs
|
||||||
mStoredCropThumbnails = config.cropThumbnails
|
mStoredCropThumbnails = config.cropThumbnails
|
||||||
mStoredScrollHorizontally = config.scrollHorizontally
|
mStoredScrollHorizontally = config.scrollHorizontally
|
||||||
|
mStoredTextColor = config.textColor
|
||||||
mShowAll = config.showAll
|
mShowAll = config.showAll
|
||||||
if (mShowAll)
|
if (mShowAll)
|
||||||
supportActionBar?.setDisplayHomeAsUpEnabled(false)
|
supportActionBar?.setDisplayHomeAsUpEnabled(false)
|
||||||
|
@ -93,13 +95,17 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mStoredScrollHorizontally != config.scrollHorizontally) {
|
if (mStoredScrollHorizontally != config.scrollHorizontally) {
|
||||||
media_grid.adapter?.let {
|
(media_grid.adapter as? MediaAdapter)?.apply {
|
||||||
(it as MediaAdapter).scrollVertically = config.viewTypeFiles == VIEW_TYPE_LIST || !config.scrollHorizontally
|
scrollVertically = config.viewTypeFiles == VIEW_TYPE_LIST || !config.scrollHorizontally
|
||||||
it.notifyDataSetChanged()
|
notifyDataSetChanged()
|
||||||
}
|
}
|
||||||
setupScrollDirection()
|
setupScrollDirection()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mStoredTextColor != config.textColor) {
|
||||||
|
(media_grid.adapter as? MediaAdapter)?.updateTextColor(config.textColor)
|
||||||
|
}
|
||||||
|
|
||||||
tryloadGallery()
|
tryloadGallery()
|
||||||
invalidateOptionsMenu()
|
invalidateOptionsMenu()
|
||||||
media_empty_text_label.setTextColor(config.textColor)
|
media_empty_text_label.setTextColor(config.textColor)
|
||||||
|
@ -113,6 +119,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
||||||
mStoredAnimateGifs = config.animateGifs
|
mStoredAnimateGifs = config.animateGifs
|
||||||
mStoredCropThumbnails = config.cropThumbnails
|
mStoredCropThumbnails = config.cropThumbnails
|
||||||
mStoredScrollHorizontally = config.scrollHorizontally
|
mStoredScrollHorizontally = config.scrollHorizontally
|
||||||
|
mStoredTextColor = config.textColor
|
||||||
media_grid.listener = null
|
media_grid.listener = null
|
||||||
mLastMediaHandler.removeCallbacksAndMessages(null)
|
mLastMediaHandler.removeCallbacksAndMessages(null)
|
||||||
}
|
}
|
||||||
|
|
|
@ -353,6 +353,11 @@ class DirectoryAdapter(val activity: SimpleActivity, var dirs: MutableList<Direc
|
||||||
notifyDataSetChanged()
|
notifyDataSetChanged()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun updateTextColor(textColor: Int) {
|
||||||
|
this.textColor = textColor
|
||||||
|
notifyDataSetChanged()
|
||||||
|
}
|
||||||
|
|
||||||
fun selectItem(pos: Int) {
|
fun selectItem(pos: Int) {
|
||||||
toggleItemSelection(true, pos)
|
toggleItemSelection(true, pos)
|
||||||
}
|
}
|
||||||
|
|
|
@ -273,6 +273,11 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList<Medium>,
|
||||||
notifyDataSetChanged()
|
notifyDataSetChanged()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun updateTextColor(textColor: Int) {
|
||||||
|
this.textColor = textColor
|
||||||
|
notifyDataSetChanged()
|
||||||
|
}
|
||||||
|
|
||||||
fun selectItem(pos: Int) {
|
fun selectItem(pos: Int) {
|
||||||
toggleItemSelection(true, pos)
|
toggleItemSelection(true, pos)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue