diff options
author | Allan Wang <me@allanwang.ca> | 2017-08-20 11:33:30 -0700 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2017-08-20 11:33:30 -0700 |
commit | 62e10aa1295bdcd99e307b22b4747bb5353cd5d7 (patch) | |
tree | 4bda456b228adae88e7bd86d3ac317da489cbf5d | |
parent | 14efdd91a4ac11babec7f182ce78f3a1a1b27a00 (diff) | |
download | frost-62e10aa1295bdcd99e307b22b4747bb5353cd5d7.tar.gz frost-62e10aa1295bdcd99e307b22b4747bb5353cd5d7.tar.bz2 frost-62e10aa1295bdcd99e307b22b4747bb5353cd5d7.zip |
Fix material light theme so colors do not get covered
6 files changed, 47 insertions, 34 deletions
diff --git a/app/src/main/assets/css/themes/material_light.compact.css b/app/src/main/assets/css/themes/material_light.compact.css index bb521c35..fe7ba3e8 100644 --- a/app/src/main/assets/css/themes/material_light.compact.css +++ b/app/src/main/assets/css/themes/material_light.compact.css @@ -1,16 +1,16 @@ -#viewport { background: #f5f5f5 !important; } +#viewport { background: #fff !important; } -body, #root, #header, [style*="background-color"], ._1upc, input, ._2f9r, ._59e9, ._5pz4, ._5lp4, ._5lp5, .container, .subpage, ._5n_f, #static_templates, ._22_8, ._1t4h, ._uoq, ._55wo, ._1g05, .tlBody, #timelineBody, .timelineX, .timeline, .feed, .tlPrelude, .tlFeedPlaceholder, ._4_d0, .al, ._1gkq, ._5c5b, ._1qxg, ._5luf, ._2new, ._cld, ._3zvb, ._2nk0, .btnD, .btnI, ._11ub, ._5p7j, ._55wm, ._5rgs, ._5xuj, ._1sv1, ._45fu, ._18qg, ._1_ac, ._5w3g, ._3e18, ._10c_, ._2jl2, ._5q_r, ._5yt8, ._idb, ._2ip_, ._f6s, ._2l5v, ._8i2, ._kr5, ._d4i, ._577z, ._2u4w, ._3u9p, ._3u9t, ._2v9s, ._cw4, ._5_y-, ._5_y_, ._5_z3, ._cwy, ._5_z0, ._5_z1, ._5_z2, ._2mtc, ._206a, ._1_-1, ._1ybg, .appCenterCategorySelectorButton, ._5c9u, div._5y57::before, ._59f6._55so::before, .structuredPublisher, ._94v, ._vqv, ._5lp5, ._55wm, ._2om3, ._2ol-, ._1f9d, ._vee, ._31a-, ._3r8b, ._3r9d, .acw, ._4_xl, ._1p70, ._1p70, ._1ih_, ._51v6, ._u2c, ._484w, ._3ils, ._rm7, ._32qk, ._d01, ._2y60, ._5fu3, ._2foa, ._2y5_, ._38o9, ._1kb, .mAppCenterFatLabel, ._3f50, .mentions-placeholder, .mentions, .mentions-shadow, .mentions-measurer, .acg, ._59tu, ._52z5, ._4l9b, ._4gj3, .groupChromeView, ._uww, textarea, ._15n_, ._skt, ._5f28, ._14_j, ._3bg5, ._53_-, ._52x1 { background: #f5f5f5 !important; } +body, #root, #header, [style*="background-color"], ._1upc, input, ._2f9r, ._59e9, ._5pz4, ._5lp4, ._5lp5, .container, .subpage, ._5n_f, #static_templates, ._22_8, ._1t4h, ._uoq, ._55wo, ._1g05, .tlBody, #timelineBody, .timelineX, .timeline, .feed, .tlPrelude, .tlFeedPlaceholder, ._4_d0, .al, ._1gkq, ._5c5b, ._1qxg, ._5luf, ._2new, ._cld, ._3zvb, ._2nk0, .btnD, .btnI, ._11ub, ._5p7j, ._55wm, ._5rgs, ._5xuj, ._1sv1, ._45fu, ._18qg, ._1_ac, ._5w3g, ._3e18, ._10c_, ._2jl2, ._5q_r, ._5yt8, ._idb, ._2ip_, ._f6s, ._2l5v, ._8i2, ._kr5, ._d4i, ._577z, ._2u4w, ._3u9p, ._3u9t, ._2v9s, ._cw4, ._5_y-, ._5_y_, ._5_z3, ._cwy, ._5_z0, ._5_z1, ._5_z2, ._2mtc, ._206a, ._1_-1, ._1ybg, .appCenterCategorySelectorButton, ._5c9u, div._5y57::before, ._59f6._55so::before, .structuredPublisher, ._94v, ._vqv, ._5lp5, ._55wm, ._2om3, ._2ol-, ._1f9d, ._vee, ._31a-, ._3r8b, ._3r9d, .acw, ._4_xl, ._1p70, ._1p70, ._1ih_, ._51v6, ._u2c, ._484w, ._3ils, ._rm7, ._32qk, ._d01, ._2y60, ._5fu3, ._2foa, ._2y5_, ._38o9, ._1kb, .mAppCenterFatLabel, ._3f50, .mentions-placeholder, .mentions, .mentions-shadow, .mentions-measurer, .acg, ._59tu, ._52z5, ._4l9b, ._4gj3, .groupChromeView, ._uww, textarea, ._15n_, ._skt, ._5f28, ._14_j, ._3bg5, ._53_-, ._52x1 { background: #fff !important; } -._cv_, ._2sq8 { background-color: #f5f5f5 !important; } +._cv_, ._2sq8 { background-color: #fff !important; } #page, ._8l7 { background: transparent !important; } -.jewel, .flyout, ._13e_, ._5-lw, ._5c0e, .jx-result, ._336p, .mentions-suggest-item, .mentions-suggest { background: whitesmoke !important; } +.jewel, .flyout, ._13e_, ._5-lw, ._5c0e, .jx-result, ._336p, .mentions-suggest-item, .mentions-suggest { background: white !important; } -._403n, ._1-kc { background: white !important; } +._403n, ._1-kc { background: #a6a6a6 !important; } -button:not([style*=image]), button::before, .touch ._56bt, ._56be::before, .btnS, .touch::before, ._590n, ._4g8h, ._2cpp, article._55wo, .timeline .timelinePublisher, .touched._52x6, .item a.primary.touched .primarywrap, ._5xo2, ._5u5a::before, ._4u3j, ._15ks, ._5hua, ._59tt, ._41ft, .jx-tokenizer, ._55fj, .excessItem, .acr, ._5-lx, ._3g9-, ._4e8n, ._5pxa._3uj9, ._5n_5, ._u2d, ._56bu::before, ._5h8f, ._d00, ._2066, ._2k51, ._4qax, .aclb, ._4756, ._w34, ._56bv::before, ._5769, ._34iv, ._z-w, ._t21, .acbk { background: #fff !important; } +button:not([style*=image]), button::before, .touch ._56bt, ._56be::before, .btnS, .touch::before, ._590n, ._4g8h, ._2cpp, article._55wo, .timeline .timelinePublisher, .touched._52x6, .item a.primary.touched .primarywrap, ._5xo2, ._5u5a::before, ._4u3j, ._15ks, ._5hua, ._59tt, ._41ft, .jx-tokenizer, ._55fj, .excessItem, .acr, ._5-lx, ._3g9-, ._4e8n, ._5pxa._3uj9, ._5n_5, ._u2d, ._56bu::before, ._5h8f, ._d00, ._2066, ._2k51, ._4qax, .aclb, ._4756, ._w34, ._56bv::before, ._5769, ._34iv, ._z-w, ._t21, .acbk { background: rgba(166, 166, 166, 0.2) !important; } [style*="color"], body, input, ._42rv, ._4qau, ._dwm .descArea, ._eu5, ._1tcc, ._3g9-, ._29z_, ._z-z, ._z-v, ._1e8d, ._36nl, ._36nm, ._2_11, ._2_rf, ._2ip_, ._403p, ._5xu2, ._3ml8, ._3mla, ._50vk, ._1m2u, ._43mh, .touch .btn, p, span, .fcg, button, ._52j9, ._52jb, ._52ja, ._5j35, ._rnk, ._24u0, ._1g06, ._14ye, .fcb, ._56cz._56c_, ._1gk_, ._55fj, ._45fu, ._18qg, ._1_ac, textarea, ._24pi, ._4en9, ._1kb, ._5p7j, ._2klz, ._5780, ._5781, ._5782, ._3u9u, ._3u9_, ._3u9s, ._1hcx, ._2066, ._1_-1, ._cv_, ._1nbx, ._2cuh, ._4ms9, ._4ms5, ._4ms6, ._31b4, ._31b5, ._5q_r, ._idb, ._27vp, ._4nwe, ._4nw9, ._27vi, .appCenterAppInfo, .appCenterPermissions, ._3c9l, ._3c9m, ._4jn_, ._32qt, ._3mom, ._3moo, ._-7o, ._d00, ._d01, ._559g, ._2new, .appCenterCategorySelectorButton, .mentions-input, .mentions-placeholder, .largeStatusBox .placeHolder, .fcw, ._5-7t, .fcl, ._4qas, .thread-title, .title, ._46pa, ._336p, ._1rrd, ._2om4, ._3m1m, ._2om2, ._5n_e, .appListExplanation, ._5yt8, ._8he, ._2luw, ._5rgs, h1, h2, h3, h4, h5, h6 { color: #000 !important; } @@ -40,7 +40,7 @@ strong > a, ._15ks ._2q8z._2q8z { color: #3b5998 !important; } [data-sigil="m-loading-indicator-animate m-loading-indicator-root"] { display: none !important; } -._2cis { border-left: 10px solid #f5f5f5 !important; border-right: 10px solid #f5f5f5 !important; } +._2cis { border-left: 10px solid #fff !important; border-right: 10px solid #fff !important; } ._2cir.selected, ._42rv { border-bottom: 3px solid #000 !important; } @@ -58,21 +58,21 @@ a, ._5fpq { color: #111 !important; } .excessItem { outline: rgba(0, 0, 0, 0.3) !important; } -@-webkit-keyframes highlightFade { 0% { background: #fff; } - 50% { background: #fff; } - 100% { background: #f5f5f5; } } +@-webkit-keyframes highlightFade { 0% { background: rgba(166, 166, 166, 0.2); } + 50% { background: rgba(166, 166, 166, 0.2); } + 100% { background: #fff; } } -@-moz-keyframes highlightFade { 0% { background: #fff; } - 50% { background: #fff; } - 100% { background: #f5f5f5; } } +@-moz-keyframes highlightFade { 0% { background: rgba(166, 166, 166, 0.2); } + 50% { background: rgba(166, 166, 166, 0.2); } + 100% { background: #fff; } } -@-ms-keyframes highlightFade { 0% { background: #fff; } - 50% { background: #fff; } - 100% { background: #f5f5f5; } } +@-ms-keyframes highlightFade { 0% { background: rgba(166, 166, 166, 0.2); } + 50% { background: rgba(166, 166, 166, 0.2); } + 100% { background: #fff; } } -@keyframes highlightFade { 0% { background: #fff; } - 50% { background: #fff; } - 100% { background: #f5f5f5; } } +@keyframes highlightFade { 0% { background: rgba(166, 166, 166, 0.2); } + 50% { background: rgba(166, 166, 166, 0.2); } + 100% { background: #fff; } } ._50uu { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='%23000' viewBox='0 -10 50 50'%3E%3Ccircle cx='25' cy='23' r='3.2'/%3E%3Cpath d='M22 13l-1.83 2H17c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V17c0-1.1-.9-2-2-2h-3.17L28 13h-6zm3 15c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5z'/%3E%3Cpath fill='none' d='M13 11h24v24H13z'/%3E%3C/svg%3E") no-repeat !important; } diff --git a/app/src/main/assets/css/themes/material_light.scss b/app/src/main/assets/css/themes/material_light.scss index eeefb60b..60e5094b 100644 --- a/app/src/main/assets/css/themes/material_light.scss +++ b/app/src/main/assets/css/themes/material_light.scss @@ -1,8 +1,10 @@ $text: #000; $link: #111; $accent: #3b5998; -$background: #f5f5f5; -$background2: #fff; +$background: #fff; +// this is actually the inverse of material light (bg should be gray, cards should be white), +// but it looks better than the alternative +$background2: rgba(darken($background, 35%), 0.2) !default; $bg_transparent: $background; @import "../core/main"; diff --git a/app/src/main/kotlin/com/pitchedapps/frost/dbflow/CookiesDb.kt b/app/src/main/kotlin/com/pitchedapps/frost/dbflow/CookiesDb.kt index 92cdf503..949659f6 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/dbflow/CookiesDb.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/dbflow/CookiesDb.kt @@ -32,7 +32,8 @@ object CookiesDb { @Table(database = CookiesDb::class, allFields = true, primaryKeyConflict = ConflictAction.REPLACE) data class CookieModel(@PrimaryKey var id: Long = -1L, var name: String? = null, var cookie: String? = null) : BaseModel(), Parcelable { companion object { - @JvmField val CREATOR = PaperParcelCookieModel.CREATOR + @JvmField + val CREATOR = PaperParcelCookieModel.CREATOR } override fun describeContents() = 0 @@ -60,14 +61,13 @@ fun saveFbCookie(cookie: CookieModel, callback: (() -> Unit)? = null) { } fun removeCookie(id: Long) { - loadFbCookie(id)?.async?.delete({ + loadFbCookie(id)?.async?.delete { L.d("Fb cookie deleted", id.toString()) - }) + } } fun CookieModel.fetchUsername(callback: (String) -> Unit) { - ReactiveNetwork.checkInternetConnectivity().subscribeOn(Schedulers.io()).subscribe { - yes, _ -> + ReactiveNetwork.checkInternetConnectivity().subscribeOn(Schedulers.io()).subscribe { yes, _ -> if (!yes) return@subscribe callback("") var result = "" try { diff --git a/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbCookie.kt b/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbCookie.kt index 3b0125be..40cef772 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbCookie.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbCookie.kt @@ -19,9 +19,9 @@ object FbCookie { val webCookie: String? get() = CookieManager.getInstance().getCookie(FB_URL_BASE) - fun setWebCookie(cookie: String?, callback: (() -> Unit)?) { + private fun setWebCookie(cookie: String?, callback: (() -> Unit)?) { with(CookieManager.getInstance()) { - removeAllCookies({ + removeAllCookies { if (cookie == null) { callback?.invoke() return@removeAllCookies @@ -29,12 +29,12 @@ object FbCookie { L.d("Setting cookie", cookie) val cookies = cookie.split(";").map { Pair(it, SingleSubject.create<Boolean>()) } cookies.forEach { (cookie, callback) -> setCookie(FB_URL_BASE, cookie, { callback.onSuccess(it) }) } - Observable.zip<Boolean, Unit>(cookies.map { (_, callback) -> callback.toObservable() }, {}).subscribeOn(AndroidSchedulers.mainThread()).subscribe({ + Observable.zip<Boolean, Unit>(cookies.map { (_, callback) -> callback.toObservable() }, {}).subscribeOn(AndroidSchedulers.mainThread()).subscribe { callback?.invoke() L.d("Cookies set", webCookie) flush() - }) - }) + } + } } } @@ -61,10 +61,10 @@ object FbCookie { fun reset(callback: () -> Unit) { Prefs.userId = -1L with(CookieManager.getInstance()) { - removeAllCookies({ + removeAllCookies { flush() callback() - }) + } } } 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 1dbf651e..53745602 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt @@ -11,6 +11,7 @@ import com.pitchedapps.frost.activities.LoginActivity import com.pitchedapps.frost.activities.MainActivity import com.pitchedapps.frost.activities.SelectorActivity import com.pitchedapps.frost.activities.WebOverlayActivity +import com.pitchedapps.frost.dbflow.removeCookie import com.pitchedapps.frost.facebook.FB_URL_BASE import com.pitchedapps.frost.facebook.FbCookie import com.pitchedapps.frost.facebook.FbItem @@ -52,7 +53,10 @@ open class FrostWebViewClient(val webCore: FrostWebViewCore) : BaseWebViewClient refreshObservable.onNext(true) if (!url.isFacebookUrl) return if (url.contains("logout.php")) FbCookie.logout(Prefs.userId, { launchLogin(view.context) }) - else if (url.contains("login.php")) FbCookie.reset({ launchLogin(view.context) }) + else if (url.contains("login.php")) { + removeCookie(Prefs.userId) // cookie is invalid + FbCookie.reset({ launchLogin(view.context) }) + } } diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/LoginWebView.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/LoginWebView.kt index dd8e2390..6bf04ae1 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/web/LoginWebView.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/web/LoginWebView.kt @@ -2,6 +2,7 @@ package com.pitchedapps.frost.web import android.annotation.SuppressLint import android.content.Context +import android.graphics.Color import android.util.AttributeSet import android.view.View import android.webkit.* @@ -17,6 +18,7 @@ import com.pitchedapps.frost.utils.Prefs import com.pitchedapps.frost.utils.isFacebookUrl import org.jetbrains.anko.doAsync import org.jetbrains.anko.uiThread +import org.jetbrains.anko.withAlpha /** * Created by Allan Wang on 2017-05-29. @@ -74,6 +76,11 @@ class LoginWebView @JvmOverloads constructor( } } + override fun onPageCommitVisible(view: WebView, url: String?) { + super.onPageCommitVisible(view, url) + view.setBackgroundColor(Color.TRANSPARENT) + } + override fun shouldOverrideUrlLoading(view: WebView, request: WebResourceRequest): Boolean { //For now, we will ignore all attempts to launch external apps during login if (request.url == null || request.url.scheme == "intent" || request.url.scheme == "android-app") |