diff options
author | Allan Wang <me@allanwang.ca> | 2021-01-12 21:15:08 -0800 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2021-01-12 21:15:08 -0800 |
commit | e01e51574613459a036c1d60383bfb229799a407 (patch) | |
tree | 4214c9803638fcc1b9d9e19159651f7115c846c4 /app/src/main/kotlin/com/pitchedapps/frost/activities | |
parent | 0e5c1ab2dd2b574970883576e18f9a119b058788 (diff) | |
download | frost-e01e51574613459a036c1d60383bfb229799a407.tar.gz frost-e01e51574613459a036c1d60383bfb229799a407.tar.bz2 frost-e01e51574613459a036c1d60383bfb229799a407.zip |
Convert all theme access to themeprovider
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/activities')
9 files changed, 82 insertions, 72 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/AboutActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/AboutActivity.kt index 17cac703..74d876cb 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/AboutActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/AboutActivity.kt @@ -47,9 +47,11 @@ import com.mikepenz.iconics.typeface.library.community.material.CommunityMateria import com.mikepenz.iconics.typeface.library.googlematerial.GoogleMaterial import com.pitchedapps.frost.BuildConfig import com.pitchedapps.frost.R +import com.pitchedapps.frost.injectors.ThemeProvider import com.pitchedapps.frost.prefs.Prefs import com.pitchedapps.frost.utils.L import org.koin.android.ext.android.inject +import org.koin.core.component.inject /** * Created by Allan Wang on 2017-06-26. @@ -57,12 +59,13 @@ import org.koin.android.ext.android.inject class AboutActivity : AboutActivityBase(null) { private val prefs: Prefs by inject() + private val themeProvider: ThemeProvider by inject() override fun Configs.buildConfigs() { - textColor = prefs.textColor - accentColor = prefs.accentColor - backgroundColor = prefs.bgColor.withMinAlpha(200) - cutoutForeground = prefs.accentColor + textColor = themeProvider.textColor + accentColor = themeProvider.accentColor + backgroundColor = themeProvider.bgColor.withMinAlpha(200) + cutoutForeground = themeProvider.accentColor cutoutDrawableRes = R.drawable.frost_f_200 faqPageTitleRes = R.string.faq_title faqXmlRes = R.xml.frost_faq diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseActivity.kt index d2ba0a92..0553086c 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseActivity.kt @@ -22,9 +22,11 @@ import ca.allanwang.kau.internal.KauBaseActivity import ca.allanwang.kau.searchview.SearchViewHolder import com.pitchedapps.frost.contracts.VideoViewHolder import com.pitchedapps.frost.facebook.FbCookie +import com.pitchedapps.frost.injectors.ThemeProvider import com.pitchedapps.frost.prefs.Prefs import com.pitchedapps.frost.utils.setFrostTheme import org.koin.android.ext.android.inject +import org.koin.core.component.inject /** * Created by Allan Wang on 2017-06-12. @@ -33,6 +35,7 @@ abstract class BaseActivity : KauBaseActivity() { val fbCookie: FbCookie by inject() val prefs: Prefs by inject() + val themeProvider: ThemeProvider by inject() /** * Inherited consumer to customize back press @@ -48,7 +51,7 @@ abstract class BaseActivity : KauBaseActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - if (this !is WebOverlayActivityBase) setFrostTheme(prefs) + if (this !is WebOverlayActivityBase) setFrostTheme(themeProvider) } override fun onStop() { diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt index e352b2fc..394969cb 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt @@ -210,7 +210,7 @@ abstract class BaseMainActivity : BaseActivity(), MainActivityContract, } setSupportActionBar(toolbar) viewpager.adapter = adapter - tabs.setBackgroundColor(prefs.mainActivityLayout.backgroundColor(prefs)) + tabs.setBackgroundColor(prefs.mainActivityLayout.backgroundColor(themeProvider)) } onNestedCreate(savedInstanceState) L.i { "Main finished loading UI in ${System.currentTimeMillis() - start} ms" } @@ -288,7 +288,7 @@ abstract class BaseMainActivity : BaseActivity(), MainActivityContract, drawer.addDrawerListener(toggle) toggle.syncState() - val foregroundColor = ColorStateList.valueOf(prefs.textColor) + val foregroundColor = ColorStateList.valueOf(themeProvider.textColor) with(navigation) { FrostMenuBuilder(this@BaseMainActivity, menu).apply { @@ -317,9 +317,9 @@ abstract class BaseMainActivity : BaseActivity(), MainActivityContract, launchWebOverlay(item.url, fbCookie, prefs) false } - val navBg = prefs.bgColor.withMinAlpha(200) + val navBg = themeProvider.bgColor.withMinAlpha(200) setBackgroundColor(navBg) - itemBackground = createNavDrawable(prefs.accentColor, navBg) + itemBackground = createNavDrawable(themeProvider.accentColor, navBg) itemTextColor = foregroundColor itemIconTintList = foregroundColor @@ -331,7 +331,7 @@ abstract class BaseMainActivity : BaseActivity(), MainActivityContract, private fun ActivityMainContentBinding.initFab() { hasFab = false shouldShow = false - fab.backgroundTintList = ColorStateList.valueOf(prefs.headerColor.withMinAlpha(200)) + fab.backgroundTintList = ColorStateList.valueOf(themeProvider.headerColor.withMinAlpha(200)) fab.hide() appbar.addOnOffsetChangedListener(AppBarLayout.OnOffsetChangedListener { appBarLayout, verticalOffset -> if (!hasFab) return@OnOffsetChangedListener @@ -351,12 +351,12 @@ abstract class BaseMainActivity : BaseActivity(), MainActivityContract, if (shouldShow) { if (fab.isShown) { fab.fadeScaleTransition { - setIcon(iicon, color = prefs.iconColor) + setIcon(iicon, color = themeProvider.iconColor) } return } } - fab.setIcon(iicon, color = prefs.iconColor) + fab.setIcon(iicon, color = themeProvider.iconColor) fab.showIf(shouldShow) } } @@ -383,7 +383,7 @@ abstract class BaseMainActivity : BaseActivity(), MainActivityContract, private var pendingUpdate: Boolean = false private val binding = ViewNavHeaderBinding.inflate(layoutInflater) val root: View get() = binding.root - private val optionsBackground = prefs.bgColor.withMinAlpha(200).colorToForeground( + private val optionsBackground = themeProvider.bgColor.withMinAlpha(200).colorToForeground( 0.1f ) @@ -448,7 +448,7 @@ abstract class BaseMainActivity : BaseActivity(), MainActivityContract, animator.start() } - val textColor = prefs.textColor + val textColor = themeProvider.textColor fun TextView.setOptionsIcon(iicon: IIcon) { setCompoundDrawablesRelativeWithIntrinsicBounds( @@ -458,7 +458,7 @@ abstract class BaseMainActivity : BaseActivity(), MainActivityContract, null ) setTextColor(textColor) - background = createNavDrawable(prefs.accentColor, optionsBackground) + background = createNavDrawable(themeProvider.accentColor, optionsBackground) } with(optionsLogout) { @@ -506,7 +506,7 @@ abstract class BaseMainActivity : BaseActivity(), MainActivityContract, arrow.setImageDrawable( GoogleMaterial.Icon.gmd_arrow_drop_down.toDrawable( this@BaseMainActivity, - color = prefs.textColor + color = themeProvider.textColor ) ) } @@ -531,10 +531,10 @@ abstract class BaseMainActivity : BaseActivity(), MainActivityContract, avatarTertiary.setAccount(orderedAccounts.getOrNull(2), false) optionsAccountsContainer.removeAllViews() name.text = orderedAccounts.getOrNull(0)?.name - name.setTextColor(prefs.textColor) + name.setTextColor(themeProvider.textColor) val glide = Glide.with(root) val accountSize = dimenPixelSize(R.dimen.drawer_account_avatar_size) - val textColor = prefs.textColor + val textColor = themeProvider.textColor orderedAccounts.forEach { cookie -> val tv = TextView( @@ -568,7 +568,7 @@ abstract class BaseMainActivity : BaseActivity(), MainActivityContract, }) tv.text = cookie.name tv.setTextColor(textColor) - tv.background = createNavDrawable(prefs.accentColor, optionsBackground) + tv.background = createNavDrawable(themeProvider.accentColor, optionsBackground) tv.setOnClickListener { switchAccount(cookie.id) } @@ -626,9 +626,9 @@ abstract class BaseMainActivity : BaseActivity(), MainActivityContract, override fun onCreateOptionsMenu(menu: Menu): Boolean { menuInflater.inflate(R.menu.menu_main, menu) - contentBinding.toolbar.tint(prefs.iconColor) + contentBinding.toolbar.tint(themeProvider.iconColor) setMenuIcons( - menu, prefs.iconColor, + menu, themeProvider.iconColor, R.id.action_settings to GoogleMaterial.Icon.gmd_settings, R.id.action_search to GoogleMaterial.Icon.gmd_search ) @@ -638,7 +638,7 @@ abstract class BaseMainActivity : BaseActivity(), MainActivityContract, private fun bindSearchView(menu: Menu) { searchViewBindIfNull { - bindSearchView(menu, R.id.action_search, prefs.iconColor) { + bindSearchView(menu, R.id.action_search, themeProvider.iconColor) { textCallback = { query, searchView -> val results = searchViewCache[query] if (results != null) @@ -671,8 +671,8 @@ abstract class BaseMainActivity : BaseActivity(), MainActivityContract, ); true } closeListener = { _ -> searchViewCache.clear() } - foregroundColor = prefs.textColor - backgroundColor = prefs.bgColor.withMinAlpha(200) + foregroundColor = themeProvider.textColor + backgroundColor = themeProvider.bgColor.withMinAlpha(200) onItemClick = { _, key, _, _ -> launchWebOverlay(key, fbCookie, prefs) } } } @@ -731,7 +731,7 @@ abstract class BaseMainActivity : BaseActivity(), MainActivityContract, fragmentChannel.offer(REQUEST_REFRESH) } if (hasRequest(REQUEST_NAV)) { - frostNavigationBar(prefs) + frostNavigationBar(prefs, themeProvider) } if (hasRequest(REQUEST_TEXT_ZOOM)) { fragmentChannel.offer(REQUEST_TEXT_ZOOM) diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/DebugActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/DebugActivity.kt index 6067fa82..935b88c9 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/DebugActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/DebugActivity.kt @@ -30,7 +30,7 @@ import com.pitchedapps.frost.R import com.pitchedapps.frost.databinding.ActivityDebugBinding import com.pitchedapps.frost.facebook.FbItem import com.pitchedapps.frost.injectors.JsActions -import com.pitchedapps.frost.prefs.Prefs +import com.pitchedapps.frost.injectors.ThemeProvider import com.pitchedapps.frost.utils.L import com.pitchedapps.frost.utils.createFreshDir import com.pitchedapps.frost.utils.setFrostColors @@ -39,6 +39,7 @@ import kotlin.coroutines.resume import kotlin.coroutines.suspendCoroutine import kotlinx.coroutines.CoroutineExceptionHandler import org.koin.android.ext.android.inject +import org.koin.core.component.inject /** * Created by Allan Wang on 05/01/18. @@ -52,7 +53,7 @@ class DebugActivity : KauBaseActivity() { fun baseDir(context: Context) = File(context.externalCacheDir, "offline_debug") } - private val prefs: Prefs by inject() + private val themeProvider: ThemeProvider by inject() lateinit var binding: ActivityDebugBinding @@ -79,8 +80,8 @@ class DebugActivity : KauBaseActivity() { swipeRefresh.setOnRefreshListener(debugWebview::reload) - fab.visible().setIcon(GoogleMaterial.Icon.gmd_bug_report, prefs.iconColor) - fab.backgroundTintList = ColorStateList.valueOf(prefs.accentColor) + fab.visible().setIcon(GoogleMaterial.Icon.gmd_bug_report, themeProvider.iconColor) + fab.backgroundTintList = ColorStateList.valueOf(themeProvider.accentColor) fab.setOnClickListener { _ -> fab.hide() diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt index 609ed049..7b8ee4d3 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/ImageActivity.kt @@ -55,6 +55,7 @@ import com.pitchedapps.frost.facebook.get import com.pitchedapps.frost.facebook.requests.call import com.pitchedapps.frost.facebook.requests.getFullSizedImageUrl import com.pitchedapps.frost.facebook.requests.requestBuilder +import com.pitchedapps.frost.injectors.ThemeProvider import com.pitchedapps.frost.prefs.Prefs import com.pitchedapps.frost.services.LocalService import com.pitchedapps.frost.utils.ARG_COOKIE @@ -78,6 +79,7 @@ import kotlinx.coroutines.async import kotlinx.coroutines.launch import kotlinx.coroutines.withContext import org.koin.android.ext.android.inject +import org.koin.core.component.inject /** * Created by Allan Wang on 2017-07-15. @@ -85,6 +87,7 @@ import org.koin.android.ext.android.inject class ImageActivity : KauBaseActivity() { private val prefs: Prefs by inject() + private val themeProvider: ThemeProvider by inject() @Volatile internal var errorRef: Throwable? = null @@ -128,7 +131,7 @@ class ImageActivity : KauBaseActivity() { private var bottomBehavior: BottomSheetBehavior<View>? = null private val baseBackgroundColor = if (prefs.blackMediaBg) Color.BLACK - else prefs.bgColor.withMinAlpha(235) + else themeProvider.bgColor.withMinAlpha(235) private fun loadError(e: Throwable) { if (e.message?.contains("<!DOCTYPE html>") == true) { @@ -178,7 +181,7 @@ class ImageActivity : KauBaseActivity() { if (text.isNullOrBlank()) { imageText.gone() } else { - imageText.setTextColor(if (prefs.blackMediaBg) Color.WHITE else prefs.textColor) + imageText.setTextColor(if (prefs.blackMediaBg) Color.WHITE else themeProvider.textColor) imageText.setBackgroundColor( baseBackgroundColor.colorToForeground(0.2f).withAlpha(255) ) @@ -197,7 +200,7 @@ class ImageActivity : KauBaseActivity() { imageText.bringToFront() } } - val foregroundTint = if (prefs.blackMediaBg) Color.WHITE else prefs.accentColor + val foregroundTint = if (prefs.blackMediaBg) Color.WHITE else themeProvider.accentColor fun ImageView.setState(state: FabStates) { setIcon(state.iicon, color = foregroundTint, sizeDp = 24) @@ -352,7 +355,7 @@ class ImageActivity : KauBaseActivity() { internal enum class FabStates( val iicon: IIcon, - val iconColorProvider: (Prefs) -> Int = { it.iconColor }, + val iconColorProvider: (ThemeProvider) -> Int = { it.iconColor }, val backgroundTint: Int = Int.MAX_VALUE ) { ERROR(GoogleMaterial.Icon.gmd_error, { Color.WHITE }, Color.RED) { @@ -405,9 +408,9 @@ internal enum class FabStates( * https://github.com/AllanWang/KAU/issues/184 * */ - fun update(fab: FloatingActionButton, prefs: Prefs) { - val tint = if (backgroundTint != Int.MAX_VALUE) backgroundTint else prefs.accentColor - val iconColor = iconColorProvider(prefs) + fun update(fab: FloatingActionButton, themeProvider: ThemeProvider) { + val tint = if (backgroundTint != Int.MAX_VALUE) backgroundTint else themeProvider.accentColor + val iconColor = iconColorProvider(themeProvider) if (fab.isHidden) { fab.setIcon(iicon, color = iconColor) fab.backgroundTintList = ColorStateList.valueOf(tint) diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/IntroActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/IntroActivity.kt index e8e603ba..f06c3a37 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/IntroActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/IntroActivity.kt @@ -100,21 +100,21 @@ class IntroActivity : KauBaseActivity(), ViewPager.PageTransformer, else finish(next.x + next.pivotX, next.y + next.pivotY) } skip.setOnClickListener { finish() } - ripple.set(prefs.bgColor) + ripple.set(themeProvider.bgColor) theme() } fun theme() { - statusBarColor = prefs.headerColor - navigationBarColor = prefs.headerColor + statusBarColor = themeProvider.headerColor + navigationBarColor = themeProvider.headerColor with(binding) { - skip.setTextColor(prefs.textColor) - next.imageTintList = ColorStateList.valueOf(prefs.textColor) - indicator.setColour(prefs.textColor) + skip.setTextColor(themeProvider.textColor) + next.imageTintList = ColorStateList.valueOf(themeProvider.textColor) + indicator.setColour(themeProvider.textColor) indicator.invalidate() } fragments.forEach { it.themeFragment() } - setFrostTheme(prefs, true) + setFrostTheme(themeProvider, true) } /** @@ -152,21 +152,21 @@ class IntroActivity : KauBaseActivity(), ViewPager.PageTransformer, ).forEach { it?.animate()?.alpha(0f)?.setDuration(600)?.start() } - if (prefs.textColor != Color.WHITE) { + if (themeProvider.textColor != Color.WHITE) { val f = lastView?.findViewById<ImageView>(R.id.intro_image)?.drawable if (f != null) ValueAnimator.ofFloat(0f, 1f).apply { addUpdateListener { - f.setTint(prefs.textColor.blendWith(Color.WHITE, it.animatedValue as Float)) + f.setTint(themeProvider.textColor.blendWith(Color.WHITE, it.animatedValue as Float)) } duration = 600 start() } } - if (prefs.headerColor != blue) { + if (themeProvider.headerColor != blue) { ValueAnimator.ofFloat(0f, 1f).apply { addUpdateListener { - val c = prefs.headerColor.blendWith(blue, it.animatedValue as Float) + val c = themeProvider.headerColor.blendWith(blue, it.animatedValue as Float) statusBarColor = c navigationBarColor = c } @@ -209,7 +209,7 @@ class IntroActivity : KauBaseActivity(), ViewPager.PageTransformer, binding.next.fadeScaleTransition { setIcon( if (barHasNext) GoogleMaterial.Icon.gmd_navigate_next else GoogleMaterial.Icon.gmd_done, - color = prefs.textColor + color = themeProvider.textColor ) } binding.skip.animate().scaleXY(if (barHasNext) 1f else 0f) diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/SettingsActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/SettingsActivity.kt index 90bec985..9ce16ec7 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/SettingsActivity.kt @@ -134,8 +134,8 @@ class SettingsActivity : KPrefActivity() { } override fun kPrefCoreAttributes(): CoreAttributeContract.() -> Unit = { - textColor = { prefs.textColor } - accentColor = { prefs.accentColor } + textColor = { themeProvider.textColor } + accentColor = { themeProvider.accentColor } } override fun onCreateKPrefs(savedInstanceState: Bundle?): KPrefAdapterBuilder.() -> Unit = { @@ -218,18 +218,18 @@ class SettingsActivity : KPrefActivity() { @SuppressLint("MissingSuperCall") override fun onCreate(savedInstanceState: Bundle?) { - setFrostTheme(prefs, true) + setFrostTheme(themeProvider, true) super.onCreate(savedInstanceState) animate = prefs.animate themeExterior(false) } fun themeExterior(animate: Boolean = true) { - if (animate) bgCanvas.fade(prefs.bgColor) - else bgCanvas.set(prefs.bgColor) - if (animate) toolbarCanvas.ripple(prefs.headerColor, RippleCanvas.MIDDLE, RippleCanvas.END) - else toolbarCanvas.set(prefs.headerColor) - frostNavigationBar(prefs) + if (animate) bgCanvas.fade(themeProvider.bgColor) + else bgCanvas.set(themeProvider.bgColor) + if (animate) toolbarCanvas.ripple(themeProvider.headerColor, RippleCanvas.MIDDLE, RippleCanvas.END) + else toolbarCanvas.set(themeProvider.headerColor) + frostNavigationBar(prefs, themeProvider) } override fun onBackPressed() { @@ -244,9 +244,9 @@ class SettingsActivity : KPrefActivity() { override fun onCreateOptionsMenu(menu: Menu): Boolean { menuInflater.inflate(R.menu.menu_settings, menu) - toolbar.tint(prefs.iconColor) + toolbar.tint(themeProvider.iconColor) setMenuIcons( - menu, prefs.iconColor, + menu, themeProvider.iconColor, R.id.action_github to CommunityMaterial.Icon2.cmd_github, R.id.action_changelog to GoogleMaterial.Icon.gmd_info ) diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/TabCustomizerActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/TabCustomizerActivity.kt index 589289ab..f2827397 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/TabCustomizerActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/TabCustomizerActivity.kt @@ -69,15 +69,15 @@ class TabCustomizerActivity : BaseActivity() { } fun ActivityTabCustomizerBinding.init() { - pseudoToolbar.setBackgroundColor(prefs.headerColor) + pseudoToolbar.setBackgroundColor(themeProvider.headerColor) tabRecycler.layoutManager = GridLayoutManager(this@TabCustomizerActivity, TAB_COUNT, RecyclerView.VERTICAL, false) tabRecycler.adapter = adapter tabRecycler.setHasFixedSize(true) - divider.setBackgroundColor(prefs.textColor.withAlpha(30)) - instructions.setTextColor(prefs.textColor) + divider.setBackgroundColor(themeProvider.textColor.withAlpha(30)) + instructions.setTextColor(themeProvider.textColor) launch { val tabs = genericDao.getTabs().toMutableList() @@ -94,8 +94,8 @@ class TabCustomizerActivity : BaseActivity() { setResult(Activity.RESULT_CANCELED) - fabSave.setIcon(GoogleMaterial.Icon.gmd_check, prefs.iconColor) - fabSave.backgroundTintList = ColorStateList.valueOf(prefs.accentColor) + fabSave.setIcon(GoogleMaterial.Icon.gmd_check, themeProvider.iconColor) + fabSave.backgroundTintList = ColorStateList.valueOf(themeProvider.accentColor) fabSave.setOnClickListener { launchMain(NonCancellable) { val tabs = adapter.adapterItems.subList(0, TAB_COUNT).map(TabIItem::item) @@ -104,8 +104,8 @@ class TabCustomizerActivity : BaseActivity() { finish() } } - fabCancel.setIcon(GoogleMaterial.Icon.gmd_close, prefs.iconColor) - fabCancel.backgroundTintList = ColorStateList.valueOf(prefs.accentColor) + fabCancel.setIcon(GoogleMaterial.Icon.gmd_close, themeProvider.iconColor) + fabCancel.backgroundTintList = ColorStateList.valueOf(themeProvider.accentColor) fabCancel.setOnClickListener { finish() } setFrostColors { themeWindow = true diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/WebOverlayActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/WebOverlayActivity.kt index c21f7362..42d84eb7 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/WebOverlayActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/WebOverlayActivity.kt @@ -202,14 +202,14 @@ abstract class WebOverlayActivityBase(private val userAgent: String = USER_AGENT setSupportActionBar(toolbar) supportActionBar?.setDisplayShowHomeEnabled(true) supportActionBar?.setDisplayHomeAsUpEnabled(true) - toolbar.navigationIcon = GoogleMaterial.Icon.gmd_close.toDrawable(this, 16, prefs.iconColor) + toolbar.navigationIcon = GoogleMaterial.Icon.gmd_close.toDrawable(this, 16, themeProvider.iconColor) toolbar.setNavigationOnClickListener { finishSlideOut() } setFrostColors { toolbar(toolbar) themeWindow = false } - coordinator.setBackgroundColor(prefs.bgColor.withAlpha(255)) + coordinator.setBackgroundColor(themeProvider.bgColor.withAlpha(255)) content.bind(this) @@ -268,13 +268,13 @@ abstract class WebOverlayActivityBase(private val userAgent: String = USER_AGENT * Our theme for the overlay should be fully opaque */ fun theme() { - val opaqueAccent = prefs.headerColor.withAlpha(255) + val opaqueAccent = themeProvider.headerColor.withAlpha(255) statusBarColor = opaqueAccent.darken() navigationBarColor = opaqueAccent toolbar.setBackgroundColor(opaqueAccent) - toolbar.setTitleTextColor(prefs.iconColor) - coordinator.setBackgroundColor(prefs.bgColor.withAlpha(255)) - toolbar.overflowIcon?.setTint(prefs.iconColor) + toolbar.setTitleTextColor(themeProvider.iconColor) + coordinator.setBackgroundColor(themeProvider.bgColor.withAlpha(255)) + toolbar.overflowIcon?.setTint(themeProvider.iconColor) } override fun onResume() { @@ -309,7 +309,7 @@ abstract class WebOverlayActivityBase(private val userAgent: String = USER_AGENT override fun onCreateOptionsMenu(menu: Menu): Boolean { menuInflater.inflate(R.menu.menu_web, menu) overlayContext?.onMenuCreate(this, menu) - toolbar.tint(prefs.iconColor) + toolbar.tint(themeProvider.iconColor) return true } |