diff --git a/app/src/main/java/eu/kanade/presentation/browse/MigrateSourceScreen.kt b/app/src/main/java/eu/kanade/presentation/browse/MigrateSourceScreen.kt index efb9579b2..e60bcd735 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/MigrateSourceScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/MigrateSourceScreen.kt @@ -11,7 +11,6 @@ import androidx.compose.foundation.lazy.items import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable -import androidx.compose.runtime.getValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.input.nestedscroll.NestedScrollConnection @@ -23,8 +22,9 @@ import androidx.compose.ui.unit.dp import eu.kanade.domain.source.model.Source import eu.kanade.presentation.browse.components.BaseSourceItem import eu.kanade.presentation.browse.components.SourceIcon +import eu.kanade.presentation.components.Badge +import eu.kanade.presentation.components.BadgeGroup import eu.kanade.presentation.components.EmptyScreen -import eu.kanade.presentation.components.ItemBadges import eu.kanade.presentation.components.LoadingScreen import eu.kanade.presentation.components.ScrollbarLazyColumn import eu.kanade.presentation.theme.header @@ -112,7 +112,11 @@ fun MigrateSourceItem( onClickItem = onClickItem, onLongClickItem = onLongClickItem, icon = { SourceIcon(source = source) }, - action = { ItemBadges(primaryText = "$count") }, + action = { + BadgeGroup { + Badge(text = "$count") + } + }, content = { source, showLanguageInContent -> Column( modifier = Modifier diff --git a/app/src/main/java/eu/kanade/presentation/library/components/Badge.kt b/app/src/main/java/eu/kanade/presentation/components/Badges.kt similarity index 82% rename from app/src/main/java/eu/kanade/presentation/library/components/Badge.kt rename to app/src/main/java/eu/kanade/presentation/components/Badges.kt index b73001bd0..1ecbb6c8f 100644 --- a/app/src/main/java/eu/kanade/presentation/library/components/Badge.kt +++ b/app/src/main/java/eu/kanade/presentation/components/Badges.kt @@ -1,4 +1,4 @@ -package eu.kanade.presentation.library.components +package eu.kanade.presentation.components import androidx.compose.foundation.background import androidx.compose.foundation.layout.Box @@ -6,6 +6,7 @@ import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.RowScope import androidx.compose.foundation.layout.padding import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.material3.LocalTextStyle import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable @@ -14,6 +15,7 @@ import androidx.compose.ui.draw.clip import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.RectangleShape import androidx.compose.ui.graphics.Shape +import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.dp @Composable @@ -42,7 +44,10 @@ fun Badge( Text( text = text, modifier = Modifier.padding(horizontal = 4.dp, vertical = 2.dp), - color = textColor, + style = LocalTextStyle.current.copy( + color = textColor, + fontWeight = FontWeight.Medium, + ), ) } } diff --git a/app/src/main/java/eu/kanade/presentation/components/ItemBadges.kt b/app/src/main/java/eu/kanade/presentation/components/ItemBadges.kt deleted file mode 100644 index cbdbc06d0..000000000 --- a/app/src/main/java/eu/kanade/presentation/components/ItemBadges.kt +++ /dev/null @@ -1,36 +0,0 @@ -package eu.kanade.presentation.components - -import androidx.compose.foundation.background -import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.padding -import androidx.compose.foundation.shape.RoundedCornerShape -import androidx.compose.material3.MaterialTheme -import androidx.compose.material3.Text -import androidx.compose.runtime.Composable -import androidx.compose.ui.Modifier -import androidx.compose.ui.draw.clip -import androidx.compose.ui.text.font.FontWeight -import androidx.compose.ui.unit.dp - -@Composable -fun ItemBadges( - modifier: Modifier = Modifier, - primaryText: String, -) { - Row( - modifier = modifier.clip(RoundedCornerShape(4.dp)), - ) { - Text( - text = primaryText, - modifier = Modifier - .background(MaterialTheme.colorScheme.primary) - .padding(horizontal = 4.dp, vertical = 2.dp), - style = MaterialTheme.typography.bodyMedium.copy( - color = MaterialTheme.colorScheme.onPrimary, - fontWeight = FontWeight.Medium, - ), - ) - - // TODO: support more badges (e.g., for library items) - } -} diff --git a/app/src/main/java/eu/kanade/presentation/library/components/LibraryGridCover.kt b/app/src/main/java/eu/kanade/presentation/library/components/LibraryGridCover.kt index 0bb33c9d0..b67b1f50a 100644 --- a/app/src/main/java/eu/kanade/presentation/library/components/LibraryGridCover.kt +++ b/app/src/main/java/eu/kanade/presentation/library/components/LibraryGridCover.kt @@ -11,6 +11,8 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp +import eu.kanade.presentation.components.Badge +import eu.kanade.presentation.components.BadgeGroup import eu.kanade.presentation.components.MangaCover import eu.kanade.tachiyomi.R diff --git a/app/src/main/java/eu/kanade/presentation/library/components/LibraryList.kt b/app/src/main/java/eu/kanade/presentation/library/components/LibraryList.kt index 0f5ee8a3f..9543335a1 100644 --- a/app/src/main/java/eu/kanade/presentation/library/components/LibraryList.kt +++ b/app/src/main/java/eu/kanade/presentation/library/components/LibraryList.kt @@ -18,6 +18,8 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import eu.kanade.domain.manga.model.MangaCover +import eu.kanade.presentation.components.Badge +import eu.kanade.presentation.components.BadgeGroup import eu.kanade.presentation.util.horizontalPadding import eu.kanade.presentation.util.selectedBackground import eu.kanade.presentation.util.verticalPadding diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaPresenter.kt index 2e4cd5490..f0e980178 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaPresenter.kt @@ -186,7 +186,7 @@ class MangaPresenter( trackingAvailable = trackManager.hasLoggedServices(), chapters = chapterItems, isIncognitoMode = incognitoMode, - isDownloadedOnlyMode = downloadedOnlyMode + isDownloadedOnlyMode = downloadedOnlyMode, ) // Update state