mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2025-01-18 06:17:59 +01:00
properly update the colors onResume
This commit is contained in:
parent
4f79d196d6
commit
698448b847
3 changed files with 37 additions and 35 deletions
|
@ -77,7 +77,7 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'com.simplemobiletools:commons:5.33.32'
|
implementation 'com.simplemobiletools:commons:5.33.33'
|
||||||
implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
|
implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
|
||||||
implementation 'it.sephiroth.android.exif:library:1.0.1'
|
implementation 'it.sephiroth.android.exif:library:1.0.1'
|
||||||
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.22'
|
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.22'
|
||||||
|
|
|
@ -84,7 +84,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
||||||
private var mStoredCropThumbnails = true
|
private var mStoredCropThumbnails = true
|
||||||
private var mStoredScrollHorizontally = true
|
private var mStoredScrollHorizontally = true
|
||||||
private var mStoredTextColor = 0
|
private var mStoredTextColor = 0
|
||||||
private var mStoredPrimaryColor = 0
|
private var mStoredAdjustedPrimaryColor = 0
|
||||||
private var mStoredStyleString = ""
|
private var mStoredStyleString = ""
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
@ -185,10 +185,11 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
||||||
getRecyclerAdapter()?.updateTextColor(config.textColor)
|
getRecyclerAdapter()?.updateTextColor(config.textColor)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mStoredPrimaryColor != config.primaryColor) {
|
val adjustedPrimaryColor = getAdjustedPrimaryColor()
|
||||||
|
if (mStoredAdjustedPrimaryColor != adjustedPrimaryColor) {
|
||||||
getRecyclerAdapter()?.updatePrimaryColor(config.primaryColor)
|
getRecyclerAdapter()?.updatePrimaryColor(config.primaryColor)
|
||||||
directories_vertical_fastscroller.updatePrimaryColor()
|
directories_vertical_fastscroller.updatePrimaryColor(adjustedPrimaryColor)
|
||||||
directories_horizontal_fastscroller.updatePrimaryColor()
|
directories_horizontal_fastscroller.updatePrimaryColor(adjustedPrimaryColor)
|
||||||
}
|
}
|
||||||
|
|
||||||
val styleString = "${config.folderStyle}${config.showFolderMediaCount}${config.limitFolderTitle}"
|
val styleString = "${config.folderStyle}${config.showFolderMediaCount}${config.limitFolderTitle}"
|
||||||
|
@ -201,8 +202,8 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
||||||
directories_refresh_layout.isEnabled = config.enablePullToRefresh
|
directories_refresh_layout.isEnabled = config.enablePullToRefresh
|
||||||
|
|
||||||
directories_empty_placeholder.setTextColor(config.textColor)
|
directories_empty_placeholder.setTextColor(config.textColor)
|
||||||
directories_empty_placeholder_2.setTextColor(getAdjustedPrimaryColor())
|
directories_empty_placeholder_2.setTextColor(adjustedPrimaryColor)
|
||||||
directories_switch_searching.setTextColor(getAdjustedPrimaryColor())
|
directories_switch_searching.setTextColor(adjustedPrimaryColor)
|
||||||
directories_switch_searching.underlineText()
|
directories_switch_searching.underlineText()
|
||||||
|
|
||||||
if (!mIsSearchOpen) {
|
if (!mIsSearchOpen) {
|
||||||
|
@ -337,9 +338,9 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
||||||
mStoredCropThumbnails = cropThumbnails
|
mStoredCropThumbnails = cropThumbnails
|
||||||
mStoredScrollHorizontally = scrollHorizontally
|
mStoredScrollHorizontally = scrollHorizontally
|
||||||
mStoredTextColor = textColor
|
mStoredTextColor = textColor
|
||||||
mStoredPrimaryColor = primaryColor
|
|
||||||
mStoredStyleString = "$folderStyle$showFolderMediaCount$limitFolderTitle"
|
mStoredStyleString = "$folderStyle$showFolderMediaCount$limitFolderTitle"
|
||||||
}
|
}
|
||||||
|
mStoredAdjustedPrimaryColor = getAdjustedPrimaryColor()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupSearch(menu: Menu) {
|
private fun setupSearch(menu: Menu) {
|
||||||
|
|
|
@ -77,7 +77,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
|
||||||
private var mStoredShowFileTypes = true
|
private var mStoredShowFileTypes = true
|
||||||
private var mStoredRoundedCorners = false
|
private var mStoredRoundedCorners = false
|
||||||
private var mStoredTextColor = 0
|
private var mStoredTextColor = 0
|
||||||
private var mStoredPrimaryColor = 0
|
private var mStoredAdjustedPrimaryColor = 0
|
||||||
private var mStoredThumbnailSpacing = 0
|
private var mStoredThumbnailSpacing = 0
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@ -150,10 +150,11 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
|
||||||
getMediaAdapter()?.updateTextColor(config.textColor)
|
getMediaAdapter()?.updateTextColor(config.textColor)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mStoredPrimaryColor != config.primaryColor) {
|
val adjustedPrimaryColor = getAdjustedPrimaryColor()
|
||||||
|
if (mStoredAdjustedPrimaryColor != adjustedPrimaryColor) {
|
||||||
getMediaAdapter()?.updatePrimaryColor(config.primaryColor)
|
getMediaAdapter()?.updatePrimaryColor(config.primaryColor)
|
||||||
media_horizontal_fastscroller.updatePrimaryColor()
|
media_horizontal_fastscroller.updatePrimaryColor(adjustedPrimaryColor)
|
||||||
media_vertical_fastscroller.updatePrimaryColor()
|
media_vertical_fastscroller.updatePrimaryColor(adjustedPrimaryColor)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mStoredThumbnailSpacing != config.thumbnailSpacing) {
|
if (mStoredThumbnailSpacing != config.thumbnailSpacing) {
|
||||||
|
@ -310,11 +311,11 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
|
||||||
mStoredScrollHorizontally = scrollHorizontally
|
mStoredScrollHorizontally = scrollHorizontally
|
||||||
mStoredShowFileTypes = showThumbnailFileTypes
|
mStoredShowFileTypes = showThumbnailFileTypes
|
||||||
mStoredTextColor = textColor
|
mStoredTextColor = textColor
|
||||||
mStoredPrimaryColor = primaryColor
|
|
||||||
mStoredThumbnailSpacing = thumbnailSpacing
|
mStoredThumbnailSpacing = thumbnailSpacing
|
||||||
mStoredRoundedCorners = fileRoundedCorners
|
mStoredRoundedCorners = fileRoundedCorners
|
||||||
mShowAll = showAll
|
mShowAll = showAll
|
||||||
}
|
}
|
||||||
|
mStoredAdjustedPrimaryColor = getAdjustedPrimaryColor()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupSearch(menu: Menu) {
|
private fun setupSearch(menu: Menu) {
|
||||||
|
|
Loading…
Reference in a new issue