1
0
mirror of https://github.com/AllanWang/Frost-for-Facebook.git synced 2024-11-10 04:52:38 +01:00

Theme remaining activities

This commit is contained in:
Allan Wang 2017-06-15 17:02:52 -07:00
parent 15d8a70a6c
commit 0d1f0e215b
12 changed files with 71 additions and 96 deletions

View File

@ -1,25 +0,0 @@
[data-sigil="m_login_upsell"] { display: none !important; }
body, #root, #header, .aclb, ._55wo, ._1upc, input, ._2f9r { background: #000 !important; }
button::before, .touch ._56bt, ._56be::before, .btnS, .touch::before, ._5xo2, ._5u5a::before { background: rgba(26, 26, 26, 0.1) !important; }
._56bf, .touch .btn { border-radius: 0 !important; border: 0 !important; }
.touch ._56bt { text-shadow: none !important; }
.touch .btnS { box-shadow: none !important; }
input, ._43mh, .touch .btn, a, .fcg, button, ._52j9, ._52jb, h1, h2, h3, h4, h5, h6 { color: #fff !important; }
::-webkit-input-placeholder { color: #fff !important; }
:-moz-placeholder { color: #fff !important; }
::-moz-placeholder { color: #fff !important; }
:-ms-input-placeholder { color: #fff !important; }
._43mh::before, ._43mh::after { background: #fff !important; }
._1rrd { border: 1px solid #fff !important; color: #fff !important; }

View File

@ -1,48 +0,0 @@
@import "colors";
@import "base";
//Get Android banner
[data-sigil="m_login_upsell"] {
display: none !important;
}
body, #root, #header, .aclb, ._55wo, ._1upc, input, ._2f9r {
background: $background !important;
}
button::before, .touch ._56bt, ._56be::before, .btnS, .touch::before,
._5xo2, ._5u5a::before {
background: $background2 !important;
}
._56bf, .touch .btn {
border-radius: 0 !important;
border: 0 !important;
}
.touch ._56bt {
text-shadow: none !important;
}
.touch .btnS {
box-shadow: none !important;
}
input, ._43mh, .touch .btn, a, .fcg, button, ._52j9, ._52jb, h1, h2, h3, h4, h5, h6 {
color: $text !important;
}
@include placeholder {
color: $text !important;
}
// divider lines
._43mh::before, ._43mh::after {
background: $text !important;
}
._1rrd {
border: 1px solid $text !important;
color: $text !important;
}

View File

@ -4,9 +4,9 @@ body, #root, #header, ._55wo, ._1upc, input, ._2f9r, ._59e9, ._5pz4, ._5lp4, ._5
.jewel, .flyout, ._13e_, ._5-lw, ._5c0e, .jx-result, ._336p { background: #451515 !important; }
button, button::before, .touch ._56bt, ._56be::before, .btnS, .touch::before, ._5xo2, ._5u5a::before, ._4u3j, ._15ks, ._2v9s, ._5hua, ._59tt, ._41ft, .jx-tokenizer, ._4e8n, ._5pxa._3uj9, ._4qax, .aclb, ._4756 { background: rgba(147, 45, 45, 0.2) !important; }
button, button::before, .touch ._56bt, ._56be::before, .btnS, .touch::before, ._5xo2, ._5u5a::before, ._4u3j, ._15ks, ._2v9s, ._5hua, ._59tt, ._41ft, .jx-tokenizer, ._4e8n, ._5pxa._3uj9, ._4qax, .aclb, ._4756 { background: rgba(217, 129, 129, 0.2) !important; }
body, input, ._43mh, .touch .btn, p, span, .fcg, button, ._52j9, ._52jb, ._52ja, ._5j35, ._rnk, ._24u0, ._1g06, ._14ye, textarea, .mentions-input, .mentions-placeholder, .fcw, ._5-7t, .fcl, ._4qas, .thread-title, ._46pa, ._336p, h1, h2, h3, h4, h5, h6 { color: #d7b0d7 !important; }
body, input, ._43mh, .touch .btn, p, span, .fcg, button, ._52j9, ._52jb, ._52ja, ._5j35, ._rnk, ._24u0, ._1g06, ._14ye, textarea, .mentions-input, .mentions-placeholder, .fcw, ._5-7t, .fcl, ._4qas, .thread-title, ._46pa, ._336p, ._1rrd, h1, h2, h3, h4, h5, h6 { color: #d7b0d7 !important; }
::-webkit-input-placeholder { color: #d7b0d7 !important; }
@ -24,11 +24,11 @@ a, ._5fpq { color: #8c8dd6 !important; }
._15ny::after, ._ap1, ._52x1, ._59tu, ._usq, ._13e_, ._59f6._55so::before, ._4gj3, .jx-result, ._5lp5, ._5pz4, ._5lp4, ._5lp5, ._3on6, ._5h6z, ._5h6x { border-bottom: 1px solid rgba(215, 176, 215, 0.3) !important; }
._d4i, ._4e8n, ._uww, .mentions-placeholder, .mentions-shadow, .mentions-measurer, ._5whq, ._59tt, ._41ft::after, .jx-tokenizer, ._3uqf, ._4756 { border: 1px solid rgba(215, 176, 215, 0.3) !important; }
._d4i, ._4e8n, ._uww, .mentions-placeholder, .mentions-shadow, .mentions-measurer, ._5whq, ._59tt, ._41ft::after, .jx-tokenizer, ._3uqf, ._4756, ._1rrd { border: 1px solid rgba(215, 176, 215, 0.3) !important; }
._4o58::after, .acw, .aclb, ._4qax { border-color: rgba(215, 176, 215, 0.3) !important; }
._2ip_ ._2zh4::before, ._2ip_ ._15kk::before, ._2ip_ ._15kk + ._4u3j::before, ._58a0:before { background: rgba(215, 176, 215, 0.3) !important; }
._2ip_ ._2zh4::before, ._2ip_ ._15kk::before, ._2ip_ ._15kk + ._4u3j::before, ._58a0:before, ._43mh::before, ._43mh::after { background: rgba(215, 176, 215, 0.3) !important; }
._56bf, .touch .btn { border-radius: 0 !important; border: 0 !important; }

View File

@ -25,7 +25,7 @@ button, button::before, .touch ._56bt, ._56be::before, .btnS, .touch::before,
}
body, input, ._43mh, .touch .btn, p, span, .fcg, button, ._52j9, ._52jb, ._52ja, ._5j35, ._rnk, ._24u0, ._1g06, ._14ye,
textarea, .mentions-input, .mentions-placeholder, .fcw, ._5-7t, .fcl, ._4qas, .thread-title, ._46pa, ._336p,
textarea, .mentions-input, .mentions-placeholder, .fcw, ._5-7t, .fcl, ._4qas, .thread-title, ._46pa, ._336p, ._1rrd,
h1, h2, h3, h4, h5, h6 {
color: $text !important;
}
@ -58,7 +58,7 @@ a,
//friend card border
._d4i,
._4e8n, ._uww, .mentions-placeholder, .mentions-shadow, .mentions-measurer, ._5whq, ._59tt, ._41ft::after, .jx-tokenizer, ._3uqf, ._4756 {
._4e8n, ._uww, .mentions-placeholder, .mentions-shadow, .mentions-measurer, ._5whq, ._59tt, ._41ft::after, .jx-tokenizer, ._3uqf, ._4756, ._1rrd {
border: 1px solid $divider !important;
}
@ -68,7 +68,7 @@ a,
border-color: $divider !important;
}
._2ip_ ._2zh4::before, ._2ip_ ._15kk::before, ._2ip_ ._15kk + ._4u3j::before, ._58a0:before {
._2ip_ ._2zh4::before, ._2ip_ ._15kk::before, ._2ip_ ._15kk + ._4u3j::before, ._58a0:before, ._43mh::before, ._43mh::after {
background: $divider !important;
}

View File

@ -1,5 +1,6 @@
package com.pitchedapps.frost
import android.graphics.drawable.ColorDrawable
import android.graphics.drawable.Drawable
import android.os.Bundle
import android.os.Handler
@ -7,7 +8,7 @@ import android.support.v4.widget.SwipeRefreshLayout
import android.support.v7.widget.AppCompatTextView
import android.support.v7.widget.Toolbar
import android.widget.ImageView
import ca.allanwang.kau.utils.bindView
import ca.allanwang.kau.utils.*
import com.bumptech.glide.Glide
import com.bumptech.glide.load.DataSource
import com.bumptech.glide.load.engine.GlideException
@ -20,6 +21,7 @@ import com.pitchedapps.frost.facebook.FACEBOOK_COM
import com.pitchedapps.frost.facebook.FbTab
import com.pitchedapps.frost.facebook.PROFILE_PICTURE_URL
import com.pitchedapps.frost.utils.L
import com.pitchedapps.frost.utils.Prefs
import com.pitchedapps.frost.utils.launchNewTask
import com.pitchedapps.frost.views.fadeIn
import com.pitchedapps.frost.views.fadeOut
@ -65,6 +67,7 @@ class LoginActivity : BaseActivity() {
setContentView(R.layout.activity_login)
setSupportActionBar(toolbar)
setTitle(R.string.login)
theme()
web.loginObservable = loginObservable
web.progressObservable = progressObservable
loginObservable.observeOn(AndroidSchedulers.mainThread()).subscribe {
@ -79,6 +82,16 @@ class LoginActivity : BaseActivity() {
web.loadLogin()
}
fun theme() {
val darkAccent = Prefs.headerColor.darken()
statusBarColor = darkAccent.darken().withAlpha(255)
navigationBarColor = darkAccent
toolbar.setBackgroundColor(darkAccent)
toolbar.setTitleTextColor(Prefs.iconColor)
window.setBackgroundDrawable(ColorDrawable(Prefs.bgColor))
toolbar.overflowIcon?.setTint(Prefs.iconColor)
}
fun loadInfo(cookie: CookieModel) {
refresh = true
Observable.zip(SingleToObservable(profileObservable), SingleToObservable(usernameObservable),

View File

@ -87,7 +87,7 @@ class MainActivity : BaseActivity() {
fun theme() {
val darkAccent = Prefs.headerColor.darken()
statusBarColor = darkAccent.withAlpha(255)
statusBarColor = darkAccent.darken().withAlpha(255)
navigationBarColor = darkAccent
tabs.setBackgroundColor(darkAccent)
appBar.setBackgroundColor(darkAccent)
@ -128,6 +128,7 @@ class MainActivity : BaseActivity() {
textColor = Prefs.iconColor.toLong()
backgroundDrawable = ColorDrawable(navHeader)
selectionSecondLineShown = false
paddingBelow = false
cookies().forEach { (id, name) ->
profile(name = name ?: "") {
iconUrl = PROFILE_PICTURE_URL(id)

View File

@ -1,14 +1,17 @@
package com.pitchedapps.frost
import android.graphics.drawable.ColorDrawable
import android.os.Bundle
import android.support.v7.widget.AppCompatTextView
import android.support.v7.widget.GridLayoutManager
import android.support.v7.widget.RecyclerView
import android.view.View
import ca.allanwang.kau.utils.bindView
import ca.allanwang.kau.utils.*
import com.mikepenz.fastadapter.FastAdapter
import com.mikepenz.fastadapter.commons.adapters.FastItemAdapter
import com.mikepenz.fastadapter.listeners.ClickEventHook
import com.pitchedapps.frost.facebook.FbCookie
import com.pitchedapps.frost.utils.Prefs
import com.pitchedapps.frost.utils.cookies
import com.pitchedapps.frost.utils.launchNewTask
import com.pitchedapps.frost.views.AccountItem
@ -20,6 +23,7 @@ class SelectorActivity : BaseActivity() {
val recycler: RecyclerView by bindView(R.id.selector_recycler)
val adapter = FastItemAdapter<AccountItem>()
val text: AppCompatTextView by bindView(R.id.text_select_account)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@ -36,5 +40,17 @@ class SelectorActivity : BaseActivity() {
else FbCookie.switchUser(item.cookie, { launchNewTask(MainActivity::class.java, cookies()) })
}
})
theme()
}
fun theme() {
val darkAccent = Prefs.headerColor.darken()
statusBarColor = darkAccent.darken().withAlpha(255)
navigationBarColor = darkAccent
text.setTextColor(Prefs.textColor)
// toolbar.setBackgroundColor(darkAccent)
// toolbar.setTitleTextColor(Prefs.iconColor)
window.setBackgroundDrawable(ColorDrawable(Prefs.bgColor))
// toolbar.overflowIcon?.setTint(Prefs.iconColor)
}
}

View File

@ -1,10 +1,12 @@
package com.pitchedapps.frost
import android.os.Bundle
import android.support.design.widget.CoordinatorLayout
import android.support.v7.app.AppCompatActivity
import android.support.v7.widget.Toolbar
import ca.allanwang.kau.utils.bindView
import ca.allanwang.kau.utils.*
import com.jude.swipbackhelper.SwipeBackHelper
import com.pitchedapps.frost.utils.Prefs
import com.pitchedapps.frost.utils.url
import com.pitchedapps.frost.web.FrostWebView
@ -16,6 +18,7 @@ class WebOverlayActivity : AppCompatActivity() {
val toolbar: Toolbar by bindView(R.id.overlay_toolbar)
val frostWeb: FrostWebView by bindView(R.id.overlay_frost_webview)
val coordinator: CoordinatorLayout by bindView(R.id.overlay_main_content)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@ -33,6 +36,20 @@ class WebOverlayActivity : AppCompatActivity() {
.setSwipeRelateEnable(true)
.setSwipeRelateOffset(300)
frostWeb.web.addTitleListener({ toolbar.title = it })
theme()
}
/**
* Our theme for the overlay should be fully opaque
*/
fun theme() {
val darkAccent = Prefs.headerColor.darken().withAlpha(255)
statusBarColor = darkAccent.darken()
navigationBarColor = darkAccent
toolbar.setBackgroundColor(darkAccent)
toolbar.setTitleTextColor(Prefs.iconColor)
coordinator.setBackgroundColor(Prefs.bgColor.withAlpha(255))
toolbar.overflowIcon?.setTint(Prefs.iconColor)
}
override fun onPostCreate(savedInstanceState: Bundle?) {

View File

@ -10,7 +10,7 @@ import com.pitchedapps.frost.utils.L
* //TODO add folder mapping using Prefs
*/
enum class CssAssets(val folder: String = "themes") : InjectorContract {
LOGIN("core"), MATERIAL_LIGHT, MATERIAL_DARK, MATERIAL_AMOLED, MATERIAL_GLASS, CUSTOM
MATERIAL_LIGHT, MATERIAL_DARK, MATERIAL_AMOLED, MATERIAL_GLASS, CUSTOM
;
var file = "${name.toLowerCase()}.compact.css"

View File

@ -6,6 +6,7 @@ import android.webkit.WebView
* Created by Allan Wang on 2017-05-31.
*/
enum class CssHider(vararg val items: String) : InjectorContract {
CORE("[data-sigil=\"m_login_upsell\"]"),
HEADER("#header[data-sigil=\"MTopBlueBarHeader\"]", "#header-notices", "[data-sigil*=\"m-promo-jewel-header\"]"),
ADS("[data-xt*=\"is_sponsored.1\"]")
;

View File

@ -8,8 +8,10 @@ import android.webkit.*
import com.pitchedapps.frost.dbflow.CookieModel
import com.pitchedapps.frost.facebook.FACEBOOK_COM
import com.pitchedapps.frost.facebook.FbCookie
import com.pitchedapps.frost.injectors.CssAssets
import com.pitchedapps.frost.injectors.CssHider
import com.pitchedapps.frost.injectors.jsInject
import com.pitchedapps.frost.utils.L
import com.pitchedapps.frost.utils.Prefs
import com.pitchedapps.frost.views.fadeIn
import com.pitchedapps.frost.views.snackbar
import io.reactivex.subjects.PublishSubject
@ -19,9 +21,6 @@ import io.reactivex.subjects.Subject
/**
* Created by Allan Wang on 2017-05-29.
*
* Courtesy of takahirom
*
* https://github.com/takahirom/webview-in-coordinatorlayout/blob/master/app/src/main/java/com/github/takahirom/webview_in_coodinator_layout/NestedWebView.java
*/
@ -64,8 +63,8 @@ class LoginWebView @JvmOverloads constructor(
fun setupWebview() {
settings.javaScriptEnabled = true
setLayerType(View.LAYER_TYPE_HARDWARE, null)
setWebViewClient(LoginClient())
setWebChromeClient(LoginChromeClient())
webViewClient = LoginClient()
webChromeClient = LoginChromeClient()
}
fun loadLogin() {
@ -83,10 +82,12 @@ class LoginWebView @JvmOverloads constructor(
return
}
cookieObservable.onNext(Pair(url, CookieManager.getInstance().getCookie(url)))
CssAssets.LOGIN.inject(view, {
if (view.visibility == View.INVISIBLE)
view.fadeIn(offset = 150L)
})
view.jsInject(CssHider.HEADER, CssHider.CORE,
Prefs.themeInjector,
callback = {
if (view.visibility != View.VISIBLE)
view.fadeIn(offset = 150L)
})
}
}

View File

@ -5,7 +5,6 @@
android:id="@+id/overlay_main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:fitsSystemWindows="true"
tools:context=".WebOverlayActivity">