Skip to content

Instantly share code, notes, and snippets.

View AliAzizi's full-sized avatar
🏠
Working from home

Ali Azizi AliAzizi

🏠
Working from home
  • Karaj, Gohardasht
View GitHub Profile
@discord-gists
discord-gists / PanelsHorizontalScrollingInChildViews.kt
Last active March 2, 2022 19:22
a simplified code example of how Discord's Android app selectively allows child views of OverlappingPanelsLayout to handle their own horizontal scrolls
class PanelsChildGestureRegionObserver : View.OnLayoutChangeListener {
...
override fun onLayoutChange(
view: View?,
left: Int,
top: Int,
right: Int,
bottom: Int,
oldLeft: Int,
oldTop: Int,
@discord-gists
discord-gists / CustomPanelGestureDetection.kt
Last active March 2, 2022 19:16
a simplified code example for how Discord's Android app supports custom panel gesture detection
class OverlappingPanelsLayout : FrameLayout {
private var scrollingSlopPx: Float = 0f
private var velocityTracker: VelocityTracker? = null
private var isScrollingHorizontally = false
private var xFromInterceptActionDown: Float = 0f
private var yFromInterceptActionDown: Float = 0f
... // initialize scrollingSlopPx and VelocityTracker