diff options
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/injectors/CssAssets.kt')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/injectors/CssAssets.kt | 16 |
1 files changed, 9 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 0482fdc9..5433be60 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssAssets.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssAssets.kt @@ -5,19 +5,21 @@ import com.pitchedapps.frost.utils.L /** * 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(f: String) { - BASE("facebook"); +enum class CssAssets { + HEADER, LOGIN + ; - var file = "$f.compact.css" - var content: String? = null + var file = "${name.toLowerCase()}.compact.css" var injector: JsInjector? = null fun inject(webView: WebView, callback: ((String) -> Unit)?) { if (injector == null) { - if (content == null) - content = webView.context.assets.open(file).bufferedReader().use { it.readText() } - injector = JsBuilder().css(content!!).build() + val content = webView.context.assets.open("core/$file").bufferedReader().use { it.readText() } + injector = JsBuilder().css(content).build() } injector!!.inject(webView, callback) L.d("CSS ${injector!!.function}") |