From 64fd7736ebad421342731553c436092bb16a2f48 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Tue, 2 Jul 2019 16:54:37 -0700 Subject: Support horizontal swipes for overlays --- .../kotlin/com/pitchedapps/frost/activities/WebOverlayActivity.kt | 5 ++++- app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt | 2 ++ gradle.properties | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/WebOverlayActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/WebOverlayActivity.kt index 5b2d01d4..b3ef9bd4 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/WebOverlayActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/WebOverlayActivity.kt @@ -28,6 +28,7 @@ import android.webkit.WebChromeClient import android.widget.FrameLayout import androidx.appcompat.widget.Toolbar import androidx.coordinatorlayout.widget.CoordinatorLayout +import ca.allanwang.kau.swipe.SwipeBackContract import ca.allanwang.kau.swipe.kauSwipeOnCreate import ca.allanwang.kau.swipe.kauSwipeOnDestroy import ca.allanwang.kau.utils.ContextHelper @@ -168,6 +169,8 @@ open class WebOverlayActivityBase(private val forceDesktopAgent: Boolean) : Base private inline val urlTest: String? get() = intent.getStringExtra(ARG_URL) ?: intent.dataString + lateinit var swipeBack: SwipeBackContract + /** * Nonnull variant; verify by checking [urlTest] */ @@ -235,7 +238,7 @@ open class WebOverlayActivityBase(private val forceDesktopAgent: Boolean) : Base FrostRunnable.propagate(this, intent) L.v { "Done propagation" } - kauSwipeOnCreate { + swipeBack = kauSwipeOnCreate { if (!Prefs.overlayFullScreenSwipe) edgeSize = 20.dpToPx transitionSystemBars = false } 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 d75a4f1f..376257d4 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/web/FrostJSI.kt @@ -19,6 +19,7 @@ package com.pitchedapps.frost.web import android.content.Context import android.webkit.JavascriptInterface import com.pitchedapps.frost.activities.MainActivity +import com.pitchedapps.frost.activities.WebOverlayActivityBase import com.pitchedapps.frost.contracts.MainActivityContract import com.pitchedapps.frost.contracts.VideoViewHolder import com.pitchedapps.frost.db.CookieEntity @@ -144,5 +145,6 @@ class FrostJSI(val web: FrostWebView) { @JavascriptInterface fun allowHorizontalScrolling(enable: Boolean) { activity?.viewPager?.enableSwipe = enable + (context as? WebOverlayActivityBase)?.swipeBack?.disallowIntercept = !enable } } diff --git a/gradle.properties b/gradle.properties index ea3a684a..d5bd284d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -16,7 +16,7 @@ org.gradle.daemon = true APP_ID=Frost APP_GROUP=com.pitchedapps -KAU=d91d734 +KAU=00ba1bc android.useAndroidX=true android.enableJetifier=true -- cgit v1.2.3