For #27346 - Disable swiping to switch tabs when fullscreen

fork
Mugurell 2 years ago committed by mergify[bot]
parent ebfcf11f9c
commit f81efb17c0

@ -1370,6 +1370,7 @@ abstract class BaseBrowserFragment :
.setText(getString(R.string.full_screen_notification)) .setText(getString(R.string.full_screen_notification))
.show() .show()
activity?.enterToImmersiveMode() activity?.enterToImmersiveMode()
(view as? SwipeGestureLayout)?.isSwipeEnabled = false
browserToolbarView.collapse() browserToolbarView.collapse()
browserToolbarView.view.isVisible = false browserToolbarView.view.isVisible = false
val browserEngine = binding.swipeRefresh.layoutParams as CoordinatorLayout.LayoutParams val browserEngine = binding.swipeRefresh.layoutParams as CoordinatorLayout.LayoutParams
@ -1384,6 +1385,7 @@ abstract class BaseBrowserFragment :
MediaState.fullscreen.record(NoExtras()) MediaState.fullscreen.record(NoExtras())
} else { } else {
activity?.exitImmersiveMode() activity?.exitImmersiveMode()
(view as? SwipeGestureLayout)?.isSwipeEnabled = true
(activity as? HomeActivity)?.let { activity -> (activity as? HomeActivity)?.let { activity ->
activity.themeManager.applyStatusBarTheme(activity) activity.themeManager.applyStatusBarTheme(activity)
} }

@ -56,6 +56,11 @@ class SwipeGestureLayout @JvmOverloads constructor(
defStyleAttr: Int = 0, defStyleAttr: Int = 0,
) : FrameLayout(context, attrs, defStyleAttr) { ) : FrameLayout(context, attrs, defStyleAttr) {
/**
* Controls whether the swiping functionality is active or not.
*/
var isSwipeEnabled = true
private val gestureListener = object : GestureDetector.SimpleOnGestureListener() { private val gestureListener = object : GestureDetector.SimpleOnGestureListener() {
override fun onDown(e: MotionEvent): Boolean { override fun onDown(e: MotionEvent): Boolean {
return true return true
@ -107,6 +112,10 @@ class SwipeGestureLayout @JvmOverloads constructor(
} }
override fun onInterceptTouchEvent(event: MotionEvent): Boolean { override fun onInterceptTouchEvent(event: MotionEvent): Boolean {
if (!isSwipeEnabled) {
return false
}
return when (event.actionMasked) { return when (event.actionMasked) {
MotionEvent.ACTION_DOWN -> { MotionEvent.ACTION_DOWN -> {
handledInitialScroll = false handledInitialScroll = false

Loading…
Cancel
Save