This commit is contained in:
Riztard 2022-11-04 16:15:42 +07:00
parent 81486e30e9
commit f4bd57315a
4 changed files with 7 additions and 18 deletions

View File

@ -8,7 +8,6 @@ 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
@ -84,10 +83,7 @@ fun BrowseSourceComfortableGridItem(
Badge(text = stringResource(R.string.in_library))
}
},
onLongClick = {
onLongClick()
haptic.performHapticFeedback(HapticFeedbackType.LongPress)
},
onLongClick = onLongClick,
onClick = onClick,
)
}

View File

@ -8,7 +8,6 @@ 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
@ -84,10 +83,7 @@ private fun BrowseSourceCompactGridItem(
Badge(text = stringResource(R.string.in_library))
}
},
onLongClick = {
onLongClick()
haptic.performHapticFeedback(HapticFeedbackType.LongPress)
},
onLongClick = onLongClick,
onClick = onClick,
)
}

View File

@ -4,8 +4,6 @@ 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
@ -61,8 +59,6 @@ fun BrowseSourceListItem(
onClick: () -> Unit = {},
onLongClick: () -> Unit = onClick,
) {
val haptic = LocalHapticFeedback.current
MangaListItem(
title = manga.title,
coverData = MangaCover(
@ -78,10 +74,7 @@ fun BrowseSourceListItem(
Badge(text = stringResource(R.string.in_library))
}
},
onLongClick = {
onLongClick()
haptic.performHapticFeedback(HapticFeedbackType.LongPress)
},
onLongClick = onLongClick,
onClick = onClick,
)
}

View File

@ -5,7 +5,9 @@ import androidx.activity.compose.BackHandler
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.hapticfeedback.HapticFeedbackType
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalHapticFeedback
import androidx.core.os.bundleOf
import eu.kanade.domain.source.model.Source
import eu.kanade.presentation.browse.BrowseSourceScreen
@ -50,6 +52,7 @@ open class BrowseSourceController(bundle: Bundle) :
override fun ComposeContent() {
val scope = rememberCoroutineScope()
val context = LocalContext.current
val haptic = LocalHapticFeedback.current
BrowseSourceScreen(
presenter = presenter,
@ -64,6 +67,7 @@ open class BrowseSourceController(bundle: Bundle) :
duplicateManga != null -> presenter.dialog = Dialog.AddDuplicateManga(manga, duplicateManga)
else -> presenter.addFavorite(manga)
}
haptic.performHapticFeedback(HapticFeedbackType.LongPress)
}
},
onWebViewClick = f@{