From c4453c85557d2dbf24fa72def544335fe5782182 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Sun, 24 Sep 2017 16:18:23 -0400 Subject: Fix background color for non facebook pages (#335) --- .../main/kotlin/com/pitchedapps/frost/injectors/CssAssets.kt | 2 +- .../kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'app/src/main/kotlin/com/pitchedapps') diff --git a/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssAssets.kt b/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssAssets.kt index cf935360..3155b11a 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssAssets.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssAssets.kt @@ -39,7 +39,7 @@ enum class CssAssets(val folder: String = "themes") : InjectorContract { .replace("\$BT\$", bt) .replace("\$BBT\$", Prefs.bgColor.withAlpha(51).colorToForeground(0.35f).toRgbaString()) .replace("\$O\$", Prefs.bgColor.withAlpha(255).toRgbaString()) - .replace("\$OO\$", Prefs.bgColor.colorToForeground(0.35f).withAlpha(255).toRgbaString()) + .replace("\$OO\$", Prefs.bgColor.withAlpha(255).colorToForeground(0.35f).toRgbaString()) .replace("\$D\$", Prefs.textColor.adjustAlpha(0.3f).toRgbaString()) } injector = JsBuilder().css(content).build() diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt index c398469c..31aaaa6f 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt @@ -50,7 +50,6 @@ open class FrostWebViewClient(val webCore: FrostWebViewCore) : BaseWebViewClient refreshObservable.onNext(true) } - fun launchLogin(c: Context) { if (c is MainActivity && c.cookies().isNotEmpty()) c.launchNewTask(SelectorActivity::class.java, c.cookies()) @@ -58,8 +57,15 @@ open class FrostWebViewClient(val webCore: FrostWebViewCore) : BaseWebViewClient c.launchNewTask(LoginActivity::class.java) } - private fun injectBackgroundColor() - = webCore.setBackgroundColor(if (isMain) Color.TRANSPARENT else Prefs.bgColor.withAlpha(255)) + private fun injectBackgroundColor() { + webCore.setBackgroundColor( + when { + isMain -> Color.TRANSPARENT + webCore.url.isFacebookUrl -> Prefs.bgColor.withAlpha(255) + else -> Color.WHITE + } + ) + } override fun onPageCommitVisible(view: WebView, url: String?) { -- cgit v1.2.3