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.
This commit is contained in:
Hugh Daschbach 2023-08-15 20:15:06 -07:00 committed by Georg Krause
parent feb86fe9c0
commit 2133d4a4fb
1 changed files with 3 additions and 0 deletions

View File

@ -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)
}