Don't dispatch gestures in widget edit mode

This commit is contained in:
MM20 2023-01-21 13:21:19 +01:00
parent 2cddd38211
commit 6567c77ba2
No known key found for this signature in database
GPG Key ID: 0B61A8F2DEAFA389
2 changed files with 9 additions and 9 deletions

View File

@ -254,7 +254,7 @@ fun PagerScaffold(
available: Offset,
source: NestedScrollSource
): Offset {
if (source == NestedScrollSource.Drag) gestureManager.dispatchDrag(available)
if (source == NestedScrollSource.Drag && !isWidgetEditMode) gestureManager.dispatchDrag(available)
val deltaSearchBarOffset =
consumed.y * if (isSearchOpen && reverseSearchResults) 1 else -1
searchBarOffset.value =
@ -263,7 +263,7 @@ fun PagerScaffold(
}
override suspend fun onPreFling(available: Velocity): Velocity {
gestureManager.dispatchDragEnd()
if (!isWidgetEditMode) gestureManager.dispatchDragEnd()
return super.onPreFling(available)
}
}
@ -346,10 +346,10 @@ fun PagerScaffold(
.pointerInput(Unit) {
detectTapGestures(
onDoubleTap = {
gestureManager.dispatchDoubleTap(it)
if (!isWidgetEditMode) gestureManager.dispatchDoubleTap(it)
},
onLongPress = {
gestureManager.dispatchLongPress(it)
if (!isWidgetEditMode) gestureManager.dispatchLongPress(it)
}
)
}

View File

@ -315,7 +315,7 @@ fun PullDownScaffold(
if (offsetY.value > toggleSearchThreshold || offsetY.value < -toggleSearchThreshold) {
viewModel.toggleSearch()
}
gestureManager.dispatchDragEnd()
if (!isWidgetEditMode) gestureManager.dispatchDragEnd()
if (offsetY.value != 0f) {
offsetY.animateTo(0f)
return available
@ -331,10 +331,10 @@ fun PullDownScaffold(
.pointerInput(Unit) {
detectHorizontalDragGestures(
onDragEnd = {
gestureManager.dispatchDragEnd()
if (!isWidgetEditMode) gestureManager.dispatchDragEnd()
},
onHorizontalDrag = { _, dragAmount ->
gestureManager.dispatchDrag(Offset(dragAmount, 0f))
if (!isWidgetEditMode) gestureManager.dispatchDrag(Offset(dragAmount, 0f))
}
)
}
@ -388,10 +388,10 @@ fun PullDownScaffold(
.pointerInput(Unit) {
detectTapGestures(
onDoubleTap = {
gestureManager.dispatchDoubleTap(it)
if (!isWidgetEditMode) gestureManager.dispatchDoubleTap(it)
},
onLongPress = {
gestureManager.dispatchLongPress(it)
if (!isWidgetEditMode) gestureManager.dispatchLongPress(it)
}
)
}