From 7bb1de11f0208ac6b6a9e7d8fd3db81490e18daf Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Thu, 22 Jun 2017 23:52:55 -0700 Subject: Fix urls in overlay --- app/src/main/kotlin/com/pitchedapps/frost/SettingsActivity.kt | 2 +- app/src/main/kotlin/com/pitchedapps/frost/fragments/WebFragment.kt | 2 +- app/src/main/kotlin/com/pitchedapps/frost/injectors/CssAssets.kt | 1 - app/src/main/kotlin/com/pitchedapps/frost/injectors/CssHider.kt | 1 - app/src/main/kotlin/com/pitchedapps/frost/injectors/JsAssets.kt | 1 - app/src/main/kotlin/com/pitchedapps/frost/injectors/JsInjector.kt | 5 +---- app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClient.kt | 2 +- 7 files changed, 4 insertions(+), 10 deletions(-) diff --git a/app/src/main/kotlin/com/pitchedapps/frost/SettingsActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/SettingsActivity.kt index 3991e53a..f6e5f2bf 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/SettingsActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/SettingsActivity.kt @@ -125,7 +125,7 @@ class SettingsActivity : KPrefActivity() { fun subPrefsNotifications(): KPrefAdapterBuilder.() -> Unit = { - text(R.string.notification_frequency, { Prefs.notificationFreq }, { Prefs.notificationFreq = it; reloadByTitle(R.string.notifications) }) { + text(R.string.notification_frequency, { Prefs.notificationFreq }, { Prefs.notificationFreq = it; reloadByTitle(R.string.notification_frequency) }) { val options = longArrayOf(-1, 15, 30, 60, 120, 180, 300, 1440, 2880) val texts = options.map { this@SettingsActivity.minuteToText(it) } onClick = { diff --git a/app/src/main/kotlin/com/pitchedapps/frost/fragments/WebFragment.kt b/app/src/main/kotlin/com/pitchedapps/frost/fragments/WebFragment.kt index b7bf3421..dfc3eaad 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/fragments/WebFragment.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/fragments/WebFragment.kt @@ -85,7 +85,7 @@ class WebFragment : Fragment() { pauseLoad = false } -(position + 1) -> { //we are moving away from this fragment - pauseLoad = true + if (!frostWebView.refresh.isRefreshing) pauseLoad = 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 5cb9897e..4edddbed 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssAssets.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssAssets.kt @@ -22,7 +22,6 @@ enum class CssAssets(val folder: String = "themes") : InjectorContract { injector = JsBuilder().css(content).build() } injector!!.inject(webView, callback) - L.v("CSS ${injector!!.function}") } fun reset() { diff --git a/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssHider.kt b/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssHider.kt index ba0bdaac..655da3ff 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssHider.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/injectors/CssHider.kt @@ -20,7 +20,6 @@ enum class CssHider(vararg val items: String) : InjectorContract { override fun inject(webView: WebView, callback: ((String) -> Unit)?) { injector.inject(webView, callback) - L.d(injector.function) } } \ 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 7bb73471..a176042e 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsAssets.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsAssets.kt @@ -22,7 +22,6 @@ enum class JsAssets : InjectorContract { injector = JsBuilder().js(content).build() } injector!!.inject(webView, callback) - L.v("JS ${injector!!.function}") } fun reset() { diff --git a/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsInjector.kt b/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsInjector.kt index b7a162ae..deb6c0be 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsInjector.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsInjector.kt @@ -53,10 +53,7 @@ fun WebView.jsInject(vararg injectors: InjectorContract, callback: ((Array>(observables.map { it.toObservable() }, { it.map { it.toString() }.toTypedArray() }).subscribeOn(AndroidSchedulers.mainThread()).subscribe({ callback(it) }) - (0 until validInjectors.size).asSequence().forEach { - i -> - validInjectors[i].inject(this, { observables[i].onSuccess(it) }) - } + (0 until validInjectors.size).forEach { i -> validInjectors[i].inject(this, { observables[i].onSuccess(it) }) } } fun FrostWebViewClient.jsInject(vararg injectors: InjectorContract, callback: ((Array) -> Unit) = {}) = webCore.jsInject(*injectors, callback = callback) diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClient.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClient.kt index ebea533c..065c9c08 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClient.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClient.kt @@ -66,7 +66,7 @@ open class FrostWebViewClient(val webCore: FrostWebViewCore) : WebViewClient() { L.d("Page finished reveal") webCore.jsInject(CssHider.HEADER, Prefs.themeInjector, - JsAssets.CLICK_A, + JsAssets.CLICK_A.maybe(webCore.baseEnum != null), callback = { refreshObservable.onNext(false) }) -- cgit v1.2.3