Add haptic feedback before actions (#1636)

* perform haptic before doing action

* Perform haptic feedback call in UI/main thread instead of IO

* Haptic feedback on both cases of long press action
This commit is contained in:
Cuong-Tran 2026-05-13 14:22:35 +07:00 committed by GitHub
parent 21cb1921a3
commit 19f8fa203d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 8 additions and 8 deletions

View file

@ -142,8 +142,8 @@ private fun LibraryUpdateErrorUiItem(
.combinedClickable(
onClick = onClick,
onLongClick = {
onLongClick()
haptic.performHapticFeedback(HapticFeedbackType.LongPress)
onLongClick()
},
)
.padding(horizontal = MaterialTheme.padding.medium),

View file

@ -1372,8 +1372,8 @@ private fun LazyListScope.sharedChapterItems(
chapterSwipeStartAction = chapterSwipeStartAction,
chapterSwipeEndAction = chapterSwipeEndAction,
onLongClick = {
onChapterSelected(item, !item.selected, true)
haptic.performHapticFeedback(HapticFeedbackType.LongPress)
onChapterSelected(item, !item.selected, true)
},
onClick = {
onChapterItemClick(

View file

@ -43,8 +43,8 @@ fun BaseMangaListItem(
onClick = onClickItem,
// KMK -->
onLongClick = {
onLongClick()
haptic.performHapticFeedback(HapticFeedbackType.LongPress)
onLongClick()
},
// KMK <--
)

View file

@ -286,8 +286,8 @@ private fun UpdatesUiItem(
.combinedClickable(
onClick = onClick,
onLongClick = {
onLongClick()
haptic.performHapticFeedback(HapticFeedbackType.LongPress)
onLongClick()
},
)
.padding(top = if (isLeader) MaterialTheme.padding.small else 0.dp)

View file

@ -375,6 +375,7 @@ data class BrowseSourceScreen(
},
onMangaLongClick = { manga ->
// KMK -->
haptic.performHapticFeedback(HapticFeedbackType.LongPress)
if (bulkFavoriteState.selectionMode) {
navigator.push(MangaScreen(manga.id, true))
} else {
@ -388,7 +389,6 @@ data class BrowseSourceScreen(
)
else -> screenModel.addFavorite(manga)
}
haptic.performHapticFeedback(HapticFeedbackType.LongPress)
}
}
},

View file

@ -329,8 +329,8 @@ data object LibraryTab : Tab {
}.takeIf { state.showMangaContinueButton },
onToggleSelection = screenModel::toggleSelection,
onToggleRangeSelection = { category, manga ->
screenModel.toggleRangeSelection(category, manga)
haptic.performHapticFeedback(HapticFeedbackType.LongPress)
screenModel.toggleRangeSelection(category, manga)
},
onRefresh = { onClickRefresh(state.activeCategory) },
onGlobalSearchClicked = {

View file

@ -278,8 +278,8 @@ class MangaScreen(
onChapterClicked = { openChapter(context, it) },
onDownloadChapter = screenModel::runChapterDownloadActions.takeIf { !successState.source.isLocalOrStub() },
onAddToLibraryClicked = {
screenModel.toggleFavorite()
haptic.performHapticFeedback(HapticFeedbackType.LongPress)
screenModel.toggleFavorite()
},
// SY -->
onWebViewClicked = {

View file

@ -127,6 +127,7 @@ class MangaDexFollowsScreen(private val sourceId: Long) : Screen() {
},
onMangaLongClick = { manga ->
// KMK -->
haptic.performHapticFeedback(HapticFeedbackType.LongPress)
if (bulkFavoriteState.selectionMode) {
navigator.push(MangaScreen(manga.id, true))
} else {
@ -140,7 +141,6 @@ class MangaDexFollowsScreen(private val sourceId: Long) : Screen() {
)
else -> screenModel.addFavorite(manga)
}
haptic.performHapticFeedback(HapticFeedbackType.LongPress)
}
}
},