properly update some colors on change
This commit is contained in:
parent
b526ae5df2
commit
2150ad15e6
|
@ -80,9 +80,8 @@ class MainActivity : SimpleActivity() {
|
|||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
val adjustedPrimaryColor = getAdjustedPrimaryColor()
|
||||
getAllFragments().forEach {
|
||||
it?.setupColors(config.textColor, adjustedPrimaryColor)
|
||||
it?.setupColors(config.textColor, config.primaryColor)
|
||||
}
|
||||
|
||||
if (storedFontSize != config.fontSize) {
|
||||
|
@ -101,9 +100,10 @@ class MainActivity : SimpleActivity() {
|
|||
main_tabs_holder.getTabAt(it)?.icon?.applyColorFilter(config.textColor)
|
||||
}
|
||||
|
||||
val adjustedPrimaryColor = getAdjustedPrimaryColor()
|
||||
main_tabs_holder.background = ColorDrawable(config.backgroundColor)
|
||||
main_tabs_holder.setSelectedTabIndicatorColor(getAdjustedPrimaryColor())
|
||||
main_tabs_holder.getTabAt(main_view_pager.currentItem)?.icon?.applyColorFilter(getAdjustedPrimaryColor())
|
||||
main_tabs_holder.setSelectedTabIndicatorColor(adjustedPrimaryColor)
|
||||
main_tabs_holder.getTabAt(main_view_pager.currentItem)?.icon?.applyColorFilter(adjustedPrimaryColor)
|
||||
|
||||
if (main_view_pager.adapter == null) {
|
||||
initFragments()
|
||||
|
|
|
@ -3,7 +3,6 @@ package com.simplemobiletools.filemanager.pro.adapters
|
|||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.viewpager.widget.PagerAdapter
|
||||
import com.simplemobiletools.commons.extensions.getAdjustedPrimaryColor
|
||||
import com.simplemobiletools.filemanager.pro.R
|
||||
import com.simplemobiletools.filemanager.pro.activities.SimpleActivity
|
||||
import com.simplemobiletools.filemanager.pro.extensions.config
|
||||
|
@ -18,7 +17,7 @@ class ViewPagerAdapter(val activity: SimpleActivity) : PagerAdapter() {
|
|||
|
||||
(view as MyViewPagerFragment).apply {
|
||||
setupFragment(activity)
|
||||
setupColors(activity.config.textColor, activity.getAdjustedPrimaryColor())
|
||||
setupColors(activity.config.textColor, activity.config.primaryColor)
|
||||
}
|
||||
|
||||
return view
|
||||
|
|
|
@ -47,11 +47,12 @@ class ItemsFragment(context: Context, attributeSet: AttributeSet) : MyViewPagerF
|
|||
}
|
||||
}
|
||||
|
||||
override fun setupColors(textColor: Int, adjustedPrimaryColor: Int) {
|
||||
override fun setupColors(textColor: Int, primaryColor: Int) {
|
||||
context!!.updateTextColors(this)
|
||||
items_fastscroller.updatePrimaryColor()
|
||||
storedItems = ArrayList()
|
||||
getRecyclerAdapter()?.apply {
|
||||
updatePrimaryColor(primaryColor)
|
||||
updateTextColor(textColor)
|
||||
initDrawables()
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ abstract class MyViewPagerFragment(context: Context, attributeSet: AttributeSet)
|
|||
|
||||
abstract fun setupFragment(activity: SimpleActivity)
|
||||
|
||||
abstract fun setupColors(textColor: Int, adjustedPrimaryColor: Int)
|
||||
abstract fun setupColors(textColor: Int, primaryColor: Int)
|
||||
|
||||
abstract fun setupFontSize()
|
||||
|
||||
|
|
|
@ -59,7 +59,15 @@ class RecentsFragment(context: Context, attributeSet: AttributeSet) : MyViewPage
|
|||
recents_list.scheduleLayoutAnimation()
|
||||
}
|
||||
|
||||
override fun setupColors(textColor: Int, adjustedPrimaryColor: Int) {}
|
||||
override fun setupColors(textColor: Int, primaryColor: Int) {
|
||||
recents_placeholder.setTextColor(textColor)
|
||||
|
||||
getRecyclerAdapter()?.apply {
|
||||
updatePrimaryColor(primaryColor)
|
||||
updateTextColor(textColor)
|
||||
initDrawables()
|
||||
}
|
||||
}
|
||||
|
||||
private fun setupLayoutManager() {
|
||||
if (context!!.config.getFolderViewType(currentPath) == VIEW_TYPE_GRID) {
|
||||
|
|
Loading…
Reference in New Issue