For #27346 - Disable swiping to switch tabs when fullscreen

This commit is contained in:
Mugurell 2022-10-11 18:06:19 +03:00 committed by mergify[bot]
parent ebfcf11f9c
commit f81efb17c0
2 changed files with 11 additions and 0 deletions

View File

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

View File

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