Don't dispatch gestures in widget edit mode
This commit is contained in:
parent
2cddd38211
commit
6567c77ba2
@ -254,7 +254,7 @@ fun PagerScaffold(
|
|||||||
available: Offset,
|
available: Offset,
|
||||||
source: NestedScrollSource
|
source: NestedScrollSource
|
||||||
): Offset {
|
): Offset {
|
||||||
if (source == NestedScrollSource.Drag) gestureManager.dispatchDrag(available)
|
if (source == NestedScrollSource.Drag && !isWidgetEditMode) gestureManager.dispatchDrag(available)
|
||||||
val deltaSearchBarOffset =
|
val deltaSearchBarOffset =
|
||||||
consumed.y * if (isSearchOpen && reverseSearchResults) 1 else -1
|
consumed.y * if (isSearchOpen && reverseSearchResults) 1 else -1
|
||||||
searchBarOffset.value =
|
searchBarOffset.value =
|
||||||
@ -263,7 +263,7 @@ fun PagerScaffold(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override suspend fun onPreFling(available: Velocity): Velocity {
|
override suspend fun onPreFling(available: Velocity): Velocity {
|
||||||
gestureManager.dispatchDragEnd()
|
if (!isWidgetEditMode) gestureManager.dispatchDragEnd()
|
||||||
return super.onPreFling(available)
|
return super.onPreFling(available)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -346,10 +346,10 @@ fun PagerScaffold(
|
|||||||
.pointerInput(Unit) {
|
.pointerInput(Unit) {
|
||||||
detectTapGestures(
|
detectTapGestures(
|
||||||
onDoubleTap = {
|
onDoubleTap = {
|
||||||
gestureManager.dispatchDoubleTap(it)
|
if (!isWidgetEditMode) gestureManager.dispatchDoubleTap(it)
|
||||||
},
|
},
|
||||||
onLongPress = {
|
onLongPress = {
|
||||||
gestureManager.dispatchLongPress(it)
|
if (!isWidgetEditMode) gestureManager.dispatchLongPress(it)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -315,7 +315,7 @@ fun PullDownScaffold(
|
|||||||
if (offsetY.value > toggleSearchThreshold || offsetY.value < -toggleSearchThreshold) {
|
if (offsetY.value > toggleSearchThreshold || offsetY.value < -toggleSearchThreshold) {
|
||||||
viewModel.toggleSearch()
|
viewModel.toggleSearch()
|
||||||
}
|
}
|
||||||
gestureManager.dispatchDragEnd()
|
if (!isWidgetEditMode) gestureManager.dispatchDragEnd()
|
||||||
if (offsetY.value != 0f) {
|
if (offsetY.value != 0f) {
|
||||||
offsetY.animateTo(0f)
|
offsetY.animateTo(0f)
|
||||||
return available
|
return available
|
||||||
@ -331,10 +331,10 @@ fun PullDownScaffold(
|
|||||||
.pointerInput(Unit) {
|
.pointerInput(Unit) {
|
||||||
detectHorizontalDragGestures(
|
detectHorizontalDragGestures(
|
||||||
onDragEnd = {
|
onDragEnd = {
|
||||||
gestureManager.dispatchDragEnd()
|
if (!isWidgetEditMode) gestureManager.dispatchDragEnd()
|
||||||
},
|
},
|
||||||
onHorizontalDrag = { _, dragAmount ->
|
onHorizontalDrag = { _, dragAmount ->
|
||||||
gestureManager.dispatchDrag(Offset(dragAmount, 0f))
|
if (!isWidgetEditMode) gestureManager.dispatchDrag(Offset(dragAmount, 0f))
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -388,10 +388,10 @@ fun PullDownScaffold(
|
|||||||
.pointerInput(Unit) {
|
.pointerInput(Unit) {
|
||||||
detectTapGestures(
|
detectTapGestures(
|
||||||
onDoubleTap = {
|
onDoubleTap = {
|
||||||
gestureManager.dispatchDoubleTap(it)
|
if (!isWidgetEditMode) gestureManager.dispatchDoubleTap(it)
|
||||||
},
|
},
|
||||||
onLongPress = {
|
onLongPress = {
|
||||||
gestureManager.dispatchLongPress(it)
|
if (!isWidgetEditMode) gestureManager.dispatchLongPress(it)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user