From ab3205c07efe6b4c16f4961b171db4e6603dffb0 Mon Sep 17 00:00:00 2001
From: Hugh Daschbach <hugh@ccss.com>
Date: Tue, 15 Aug 2023 20:15:06 -0700
Subject: [PATCH] Prevent BottomSheet tap leaking to nav panels.

With the BottomSheet open, while trying to tap one of the
controls (esp. add to playlist and favorite buttons) it is easy to
miss the touch point and tap directly on the BottomSheet.

This tap bleeds through to whatever fragment is currently displayed in
the navigation area (Artist, Album, Playlists, etc.).  That tap
changes the view in the navigation panel.  For example, if the Artist
fragment it current, it will open a list of the artists albums.

That change may be surprising when the BottomSheet is toggled closed.
So, ignore BottomSheet taps outside the active controls.
---
 .../java/audio/funkwhale/ffa/views/NowPlayingBottomSheet.kt    | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/app/src/main/java/audio/funkwhale/ffa/views/NowPlayingBottomSheet.kt b/app/src/main/java/audio/funkwhale/ffa/views/NowPlayingBottomSheet.kt
index 4cae4b97..436de6a8 100644
--- a/app/src/main/java/audio/funkwhale/ffa/views/NowPlayingBottomSheet.kt
+++ b/app/src/main/java/audio/funkwhale/ffa/views/NowPlayingBottomSheet.kt
@@ -3,6 +3,7 @@ package audio.funkwhale.ffa.views
 import android.content.Context
 import android.util.AttributeSet
 import android.util.TypedValue
+import android.view.MotionEvent
 import android.view.View
 import android.view.ViewGroup
 import android.widget.FrameLayout
@@ -52,6 +53,8 @@ class NowPlayingBottomSheet @JvmOverloads constructor(
     } ?: hide()
   }
 
+  override fun onTouchEvent(event: MotionEvent): Boolean = true
+
   fun addBottomSheetCallback(callback: BottomSheetCallback) {
     behavior.addBottomSheetCallback(callback)
   }
-- 
GitLab