shade for selected items
This commit is contained in:
parent
5c5a0f5fcf
commit
459bbcc9bd
4 changed files with 25 additions and 3 deletions
|
|
@ -126,6 +126,7 @@ fun FeedScreen(
|
||||||
onClickManga = onClickManga,
|
onClickManga = onClickManga,
|
||||||
// KMK -->
|
// KMK -->
|
||||||
onLongClickManga = onLongClickManga,
|
onLongClickManga = onLongClickManga,
|
||||||
|
selection = state.selection,
|
||||||
// KMK <--
|
// KMK <--
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
@ -143,6 +144,7 @@ fun FeedItem(
|
||||||
onClickManga: (Manga) -> Unit,
|
onClickManga: (Manga) -> Unit,
|
||||||
// KMK -->
|
// KMK -->
|
||||||
onLongClickManga: (Manga) -> Unit,
|
onLongClickManga: (Manga) -> Unit,
|
||||||
|
selection: List<Manga>,
|
||||||
// KMK <--
|
// KMK <--
|
||||||
) {
|
) {
|
||||||
when {
|
when {
|
||||||
|
|
@ -161,6 +163,7 @@ fun FeedItem(
|
||||||
onLongClick = onClickManga,
|
onLongClick = onClickManga,
|
||||||
*/
|
*/
|
||||||
onLongClick = onLongClickManga,
|
onLongClick = onLongClickManga,
|
||||||
|
selection = selection,
|
||||||
// KMK <--
|
// KMK <--
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ import androidx.compose.runtime.State
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
|
import androidx.compose.ui.util.fastAny
|
||||||
import eu.kanade.presentation.library.components.CommonMangaItemDefaults
|
import eu.kanade.presentation.library.components.CommonMangaItemDefaults
|
||||||
import eu.kanade.presentation.library.components.MangaComfortableGridItem
|
import eu.kanade.presentation.library.components.MangaComfortableGridItem
|
||||||
import tachiyomi.domain.manga.model.Manga
|
import tachiyomi.domain.manga.model.Manga
|
||||||
|
|
@ -29,6 +30,9 @@ fun GlobalSearchCardRow(
|
||||||
getManga: @Composable (Manga) -> State<Manga>,
|
getManga: @Composable (Manga) -> State<Manga>,
|
||||||
onClick: (Manga) -> Unit,
|
onClick: (Manga) -> Unit,
|
||||||
onLongClick: (Manga) -> Unit,
|
onLongClick: (Manga) -> Unit,
|
||||||
|
// KMK -->
|
||||||
|
selection: List<Manga>? = null,
|
||||||
|
// KMK <--
|
||||||
) {
|
) {
|
||||||
if (titles.isEmpty()) {
|
if (titles.isEmpty()) {
|
||||||
EmptyResultItem()
|
EmptyResultItem()
|
||||||
|
|
@ -47,6 +51,9 @@ fun GlobalSearchCardRow(
|
||||||
isFavorite = title.favorite,
|
isFavorite = title.favorite,
|
||||||
onClick = { onClick(title) },
|
onClick = { onClick(title) },
|
||||||
onLongClick = { onLongClick(title) },
|
onLongClick = { onLongClick(title) },
|
||||||
|
// KMK -->
|
||||||
|
isSelected = selection?.fastAny { selected -> selected.id == title.id } ?: false,
|
||||||
|
// KMK <--
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -59,6 +66,9 @@ private fun MangaItem(
|
||||||
isFavorite: Boolean,
|
isFavorite: Boolean,
|
||||||
onClick: () -> Unit,
|
onClick: () -> Unit,
|
||||||
onLongClick: () -> Unit,
|
onLongClick: () -> Unit,
|
||||||
|
// KMK -->
|
||||||
|
isSelected: Boolean = false,
|
||||||
|
// KMK <--
|
||||||
) {
|
) {
|
||||||
Box(modifier = Modifier.width(96.dp)) {
|
Box(modifier = Modifier.width(96.dp)) {
|
||||||
MangaComfortableGridItem(
|
MangaComfortableGridItem(
|
||||||
|
|
@ -68,7 +78,13 @@ private fun MangaItem(
|
||||||
coverBadgeStart = {
|
coverBadgeStart = {
|
||||||
InLibraryBadge(enabled = isFavorite)
|
InLibraryBadge(enabled = isFavorite)
|
||||||
},
|
},
|
||||||
coverAlpha = if (isFavorite) CommonMangaItemDefaults.BrowseFavoriteCoverAlpha else 1f,
|
coverAlpha = when {
|
||||||
|
// KMK -->
|
||||||
|
isSelected -> CommonMangaItemDefaults.BrowseSelectedCoverAlpha
|
||||||
|
// KMK <--
|
||||||
|
isFavorite -> CommonMangaItemDefaults.BrowseFavoriteCoverAlpha
|
||||||
|
else -> 1f
|
||||||
|
},
|
||||||
onClick = onClick,
|
onClick = onClick,
|
||||||
onLongClick = onLongClick,
|
onLongClick = onLongClick,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.pager.HorizontalPager
|
import androidx.compose.foundation.pager.HorizontalPager
|
||||||
import androidx.compose.foundation.pager.rememberPagerState
|
import androidx.compose.foundation.pager.rememberPagerState
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.outlined.Bookmark
|
import androidx.compose.material.icons.outlined.BookmarkAdd
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.PrimaryTabRow
|
import androidx.compose.material3.PrimaryTabRow
|
||||||
import androidx.compose.material3.SnackbarHost
|
import androidx.compose.material3.SnackbarHost
|
||||||
|
|
@ -139,7 +139,7 @@ private fun FeedSelectionToolbar(
|
||||||
persistentListOf(
|
persistentListOf(
|
||||||
AppBar.Action(
|
AppBar.Action(
|
||||||
title = stringResource(MR.strings.action_bookmark),
|
title = stringResource(MR.strings.action_bookmark),
|
||||||
icon = Icons.Outlined.Bookmark,
|
icon = Icons.Outlined.BookmarkAdd,
|
||||||
// TODO: method to add bookmark goes here
|
// TODO: method to add bookmark goes here
|
||||||
onClick = { },
|
onClick = { },
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,9 @@ object CommonMangaItemDefaults {
|
||||||
val GridVerticalSpacer = 4.dp
|
val GridVerticalSpacer = 4.dp
|
||||||
|
|
||||||
const val BrowseFavoriteCoverAlpha = 0.34f
|
const val BrowseFavoriteCoverAlpha = 0.34f
|
||||||
|
// KMK -->
|
||||||
|
const val BrowseSelectedCoverAlpha = 0.17f
|
||||||
|
// KMK <--
|
||||||
}
|
}
|
||||||
|
|
||||||
private val ContinueReadingButtonSize = 28.dp
|
private val ContinueReadingButtonSize = 28.dp
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue