diff options
author | Allan Wang <me@allanwang.ca> | 2017-06-15 15:49:20 -0700 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2017-06-15 15:49:20 -0700 |
commit | 9e0044f8789a47a41933d341b968fe0a6bc22b6d (patch) | |
tree | 551096bd404331a39022e81853aff003236bb234 /app/src/main/kotlin/com/pitchedapps/frost/injectors | |
parent | 610c37698ab93b8d51efcaec9f721292cacfd854 (diff) | |
download | frost-9e0044f8789a47a41933d341b968fe0a6bc22b6d.tar.gz frost-9e0044f8789a47a41933d341b968fe0a6bc22b6d.tar.bz2 frost-9e0044f8789a47a41933d341b968fe0a6bc22b6d.zip |
Add full theming
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/injectors')
3 files changed, 8 insertions, 7 deletions
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 7ef358f3..45ece582 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssAssets.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssAssets.kt @@ -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 + LOGIN("core"), MATERIAL_LIGHT, MATERIAL_DARK, MATERIAL_AMOLED, MATERIAL_GLASS, CUSTOM ; var file = "${name.toLowerCase()}.compact.css" diff --git a/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsActions.kt b/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsActions.kt index 7d59f797..17d7ca81 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsActions.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsActions.kt @@ -5,14 +5,15 @@ import android.webkit.WebView /** * Created by Allan Wang on 2017-05-31. */ -enum class JsActions(body: String) { +enum class JsActions(body: String) : InjectorContract { /** * Redirects to login activity if create account is found * see [com.pitchedapps.frost.web.FrostJSI.loadLogin] */ - LOGIN_CHECK("document.getElementById('signup-button')&&Frost.loadLogin();"); + LOGIN_CHECK("document.getElementById('signup-button')&&Frost.loadLogin();"), + EMPTY(""); val function = "!function(){$body}();" - fun inject(webView: WebView, callback: ((String) -> Unit)? = null) = JsInjector(function).inject(webView, callback) + override fun inject(webView: WebView, callback: ((String) -> Unit)?) = JsInjector(function).inject(webView, callback) }
\ No newline at end of file diff --git a/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsAssets.kt b/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsAssets.kt index e0a9dd3d..d0bf9deb 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsAssets.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsAssets.kt @@ -9,14 +9,14 @@ import com.pitchedapps.frost.utils.L * The enum name must match the css file name * //TODO add folder mapping using Prefs */ -enum class JsAssets { - MENU, MENU_CLICK +enum class JsAssets : InjectorContract { + MENU, MENU_CLICK, CLICK_INTERCEPTOR ; var file = "${name.toLowerCase()}.min.js" var injector: JsInjector? = null - fun inject(webView: WebView, callback: ((String) -> Unit)?) { + override fun inject(webView: WebView, callback: ((String) -> Unit)?) { if (injector == null) { val content = webView.context.assets.open("js/$file").bufferedReader().use { it.readText() } injector = JsBuilder().js(content).build() |