Move default category into database (#7676)

This commit is contained in:
Andreas
2022-08-05 15:32:10 +02:00
committed by GitHub
parent 5315467908
commit 914831d51f
23 changed files with 269 additions and 216 deletions

View File

@@ -0,0 +1,20 @@
package eu.kanade.presentation.category
import android.content.Context
import androidx.compose.runtime.Composable
import androidx.compose.ui.res.stringResource
import eu.kanade.domain.category.model.Category
import eu.kanade.tachiyomi.R
val Category.visualName: String
@Composable
get() = when (id) {
Category.UNCATEGORIZED_ID -> stringResource(id = R.string.label_default)
else -> name
}
fun Category.visualName(context: Context): String =
when (id) {
Category.UNCATEGORIZED_ID -> context.getString(R.string.label_default)
else -> name
}

View File

@@ -23,6 +23,7 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.google.accompanist.pager.PagerState
import eu.kanade.domain.category.model.Category
import eu.kanade.presentation.category.visualName
import eu.kanade.presentation.components.DownloadedOnlyModeBanner
import eu.kanade.presentation.components.IncognitoModeBanner
import eu.kanade.presentation.components.Pill
@@ -67,7 +68,7 @@ fun LibraryTabs(
verticalAlignment = Alignment.CenterVertically,
) {
Text(
text = category.name,
text = category.visualName,
color = if (state.currentPage == index) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.onBackground,
)
if (count != null) {