aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/kotlin/com')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/injectors/JsAssets.kt2
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt10
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebView.kt1
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt1
4 files changed, 12 insertions, 2 deletions
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 240bfeac..b22abd70 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsAssets.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsAssets.kt
@@ -8,7 +8,7 @@ import android.webkit.WebView
* The enum name must match the css file name
*/
enum class JsAssets : InjectorContract {
- MENU, CLICK_A, CONTEXT_A, HEADER_BADGES, SEARCH
+ MENU, CLICK_A, CONTEXT_A, HEADER_BADGES, SEARCH, TEXTAREA_LISTENER
;
var file = "${name.toLowerCase()}.min.js"
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt
index 912a957e..018ad737 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt
@@ -1,10 +1,10 @@
package com.pitchedapps.frost.web
import android.content.Context
+import android.support.v4.widget.SwipeRefreshLayout
import android.webkit.JavascriptInterface
import com.pitchedapps.frost.activities.MainActivity
import com.pitchedapps.frost.dbflow.CookieModel
-import com.pitchedapps.frost.facebook.formattedFbUrl
import com.pitchedapps.frost.utils.*
import io.reactivex.subjects.Subject
@@ -54,6 +54,14 @@ class FrostJSI(val webView: FrostWebViewCore) {
activity?.viewPager?.enableSwipe = !start
}
+ /**
+ * Allow or disallow the pull down to refresh action
+ */
+ @JavascriptInterface
+ fun disableSwipeRefresh(disable: Boolean) {
+ webView.post { (webView.parent as? SwipeRefreshLayout)?.isEnabled = !disable }
+ }
+
@JavascriptInterface
fun loadLogin() {
context.launchLogin(cookies, true)
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebView.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebView.kt
index e7dae22a..6ec1aec5 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebView.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebView.kt
@@ -42,6 +42,7 @@ class FrostWebView @JvmOverloads constructor(
}
web.refreshObservable.observeOn(AndroidSchedulers.mainThread()).subscribe {
refresh.isRefreshing = it
+ refresh.isEnabled = true
}
refresh.setOnRefreshListener(this)
addOnAttachStateChangeListener(object : OnAttachStateChangeListener {
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt
index 7d5282d8..cb5125c4 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt
@@ -91,6 +91,7 @@ open class FrostWebViewClient(val webCore: FrostWebViewCore) : BaseWebViewClient
webCore.jsInject(
JsActions.LOGIN_CHECK,
JsAssets.CLICK_A.maybe(webCore.baseEnum != null && Prefs.overlayEnabled),
+ JsAssets.TEXTAREA_LISTENER,
JsAssets.CONTEXT_A,
JsAssets.HEADER_BADGES.maybe(webCore.baseEnum != null)
)