From 81486e30e9adf6a7e983b5e3f12bd5bc34083db1 Mon Sep 17 00:00:00 2001 From: Riztard Date: Wed, 2 Nov 2022 16:37:07 +0700 Subject: [PATCH] Add back haptic feedback long tap to fav - add back haptic when long tap on manga to add to library --- .../browse/components/BrowseSourceComfortableGrid.kt | 9 ++++++++- .../browse/components/BrowseSourceCompactGrid.kt | 9 ++++++++- .../presentation/browse/components/BrowseSourceList.kt | 9 ++++++++- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/kanade/presentation/browse/components/BrowseSourceComfortableGrid.kt b/app/src/main/java/eu/kanade/presentation/browse/components/BrowseSourceComfortableGrid.kt index 3d4d0a0e27..fbd9b14fb7 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/components/BrowseSourceComfortableGrid.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/components/BrowseSourceComfortableGrid.kt @@ -8,6 +8,8 @@ import androidx.compose.foundation.lazy.grid.LazyVerticalGrid import androidx.compose.runtime.Composable import androidx.compose.runtime.State import androidx.compose.runtime.getValue +import androidx.compose.ui.hapticfeedback.HapticFeedbackType +import androidx.compose.ui.platform.LocalHapticFeedback import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.paging.LoadState @@ -65,6 +67,8 @@ fun BrowseSourceComfortableGridItem( onClick: () -> Unit = {}, onLongClick: () -> Unit = onClick, ) { + val haptic = LocalHapticFeedback.current + MangaComfortableGridItem( title = manga.title, coverData = MangaCover( @@ -80,7 +84,10 @@ fun BrowseSourceComfortableGridItem( Badge(text = stringResource(R.string.in_library)) } }, - onLongClick = onLongClick, + onLongClick = { + onLongClick() + haptic.performHapticFeedback(HapticFeedbackType.LongPress) + }, onClick = onClick, ) } diff --git a/app/src/main/java/eu/kanade/presentation/browse/components/BrowseSourceCompactGrid.kt b/app/src/main/java/eu/kanade/presentation/browse/components/BrowseSourceCompactGrid.kt index 7c987ca912..b6d72c42a1 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/components/BrowseSourceCompactGrid.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/components/BrowseSourceCompactGrid.kt @@ -8,6 +8,8 @@ import androidx.compose.foundation.lazy.grid.LazyVerticalGrid import androidx.compose.runtime.Composable import androidx.compose.runtime.State import androidx.compose.runtime.getValue +import androidx.compose.ui.hapticfeedback.HapticFeedbackType +import androidx.compose.ui.platform.LocalHapticFeedback import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.paging.LoadState @@ -65,6 +67,8 @@ private fun BrowseSourceCompactGridItem( onClick: () -> Unit = {}, onLongClick: () -> Unit = onClick, ) { + val haptic = LocalHapticFeedback.current + MangaCompactGridItem( title = manga.title, coverData = MangaCover( @@ -80,7 +84,10 @@ private fun BrowseSourceCompactGridItem( Badge(text = stringResource(R.string.in_library)) } }, - onLongClick = onLongClick, + onLongClick = { + onLongClick() + haptic.performHapticFeedback(HapticFeedbackType.LongPress) + }, onClick = onClick, ) } diff --git a/app/src/main/java/eu/kanade/presentation/browse/components/BrowseSourceList.kt b/app/src/main/java/eu/kanade/presentation/browse/components/BrowseSourceList.kt index ebb712998f..741e89a80f 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/components/BrowseSourceList.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/components/BrowseSourceList.kt @@ -4,6 +4,8 @@ import androidx.compose.foundation.layout.PaddingValues import androidx.compose.runtime.Composable import androidx.compose.runtime.State import androidx.compose.runtime.getValue +import androidx.compose.ui.hapticfeedback.HapticFeedbackType +import androidx.compose.ui.platform.LocalHapticFeedback import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.paging.LoadState @@ -59,6 +61,8 @@ fun BrowseSourceListItem( onClick: () -> Unit = {}, onLongClick: () -> Unit = onClick, ) { + val haptic = LocalHapticFeedback.current + MangaListItem( title = manga.title, coverData = MangaCover( @@ -74,7 +78,10 @@ fun BrowseSourceListItem( Badge(text = stringResource(R.string.in_library)) } }, - onLongClick = onLongClick, + onLongClick = { + onLongClick() + haptic.performHapticFeedback(HapticFeedbackType.LongPress) + }, onClick = onClick, ) }