aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/proguard-rules.pro4
-rw-r--r--app/src/main/AndroidManifest.xml2
-rw-r--r--app/src/main/assets/css/themes/custom.compact.css49
-rw-r--r--app/src/main/assets/css/themes/custom.scss10
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt7
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/SettingsActivity.kt9
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/injectors/CssAssets.kt15
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/utils/Theme.kt2
-rw-r--r--app/src/main/res/layout/login_webview.xml4
-rw-r--r--app/src/main/res/values/strings.xml1
10 files changed, 92 insertions, 11 deletions
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
index 20fe7237..688a0d88 100644
--- a/app/proguard-rules.pro
+++ b/app/proguard-rules.pro
@@ -24,4 +24,6 @@
}
-keepattributes JavascriptInterface
# Jsoup
--keeppackagenames org.jsoup.nodes \ No newline at end of file
+-keeppackagenames org.jsoup.nodes
+# IAB
+-keep class com.android.vending.billing.** \ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 7f9f038f..05b96a5e 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -7,7 +7,7 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<!--<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />-->
- <!--<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />-->
+ <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<!--<uses-permission android:name="android.permission.VIBRATE" />-->
<!--<uses-permission android:name="android.permission.USE_FINGERPRINT" />-->
diff --git a/app/src/main/assets/css/themes/custom.compact.css b/app/src/main/assets/css/themes/custom.compact.css
new file mode 100644
index 00000000..5711b7ae
--- /dev/null
+++ b/app/src/main/assets/css/themes/custom.compact.css
@@ -0,0 +1,49 @@
+#viewport { background: $B$ !important; }
+
+body, #root, #header, [style*="background-color"], ._55wo, ._1upc, input, ._2f9r, ._59e9, ._5pz4, ._5lp4, ._5lp5, .container, .subpage, ._5n_f, #static_templates, .tlBody, #timelineBody, .timelineX, .timeline, .feed, .tlPrelude, .tlFeedPlaceholder, ._4_d0, .al, ._1gkq, ._5c5b, ._1qxg, ._5luf, ._2new, ._11ub, ._5p7j, ._55wm, ._5rgs, ._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: transparent !important; }
+
+._cv_, ._2sq8 { background-color: transparent !important; }
+
+.jewel, .flyout, ._13e_, ._5-lw, ._5c0e, .jx-result, ._336p { background: $O$ !important; }
+
+button, button::before, .touch ._56bt, ._56be::before, .btnS, .touch::before, ._590n, ._4g8h, ._5xo2, ._5u5a::before, ._4u3j, ._15ks, ._5hua, ._59tt, ._41ft, .jx-tokenizer, ._55fj, .excessItem, ._4e8n, ._5pxa._3uj9, ._5n_5, ._u2d, ._56bu::before, ._5h8f, ._d00, ._2066, ._4qax, .aclb, ._4756, ._w34, ._56bv::before, ._5769, ._34iv, .acbk { background: $BB$ !important; }
+
+[style*="color"], body, input, ._43mh, .touch .btn, p, span, .fcg, button, ._52j9, ._52jb, ._52ja, ._5j35, ._rnk, ._24u0, ._1g06, ._14ye, .fcb, ._56cz._56c_, ._1gk_, ._55fj, textarea, ._24pi, ._4en9, ._1kb, ._5p7j, ._2klz, ._5780, ._5781, ._5782, ._3u9u, ._3u9_, ._3u9s, ._1hcx, ._2066, ._1_-1, ._cv_, ._1nbx, ._2cuh, ._4ms9, ._4ms5, ._4ms6, ._31b4, ._31b5, ._27vp, ._4nwe, ._4nw9, ._27vi, .appCenterAppInfo, .appCenterPermissions, ._3c9l, ._3c9m, ._4jn_, ._32qt, ._3mom, ._3moo, ._-7o, ._d00, ._d01, ._559g, ._2new, .appCenterCategorySelectorButton, .mentions-input, .mentions-placeholder, .fcw, ._5-7t, .fcl, ._4qas, .thread-title, .title, ._46pa, ._336p, ._1rrd, ._2om4, ._3m1m, ._2om2, ._5n_e, .appListExplanation, h1, h2, h3, h4, h5, h6 { color: $T$ !important; }
+
+._15kl::before, ._5j35::after, ._2k4b, ._3to7, ._4nw8 { border-left: 1px solid $D$ !important; }
+
+._4_d1 { border-right: 1px solid $D$ !important; }
+
+._1mx0, ._15n_, ._3-2-, ._27ve, ._2s20, ._gui, ._2s21 > *::after, ._32qk, ._d00, ._d01, ._38o9, ._2u4w, ._3u9t, ._55fj, ._52x1, ._3wjp, ._usq, ._2cul:before, ._13e_, .jewel .flyout, ._3bg5 ._52x6, ._3on6, ._2om3, ._2ol-, ._56d8, .al, ._1gkq, ._5fjv, ._5fjw, ._4z83 { border-top: 1px solid $D$ !important; }
+
+._15ny::after, ._2u4w, ._577z:not(:last-child) ._ygd, ._3u9u, ._3mgz, ._52x6, ._2066, ._5luf, .mAppCenterFatLabel, .appCenterCategorySelectorButton, ._ap1, ._52x1, ._59tu, ._usq, ._13e_, ._59f6._55so::before, ._4gj3, .jx-result, ._2om3, ._2ol-, ._1f9d, ._vef, ._55x2 > *, .al, ._44qk, ._1gkq, ._5rgs, ._5lp5, ._3-2-, ._3to6, ._ir5, ._4nw6, ._4nwh, ._27ve, div._51v6::before, ._3c9h::before, ._2s20, ._gui, ._5jku, ._2foa, ._2y60, ._5fu3, ._4en9, ._1kb:not(:last-child) ._1kc, ._5pz4, ._5lp4, ._5lp5, ._3on6, ._5h6z, ._5h6x, ._2om4, ._5fjw > div, ._5fjv > :first-child, ._5fjw > :first-child, ._5fjv, ._5fjw, ._4z83 { border-bottom: 1px solid $D$ !important; }
+
+._d4i, ._1_y5, ._lr0, ._5hgt, ._4e8n, ._uww, .mentions-placeholder, .mentions-shadow, .mentions-measurer, ._5whq, ._59tt, ._41ft::after, .jx-tokenizer, ._3uqf, ._4756, ._1rrd, ._5n_f { border: 1px solid $D$ !important; }
+
+._4o58::after, .acw, .aclb, ._4qax, ._5h8f { border-color: $D$ !important; }
+
+._2ip_ ._2zh4::before, ._2ip_ ._15kk::before, ._2ip_ ._15kk + ._4u3j::before, ._58a0:before, ._43mh::before, ._43mh::after, ._1_-1::before { background: $D$ !important; }
+
+._56bf, .touch .btn { border-radius: 0 !important; border: 0 !important; }
+
+*, *::after, *::before { text-shadow: none !important; box-shadow: none !important; }
+
+[data-sigil="m-loading-indicator-animate m-loading-indicator-root"] { display: none !important; }
+
+._2cis { border-left: 10px solid transparent !important; border-right: 10px solid transparent !important; }
+
+._2cir.selected { border-bottom: 3px solid $T$ !important; }
+
+._484w.selected > ._6zf, ._5kqs::after { border-bottom: 1px solid $T$ !important; }
+
+::-webkit-input-placeholder { color: $T$ !important; }
+
+:-moz-placeholder { color: $T$ !important; }
+
+::-moz-placeholder { color: $T$ !important; }
+
+:-ms-input-placeholder { color: $T$ !important; }
+
+a, ._5fpq { color: $TT$ !important; }
+
+.excessItem { outline: $D$ !important; }
diff --git a/app/src/main/assets/css/themes/custom.scss b/app/src/main/assets/css/themes/custom.scss
new file mode 100644
index 00000000..24b36760
--- /dev/null
+++ b/app/src/main/assets/css/themes/custom.scss
@@ -0,0 +1,10 @@
+$bg_transparent: transparent;
+$text: unquote('$T$');
+$link: unquote('$TT$');
+$background: unquote('$B$');
+$background2: unquote('$BB$');
+$bg_opaque: unquote('$O$');
+$divider: unquote('$D$');
+
+
+@import "../core/main";
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt
index 08293f0e..ab3ffd09 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/MainActivity.kt
@@ -36,6 +36,7 @@ import com.pitchedapps.frost.facebook.FbCookie.switchUser
import com.pitchedapps.frost.facebook.FbTab
import com.pitchedapps.frost.facebook.PROFILE_PICTURE_URL
import com.pitchedapps.frost.fragments.WebFragment
+import com.pitchedapps.frost.injectors.CssAssets
import com.pitchedapps.frost.utils.*
import com.pitchedapps.frost.views.BadgedIcon
import io.reactivex.android.schedulers.AndroidSchedulers
@@ -103,7 +104,7 @@ class MainActivity : BaseActivity() {
Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
.setAction("Action", null).show()
}
- setFrostColors(toolbar, headers = arrayOf(tabs, appBar), backgrounds = arrayOf(viewPager))
+ setFrostColors(toolbar, themeWindow = false, headers = arrayOf(tabs, appBar), backgrounds = arrayOf(viewPager))
}
fun tabsForEachView(action: (position: Int, view: BadgedIcon) -> Unit) {
@@ -302,7 +303,9 @@ class MainActivity : BaseActivity() {
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
- if (resultCode == REQUEST_RESTART) restart()
+ if (resultCode == REQUEST_RESTART) {
+ restart()
+ }
}
override fun onResume() {
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/SettingsActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/SettingsActivity.kt
index f6e5f2bf..92e29cb2 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/SettingsActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/SettingsActivity.kt
@@ -11,6 +11,7 @@ import ca.allanwang.kau.kpref.items.KPrefColorPicker
import ca.allanwang.kau.utils.*
import ca.allanwang.kau.views.RippleCanvas
import com.mikepenz.google_material_typeface_library.GoogleMaterial
+import com.pitchedapps.frost.injectors.CssAssets
import com.pitchedapps.frost.utils.*
import com.pitchedapps.frost.views.Keywords
@@ -76,13 +77,17 @@ class SettingsActivity : KPrefActivity() {
allowCustom = true
}
- colorPicker(R.string.text_color, { Prefs.customTextColor }, { Prefs.customTextColor = it; reload() }) {
+ fun invalidateCustomTheme() {
+ CssAssets.CUSTOM.injector = null
+ }
+
+ colorPicker(R.string.text_color, { Prefs.customTextColor }, { Prefs.customTextColor = it; reload(); invalidateCustomTheme() }) {
dependsOnCustom()
allowCustomAlpha = false
}
colorPicker(R.string.background_color, { Prefs.customBackgroundColor },
- { Prefs.customBackgroundColor = it; bgCanvas.ripple(it, duration = 500L) }) {
+ { Prefs.customBackgroundColor = it; bgCanvas.ripple(it, duration = 500L); invalidateCustomTheme() }) {
dependsOnCustom()
allowCustomAlpha = true
}
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 4edddbed..8ccedf92 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssAssets.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssAssets.kt
@@ -1,13 +1,14 @@
package com.pitchedapps.frost.injectors
import android.webkit.WebView
+import ca.allanwang.kau.utils.*
import com.pitchedapps.frost.utils.L
+import com.pitchedapps.frost.utils.Prefs
/**
* Created by Allan Wang on 2017-05-31.
* Mapping of the available assets
* The enum name must match the css file name
- * //TODO add folder mapping using Prefs
*/
enum class CssAssets(val folder: String = "themes") : InjectorContract {
MATERIAL_LIGHT, MATERIAL_DARK, MATERIAL_AMOLED, MATERIAL_GLASS, CUSTOM, ROUND_ICONS("components")
@@ -18,7 +19,17 @@ enum class CssAssets(val folder: String = "themes") : InjectorContract {
override fun inject(webView: WebView, callback: ((String) -> Unit)?) {
if (injector == null) {
- val content = webView.context.assets.open("css/$folder/$file").bufferedReader().use { it.readText() }
+ var content = webView.context.assets.open("css/$folder/$file").bufferedReader().use { it.readText() }
+ if (this == CUSTOM) {
+ content = content
+ .replace("\$T\$", Prefs.textColor.toRgbaString())
+ .replace("\$TT\$", Prefs.textColor.colorToBackground(0.05f).toRgbaString())
+ .replace("\$B\$", Prefs.bgColor.toRgbaString())
+ .replace("\$BB\$", Prefs.bgColor.colorToForeground(0.05f).toRgbaString())
+ .replace("\$O\$", Prefs.bgColor.withAlpha(255).toRgbaString())
+ .replace("\$D\$", Prefs.textColor.adjustAlpha(0.3f).toRgbaString())
+ L.d("Content $content")
+ }
injector = JsBuilder().css(content).build()
}
injector!!.inject(webView, callback)
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/utils/Theme.kt b/app/src/main/kotlin/com/pitchedapps/frost/utils/Theme.kt
index cf1cbc67..7535eaa2 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/utils/Theme.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/utils/Theme.kt
@@ -17,7 +17,7 @@ enum class Theme(val textRes: Int, val injector: InjectorContract,
DARK(R.string.kau_dark, CssAssets.MATERIAL_DARK, { Color.WHITE }, { 0xff303030.toInt() }, { 0xff2e4b86.toInt() }, { Color.WHITE }),
AMOLED(R.string.kau_amoled, CssAssets.MATERIAL_AMOLED, { Color.WHITE }, { Color.BLACK }, { Color.BLACK }, { Color.WHITE }),
GLASS(R.string.kau_glass, CssAssets.MATERIAL_GLASS, { Color.WHITE }, { 0x80000000.toInt() }, { 0xb3000000.toInt() }, { Color.WHITE }),
- CUSTOM(R.string.kau_custom, JsActions.EMPTY, { Prefs.customTextColor }, { Prefs.customBackgroundColor }, { Prefs.customHeaderColor }, { Prefs.customIconColor })
+ CUSTOM(R.string.kau_custom, CssAssets.CUSTOM, { Prefs.customTextColor }, { Prefs.customBackgroundColor }, { Prefs.customHeaderColor }, { Prefs.customIconColor })
;
val textColor: Int
diff --git a/app/src/main/res/layout/login_webview.xml b/app/src/main/res/layout/login_webview.xml
index 74aabfab..958bcec5 100644
--- a/app/src/main/res/layout/login_webview.xml
+++ b/app/src/main/res/layout/login_webview.xml
@@ -13,8 +13,8 @@
android:layout_width="144dp"
android:layout_height="144dp"
android:layout_centerInParent="true"
- android:layout_marginBottom="8dp"
- android:contentDescription="Profile Picture"
+ android:layout_marginBottom="16dp"
+ android:contentDescription="@string/profile_picture"
android:scaleType="centerInside"
android:visibility="invisible" />
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index cc1bd9b3..db86ccb9 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -35,4 +35,5 @@
<string name="no_longer_facebook">No longer under facebook; refreshing…</string>
<string name="web_overlay_swipe_hint">Swipe right to go back to the previous window.</string>
+ <string name="profile_picture">Profile Picture</string>
</resources>