Fix scrolling with notification gesture
This commit is contained in:
parent
237361badf
commit
b784ab5aa5
@ -150,22 +150,19 @@ fun PagerScaffold(
|
|||||||
object: NestedScrollConnection {
|
object: NestedScrollConnection {
|
||||||
private var pullDownTotalY: Float? = 0f
|
private var pullDownTotalY: Float? = 0f
|
||||||
override fun onPreScroll(available: Offset, source: NestedScrollSource): Offset {
|
override fun onPreScroll(available: Offset, source: NestedScrollSource): Offset {
|
||||||
if (widgetsScrollState.value == 0 && source == NestedScrollSource.Drag) {
|
val diff = widgetsScrollState.value - available.y
|
||||||
val diff = widgetsScrollState.value - available.y
|
var totalY = pullDownTotalY ?: return available
|
||||||
var totalY = pullDownTotalY
|
if (diff >= 0) return super.onPreScroll(available, source)
|
||||||
if (totalY != null) {
|
|
||||||
totalY += diff
|
totalY += diff
|
||||||
if (totalY < -notificationDragThreshold) {
|
|
||||||
notificationShadeController.expandNotifications()
|
if (totalY < -notificationDragThreshold) {
|
||||||
pullDownTotalY = null
|
notificationShadeController.expandNotifications()
|
||||||
} else {
|
pullDownTotalY = null
|
||||||
pullDownTotalY = totalY
|
return available
|
||||||
}
|
|
||||||
return Offset(0f, -diff)
|
|
||||||
} else {
|
|
||||||
return available
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
pullDownTotalY = totalY
|
||||||
|
|
||||||
return super.onPreScroll(available, source)
|
return super.onPreScroll(available, source)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user