aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/kotlin/com/pitchedapps
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2020-11-07 20:19:22 -0800
committerAllan Wang <me@allanwang.ca>2020-11-07 20:19:22 -0800
commitf35a33b5c49c4dc768c1be8ddf3393f79acaa57f (patch)
treea7c55efe958144ef9a3a064132e4a16e38714e5d /app/src/main/kotlin/com/pitchedapps
parent8cac4ce54358f23a30a762bbb960309914507bb8 (diff)
downloadfrost-f35a33b5c49c4dc768c1be8ddf3393f79acaa57f.tar.gz
frost-f35a33b5c49c4dc768c1be8ddf3393f79acaa57f.tar.bz2
frost-f35a33b5c49c4dc768c1be8ddf3393f79acaa57f.zip
Disable context menu shortly after scrolling
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps')
-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.kt11
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt1
3 files changed, 13 insertions, 1 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 b629fb91..55eb198e 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsAssets.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/injectors/JsAssets.kt
@@ -35,7 +35,7 @@ import kotlinx.coroutines.withContext
*/
enum class JsAssets(private val singleLoad: Boolean = true) : InjectorContract {
MENU, CLICK_A, CONTEXT_A, MEDIA, HEADER_BADGES, TEXTAREA_LISTENER, NOTIF_MSG,
- DOCUMENT_WATCHER, HORIZONTAL_SCROLLING, AUTO_RESIZE_TEXTAREA(singleLoad = false)
+ DOCUMENT_WATCHER, HORIZONTAL_SCROLLING, AUTO_RESIZE_TEXTAREA(singleLoad = false), SCROLL_STOP,
;
@VisibleForTesting
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 e17ef99e..d4a07ea2 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt
@@ -161,4 +161,15 @@ class FrostJSI(val web: FrostWebView) {
activity?.contentBinding?.viewpager?.enableSwipe = enable
(context as? WebOverlayActivityBase)?.swipeBack?.disallowIntercept = !enable
}
+
+ private var isScrolling = false
+
+ @JavascriptInterface
+ fun setScrolling(scrolling: Boolean) {
+ L.i { "Scrolling $scrolling" }
+ this.isScrolling = scrolling
+ }
+
+ @JavascriptInterface
+ fun isScrolling(): Boolean = isScrolling
}
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 62115a5a..324af69b 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostWebViewClients.kt
@@ -125,6 +125,7 @@ open class FrostWebViewClient(val web: FrostWebView) : BaseWebViewClient() {
JsAssets.CLICK_A,
JsAssets.CONTEXT_A,
JsAssets.MEDIA,
+ JsAssets.SCROLL_STOP,
prefs = prefs
)
}