Skip to content

Instantly share code, notes, and snippets.

@chrisbanes chrisbanes/code.kt Secret
Created Oct 8, 2019

What would you like to do?
private val gestureExclusionRects = mutableListOf<Rect>()
private fun updateGestureExclusion() {
// Skip this call if we're not running on Android 10+
if (Build.VERSION.SDK_INT < 29) return
// First, lets clear out any existing rectangles
// Now lets work out which areas should be excluded. For a SeekBar this will
// be the bounds of the thumb drawable.
thumb?.also { t ->
gestureExclusionRects += t.copyBounds()
// If we had other elements in this view near the edges, we could exclude them
// here too, by adding their bounds to the list
// Finally pass our updated list of rectangles to the system
systemGestureExclusionRects = gestureExclusionRects
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.