Finish migration to moko resources

This commit is contained in:
Jobobby04 2023-12-23 22:40:54 -05:00
parent 82098460ff
commit 16d433973c
175 changed files with 2061 additions and 1946 deletions

View File

@ -35,7 +35,8 @@ class GetEnabledSources(
) { pinnedSourceIds,
(enabledLanguages, disabledSources, lastUsedSource),
(excludedFromDataSaver, sourcesInCategories, sourceCategoriesFilter),
sources ->
sources,
->
val sourcesAndCategories = sourcesInCategories.map {
it.split('|').let { (source, test) -> source.toLong() to test }

View File

@ -104,7 +104,7 @@ fun BrowseSourceContent(
// SY -->
if (onWebViewClick != null) {
EmptyScreenAction(
stringResId = R.string.action_open_in_web_view,
MR.strings.action_open_in_web_view,
icon = Icons.Outlined.Public,
onClick = onWebViewClick,
)
@ -113,7 +113,7 @@ fun BrowseSourceContent(
},
if (onHelpClick != null) {
EmptyScreenAction(
stringResId = R.string.label_help,
MR.strings.label_help,
icon = Icons.AutoMirrored.Outlined.HelpOutline,
onClick = onHelpClick,
)

View File

@ -4,11 +4,11 @@ import androidx.compose.material3.SnackbarHost
import androidx.compose.material3.SnackbarHostState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.res.stringResource
import eu.kanade.presentation.components.AppBar
import eu.kanade.presentation.components.AppBarActions
import eu.kanade.presentation.components.TabContent
import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun BrowseTabWrapper(tab: TabContent) {

View File

@ -39,7 +39,6 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalUriHandler
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
@ -51,15 +50,17 @@ import eu.kanade.presentation.components.AppBarActions
import eu.kanade.presentation.components.WarningBanner
import eu.kanade.presentation.more.settings.widget.TextPreferenceWidget
import eu.kanade.presentation.more.settings.widget.TrailingWidgetBuffer
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.extension.model.Extension
import eu.kanade.tachiyomi.source.ConfigurableSource
import eu.kanade.tachiyomi.ui.browse.extension.details.ExtensionDetailsScreenModel
import eu.kanade.tachiyomi.util.system.LocaleHelper
import kotlinx.collections.immutable.persistentListOf
import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.components.ScrollbarLazyColumn
import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.screens.EmptyScreen
@Composable
@ -78,7 +79,7 @@ fun ExtensionDetailsScreen(
Scaffold(
topBar = { scrollBehavior ->
AppBar(
title = stringResource(R.string.label_extension_info),
title = stringResource(MR.strings.label_extension_info),
navigateUp = navigateUp,
actions = {
AppBarActions(
@ -87,14 +88,14 @@ fun ExtensionDetailsScreen(
if (state.extension?.isUnofficial == false) {
add(
AppBar.Action(
title = stringResource(R.string.whats_new),
title = stringResource(MR.strings.whats_new),
icon = Icons.Outlined.History,
onClick = onClickWhatsNew,
),
)
add(
AppBar.Action(
title = stringResource(R.string.action_faq_and_guides),
title = stringResource(MR.strings.action_faq_and_guides),
icon = Icons.AutoMirrored.Outlined.HelpOutline,
onClick = onClickReadme,
),
@ -103,15 +104,15 @@ fun ExtensionDetailsScreen(
addAll(
listOf(
AppBar.OverflowAction(
title = stringResource(R.string.action_enable_all),
title = stringResource(MR.strings.action_enable_all),
onClick = onClickEnableAll,
),
AppBar.OverflowAction(
title = stringResource(R.string.action_disable_all),
title = stringResource(MR.strings.action_disable_all),
onClick = onClickDisableAll,
),
AppBar.OverflowAction(
title = stringResource(R.string.pref_clear_cookies),
title = stringResource(MR.strings.pref_clear_cookies),
onClick = onClickClearCookies,
),
),
@ -126,7 +127,7 @@ fun ExtensionDetailsScreen(
) { paddingValues ->
if (state.extension == null) {
EmptyScreen(
textResource = R.string.empty_screen,
MR.strings.empty_screen,
modifier = Modifier.padding(paddingValues),
)
return@Scaffold
@ -162,13 +163,13 @@ private fun ExtensionDetails(
// SY -->
extension.isRedundant ->
item {
WarningBanner(R.string.redundant_extension_message)
WarningBanner(SYMR.strings.redundant_extension_message)
}
extension.isRepoSource ->
item {
val uriHandler = LocalUriHandler.current
WarningBanner(
R.string.repo_extension_message,
SYMR.strings.repo_extension_message,
modifier = Modifier.clickable {
extension.repoUrl ?: return@clickable
uriHandler.openUri(
@ -182,11 +183,11 @@ private fun ExtensionDetails(
// SY <--
extension.isUnofficial ->
item {
WarningBanner(R.string.unofficial_extension_message)
WarningBanner(MR.strings.unofficial_extension_message)
}
extension.isObsolete ->
item {
WarningBanner(R.string.obsolete_extension_message)
WarningBanner(MR.strings.obsolete_extension_message)
}
}
@ -282,7 +283,7 @@ private fun DetailsHeader(
InfoText(
modifier = Modifier.weight(1f),
primaryText = extension.versionName,
secondaryText = stringResource(R.string.ext_info_version),
secondaryText = stringResource(MR.strings.ext_info_version),
)
InfoDivider()
@ -290,7 +291,7 @@ private fun DetailsHeader(
InfoText(
modifier = Modifier.weight(if (extension.isNsfw) 1.5f else 1f),
primaryText = LocaleHelper.getSourceDisplayName(extension.lang, context),
secondaryText = stringResource(R.string.ext_info_language),
secondaryText = stringResource(MR.strings.ext_info_language),
)
if (extension.isNsfw) {
@ -298,12 +299,12 @@ private fun DetailsHeader(
InfoText(
modifier = Modifier.weight(1f),
primaryText = stringResource(R.string.ext_nsfw_short),
primaryText = stringResource(MR.strings.ext_nsfw_short),
primaryTextStyle = MaterialTheme.typography.bodyLarge.copy(
color = MaterialTheme.colorScheme.error,
fontWeight = FontWeight.Medium,
),
secondaryText = stringResource(R.string.ext_info_age_rating),
secondaryText = stringResource(MR.strings.ext_info_age_rating),
onClick = onClickAgeRating,
)
}
@ -322,7 +323,7 @@ private fun DetailsHeader(
modifier = Modifier.weight(1f),
onClick = onClickUninstall,
) {
Text(stringResource(R.string.ext_uninstall))
Text(stringResource(MR.strings.ext_uninstall))
}
if (onClickAppInfo != null) {
@ -331,7 +332,7 @@ private fun DetailsHeader(
onClick = onClickAppInfo,
) {
Text(
text = stringResource(R.string.ext_app_info),
text = stringResource(MR.strings.ext_app_info),
color = MaterialTheme.colorScheme.onPrimary,
)
}
@ -409,7 +410,7 @@ private fun SourceSwitchPreference(
IconButton(onClick = { onClickSourcePreferences(source.source.id) }) {
Icon(
imageVector = Icons.Outlined.Settings,
contentDescription = stringResource(R.string.label_settings),
contentDescription = stringResource(MR.strings.label_settings),
tint = MaterialTheme.colorScheme.onSurface,
)
}
@ -432,11 +433,11 @@ private fun NsfwWarningDialog(
) {
AlertDialog(
text = {
Text(text = stringResource(R.string.ext_nsfw_warning))
Text(text = stringResource(MR.strings.ext_nsfw_warning))
},
confirmButton = {
TextButton(onClick = onClickConfirm) {
Text(text = stringResource(R.string.action_ok))
Text(text = stringResource(MR.strings.action_ok))
}
},
onDismissRequest = onClickConfirm,

View File

@ -1,6 +1,5 @@
package eu.kanade.presentation.browse
import androidx.annotation.StringRes
import androidx.compose.animation.core.animateDpAsState
import androidx.compose.foundation.combinedClickable
import androidx.compose.foundation.layout.Arrangement
@ -34,13 +33,12 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import dev.icerock.moko.resources.StringResource
import eu.kanade.presentation.browse.components.BaseBrowseItem
import eu.kanade.presentation.browse.components.ExtensionIcon
import eu.kanade.presentation.manga.components.DotSeparatorNoSpaceText
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.extension.model.Extension
import eu.kanade.tachiyomi.extension.model.InstallStep
import eu.kanade.tachiyomi.source.ConfigurableSource
@ -48,10 +46,13 @@ import eu.kanade.tachiyomi.ui.browse.extension.ExtensionUiModel
import eu.kanade.tachiyomi.ui.browse.extension.ExtensionsScreenModel
import eu.kanade.tachiyomi.util.system.LocaleHelper
import exh.source.anyIs
import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.components.FastScrollLazyColumn
import tachiyomi.presentation.core.components.material.PullRefresh
import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.components.material.topSmallPaddingValues
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.screens.EmptyScreen
import tachiyomi.presentation.core.screens.LoadingScreen
import tachiyomi.presentation.core.theme.header
@ -82,12 +83,12 @@ fun ExtensionScreen(
state.isLoading -> LoadingScreen(Modifier.padding(contentPadding))
state.isEmpty -> {
val msg = if (!searchQuery.isNullOrEmpty()) {
R.string.no_results_found
MR.strings.no_results_found
} else {
R.string.empty_screen
MR.strings.empty_screen
}
EmptyScreen(
textResource = msg,
msg,
modifier = Modifier.padding(contentPadding),
)
}
@ -135,11 +136,11 @@ private fun ExtensionContent(
when (header) {
is ExtensionUiModel.Header.Resource -> {
val action: @Composable RowScope.() -> Unit =
if (header.textRes == R.string.ext_updates_pending) {
if (header.textRes == MR.strings.ext_updates_pending) {
{
Button(onClick = { onClickUpdateAll() }) {
Text(
text = stringResource(R.string.ext_update_all),
text = stringResource(MR.strings.ext_update_all),
style = LocalTextStyle.current.copy(
color = MaterialTheme.colorScheme.onPrimary,
),
@ -304,15 +305,15 @@ private fun ExtensionItemContent(
}
val warning = when {
extension is Extension.Untrusted -> R.string.ext_untrusted
extension is Extension.Untrusted -> MR.strings.ext_untrusted
// SY -->
extension is Extension.Installed && extension.isRepoSource -> R.string.repo_source
extension is Extension.Available && extension.isRepoSource -> R.string.repo_source
extension is Extension.Installed && extension.isRepoSource -> SYMR.strings.repo_source
extension is Extension.Available && extension.isRepoSource -> SYMR.strings.repo_source
// SY <--
extension is Extension.Installed && extension.isUnofficial -> R.string.ext_unofficial
extension is Extension.Installed && extension.isObsolete -> R.string.ext_obsolete
extension is Extension.Installed && extension.isRedundant -> R.string.ext_redundant
extension.isNsfw -> R.string.ext_nsfw_short
extension is Extension.Installed && extension.isUnofficial -> MR.strings.ext_unofficial
extension is Extension.Installed && extension.isObsolete -> MR.strings.ext_obsolete
extension is Extension.Installed && extension.isRedundant -> SYMR.strings.ext_redundant
extension.isNsfw -> MR.strings.ext_nsfw_short
else -> null
}
if (warning != null) {
@ -328,9 +329,9 @@ private fun ExtensionItemContent(
DotSeparatorNoSpaceText()
Text(
text = when (installStep) {
InstallStep.Pending -> stringResource(R.string.ext_pending)
InstallStep.Downloading -> stringResource(R.string.ext_downloading)
InstallStep.Installing -> stringResource(R.string.ext_installing)
InstallStep.Pending -> stringResource(MR.strings.ext_pending)
InstallStep.Downloading -> stringResource(MR.strings.ext_downloading)
InstallStep.Installing -> stringResource(MR.strings.ext_installing)
else -> error("Must not show non-install process text")
},
)
@ -364,19 +365,19 @@ private fun ExtensionItemActions(
) {
Text(
text = when (installStep) {
InstallStep.Installed -> stringResource(R.string.ext_installed)
InstallStep.Error -> stringResource(R.string.action_retry)
InstallStep.Installed -> stringResource(MR.strings.ext_installed)
InstallStep.Error -> stringResource(MR.strings.action_retry)
InstallStep.Idle -> {
when (extension) {
is Extension.Installed -> {
if (extension.hasUpdate) {
stringResource(R.string.ext_update)
stringResource(MR.strings.ext_update)
} else {
stringResource(R.string.action_settings)
stringResource(MR.strings.action_settings)
}
}
is Extension.Untrusted -> stringResource(R.string.ext_trust)
is Extension.Available -> stringResource(R.string.ext_install)
is Extension.Untrusted -> stringResource(MR.strings.ext_trust)
is Extension.Available -> stringResource(MR.strings.ext_install)
}
}
else -> error("Must not show install process text")
@ -387,7 +388,7 @@ private fun ExtensionItemActions(
IconButton(onClick = { onClickItemCancel(extension) }) {
Icon(
imageVector = Icons.Outlined.Close,
contentDescription = stringResource(R.string.action_cancel),
contentDescription = stringResource(MR.strings.action_cancel),
)
}
}
@ -396,7 +397,7 @@ private fun ExtensionItemActions(
@Composable
private fun ExtensionHeader(
@StringRes textRes: Int,
textRes: StringResource,
modifier: Modifier = Modifier,
action: @Composable RowScope.() -> Unit = {},
) {
@ -436,19 +437,19 @@ private fun ExtensionTrustDialog(
) {
AlertDialog(
title = {
Text(text = stringResource(R.string.untrusted_extension))
Text(text = stringResource(MR.strings.untrusted_extension))
},
text = {
Text(text = stringResource(R.string.untrusted_extension_message))
Text(text = stringResource(MR.strings.untrusted_extension_message))
},
confirmButton = {
TextButton(onClick = onClickConfirm) {
Text(text = stringResource(R.string.ext_trust))
Text(text = stringResource(MR.strings.ext_trust))
}
},
dismissButton = {
TextButton(onClick = onClickDismiss) {
Text(text = stringResource(R.string.ext_uninstall))
Text(text = stringResource(MR.strings.ext_uninstall))
}
},
onDismissRequest = onDismissRequest,

View File

@ -27,22 +27,26 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import eu.kanade.presentation.browse.components.GlobalSearchCardRow
import eu.kanade.presentation.browse.components.GlobalSearchErrorResultItem
import eu.kanade.presentation.browse.components.GlobalSearchLoadingResultItem
import eu.kanade.presentation.browse.components.GlobalSearchResultItem
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.source.CatalogueSource
import eu.kanade.tachiyomi.ui.browse.feed.FeedScreenState
import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.toImmutableList
import kotlinx.coroutines.delay
import tachiyomi.core.i18n.stringResource
import tachiyomi.domain.manga.model.Manga
import tachiyomi.domain.source.model.FeedSavedSearch
import tachiyomi.domain.source.model.SavedSearch
import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.components.ScrollbarLazyColumn
import tachiyomi.presentation.core.components.material.PullRefresh
import tachiyomi.presentation.core.components.material.topSmallPaddingValues
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.screens.EmptyScreen
import tachiyomi.presentation.core.screens.LoadingScreen
import tachiyomi.presentation.core.util.plus
@ -71,7 +75,7 @@ fun FeedScreen(
when {
state.isLoading -> LoadingScreen()
state.isEmpty -> EmptyScreen(
textResource = R.string.feed_tab_empty,
SYMR.strings.feed_tab_empty,
modifier = Modifier.padding(contentPadding),
)
else -> {
@ -137,7 +141,7 @@ fun FeedItem(
GlobalSearchLoadingResultItem()
}
item.results.isEmpty() -> {
GlobalSearchErrorResultItem(message = stringResource(R.string.no_results_found))
GlobalSearchErrorResultItem(message = stringResource(MR.strings.no_results_found))
}
else -> {
GlobalSearchCardRow(
@ -152,14 +156,14 @@ fun FeedItem(
@Composable
fun FeedAddDialog(
sources: List<CatalogueSource>,
sources: ImmutableList<CatalogueSource>,
onDismiss: () -> Unit,
onClickAdd: (CatalogueSource?) -> Unit,
) {
var selected by remember { mutableStateOf<Int?>(null) }
AlertDialog(
title = {
Text(text = stringResource(R.string.feed))
Text(text = stringResource(SYMR.strings.feed))
},
text = {
RadioSelector(options = sources, selected = selected) {
@ -169,7 +173,7 @@ fun FeedAddDialog(
onDismissRequest = onDismiss,
confirmButton = {
TextButton(onClick = { onClickAdd(selected?.let { sources[it] }) }) {
Text(text = stringResource(R.string.action_ok))
Text(text = stringResource(MR.strings.action_ok))
}
},
)
@ -178,7 +182,7 @@ fun FeedAddDialog(
@Composable
fun FeedAddSearchDialog(
source: CatalogueSource,
savedSearches: List<SavedSearch?>,
savedSearches: ImmutableList<SavedSearch?>,
onDismiss: () -> Unit,
onClickAdd: (CatalogueSource, SavedSearch?) -> Unit,
) {
@ -191,8 +195,8 @@ fun FeedAddSearchDialog(
val context = LocalContext.current
val savedSearchStrings = remember {
savedSearches.map {
it?.name ?: context.getString(R.string.latest)
}
it?.name ?: context.stringResource(MR.strings.latest)
}.toImmutableList()
}
RadioSelector(
options = savedSearches,
@ -205,7 +209,7 @@ fun FeedAddSearchDialog(
onDismissRequest = onDismiss,
confirmButton = {
TextButton(onClick = { onClickAdd(source, selected?.let { savedSearches[it] }) }) {
Text(text = stringResource(R.string.action_ok))
Text(text = stringResource(MR.strings.action_ok))
}
},
)
@ -213,8 +217,8 @@ fun FeedAddSearchDialog(
@Composable
fun <T> RadioSelector(
options: List<T>,
optionStrings: List<String> = remember { options.map { it.toString() } },
options: ImmutableList<T>,
optionStrings: ImmutableList<String> = remember { options.map { it.toString() }.toImmutableList() },
selected: Int?,
onSelectOption: (Int) -> Unit,
) {
@ -243,15 +247,15 @@ fun FeedDeleteConfirmDialog(
) {
AlertDialog(
title = {
Text(text = stringResource(R.string.feed))
Text(text = stringResource(SYMR.strings.feed))
},
text = {
Text(text = stringResource(R.string.feed_delete))
Text(text = stringResource(SYMR.strings.feed_delete))
},
onDismissRequest = onDismiss,
confirmButton = {
TextButton(onClick = { onClickDeleteConfirm(feed) }) {
Text(text = stringResource(R.string.action_delete))
Text(text = stringResource(MR.strings.action_delete))
}
},
)

View File

@ -14,6 +14,7 @@ import eu.kanade.tachiyomi.ui.browse.source.globalsearch.SearchItemResult
import eu.kanade.tachiyomi.ui.browse.source.globalsearch.SearchScreenModel
import eu.kanade.tachiyomi.ui.browse.source.globalsearch.SourceFilter
import eu.kanade.tachiyomi.util.system.LocaleHelper
import kotlinx.collections.immutable.ImmutableMap
import tachiyomi.domain.manga.model.Manga
import tachiyomi.presentation.core.components.material.Scaffold
@ -60,7 +61,7 @@ fun GlobalSearchScreen(
@Composable
internal fun GlobalSearchContent(
items: Map<CatalogueSource, SearchItemResult>,
items: ImmutableMap<CatalogueSource, SearchItemResult>,
contentPadding: PaddingValues,
getManga: @Composable (Manga) -> State<Manga>,
onClickSource: (CatalogueSource) -> Unit,

View File

@ -180,7 +180,7 @@ private fun MigrateSourceItem(
// SY -->
TextButton(onClick = onClickAll) {
Text(
text = stringResource(id = R.string.all),
text = stringResource(MR.strings.all),
style = LocalTextStyle.current.copy(
color = MaterialTheme.colorScheme.primary,
),

View File

@ -9,6 +9,7 @@ import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.items
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.outlined.ArrowForward
import androidx.compose.material.icons.outlined.ArrowForward
import androidx.compose.material.icons.outlined.ContentCopy
import androidx.compose.material.icons.outlined.CopyAll
@ -21,26 +22,28 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.produceState
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.browse.components.MigrationActionIcon
import eu.kanade.presentation.browse.components.MigrationItem
import eu.kanade.presentation.browse.components.MigrationItemResult
import eu.kanade.presentation.components.AppBar
import eu.kanade.presentation.components.AppBarActions
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.ui.browse.migration.advanced.process.MigratingManga
import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.persistentListOf
import tachiyomi.core.util.lang.withIOContext
import tachiyomi.domain.manga.model.Manga
import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.components.ScrollbarLazyColumn
import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.components.material.topSmallPaddingValues
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.plus
@Composable
fun MigrationListScreen(
items: List<MigratingManga>,
items: ImmutableList<MigratingManga>,
migrationDone: Boolean,
unfinishedCount: Int,
getManga: suspend (MigratingManga.SearchResult.Result) -> Manga?,
@ -55,7 +58,7 @@ fun MigrationListScreen(
) {
Scaffold(
topBar = { scrollBehavior ->
val titleString = stringResource(R.string.migration)
val titleString = stringResource(SYMR.strings.migration)
val title by produceState(initialValue = titleString, items, unfinishedCount, titleString) {
withIOContext {
value = "$titleString ($unfinishedCount/${items.size})"
@ -67,13 +70,13 @@ fun MigrationListScreen(
AppBarActions(
persistentListOf(
AppBar.Action(
title = stringResource(R.string.copy),
title = stringResource(MR.strings.copy),
icon = if (items.size == 1) Icons.Outlined.ContentCopy else Icons.Outlined.CopyAll,
onClick = { openMigrationDialog(false) },
enabled = migrationDone,
),
AppBar.Action(
title = stringResource(R.string.migrate),
title = stringResource(MR.strings.migrate),
icon = if (items.size == 1) Icons.Outlined.Done else Icons.Outlined.DoneAll,
onClick = { openMigrationDialog(false) },
enabled = migrationDone,
@ -112,8 +115,8 @@ fun MigrationListScreen(
)
Icon(
Icons.Outlined.ArrowForward,
contentDescription = stringResource(R.string.migrating_to),
Icons.AutoMirrored.Outlined.ArrowForward,
contentDescription = stringResource(SYMR.strings.migrating_to),
modifier = Modifier.weight(0.2f),
)

View File

@ -8,7 +8,6 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.ReadOnlyComposable
import androidx.compose.runtime.State
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import eu.kanade.presentation.browse.components.BrowseSourceFloatingActionButton
import eu.kanade.presentation.browse.components.GlobalSearchCardRow
import eu.kanade.presentation.browse.components.GlobalSearchErrorResultItem
@ -16,13 +15,15 @@ import eu.kanade.presentation.browse.components.GlobalSearchLoadingResultItem
import eu.kanade.presentation.browse.components.GlobalSearchResultItem
import eu.kanade.presentation.components.AppBarTitle
import eu.kanade.presentation.components.SearchToolbar
import eu.kanade.tachiyomi.R
import kotlinx.collections.immutable.ImmutableList
import tachiyomi.domain.manga.model.Manga
import tachiyomi.domain.source.model.FeedSavedSearch
import tachiyomi.domain.source.model.SavedSearch
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.ScrollbarLazyColumn
import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.components.material.topSmallPaddingValues
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.screens.LoadingScreen
import tachiyomi.presentation.core.util.plus
@ -43,7 +44,7 @@ sealed class SourceFeedUI {
override val title: String
@Composable
@ReadOnlyComposable
get() = stringResource(R.string.latest)
get() = stringResource(MR.strings.latest)
override fun withResults(results: List<Manga>?): SourceFeedUI {
return copy(results = results)
@ -54,7 +55,7 @@ sealed class SourceFeedUI {
override val title: String
@Composable
@ReadOnlyComposable
get() = stringResource(R.string.browse)
get() = stringResource(MR.strings.browse)
override fun withResults(results: List<Manga>?): SourceFeedUI {
return copy(results = results)
@ -83,7 +84,7 @@ sealed class SourceFeedUI {
fun SourceFeedScreen(
name: String,
isLoading: Boolean,
items: List<SourceFeedUI>,
items: ImmutableList<SourceFeedUI>,
hasFilters: Boolean,
onFabClick: () -> Unit,
onClickBrowse: () -> Unit,
@ -113,7 +114,7 @@ fun SourceFeedScreen(
)
},
) { paddingValues ->
Crossfade(targetState = isLoading) { state ->
Crossfade(targetState = isLoading, label = "source_feed") { state ->
when (state) {
true -> LoadingScreen()
false -> {
@ -135,7 +136,7 @@ fun SourceFeedScreen(
@Composable
fun SourceFeedList(
items: List<SourceFeedUI>,
items: ImmutableList<SourceFeedUI>,
paddingValues: PaddingValues,
getMangaState: @Composable ((Manga) -> State<Manga>),
onClickBrowse: () -> Unit,
@ -192,7 +193,7 @@ fun SourceFeedItem(
GlobalSearchLoadingResultItem()
}
results.isEmpty() -> {
GlobalSearchErrorResultItem(message = stringResource(R.string.no_results_found))
GlobalSearchErrorResultItem(message = stringResource(MR.strings.no_results_found))
}
else -> {
GlobalSearchCardRow(
@ -220,6 +221,6 @@ fun SourceFeedToolbar(
onSearch = onClickSearch,
onClickCloseSearch = { onSearchQueryChange(null) },
scrollBehavior = scrollBehavior,
placeholderText = stringResource(R.string.action_search_hint),
placeholderText = stringResource(MR.strings.action_search_hint),
)
}

View File

@ -15,6 +15,7 @@ import eu.kanade.tachiyomi.ui.browse.source.SourcesFilterScreenModel
import eu.kanade.tachiyomi.util.system.LocaleHelper
import tachiyomi.domain.source.model.Source
import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.components.FastScrollLazyColumn
import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.i18n.stringResource
@ -141,7 +142,7 @@ fun SourcesFilterToggle(
) {
SwitchPreferenceWidget(
modifier = modifier,
title = stringResource(R.string.pref_category_all_sources),
title = stringResource(SYMR.strings.pref_category_all_sources),
checked = isEnabled,
onCheckedChanged = { onClickItem() },
)

View File

@ -23,20 +23,22 @@ import androidx.compose.runtime.mutableStateListOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import eu.kanade.presentation.browse.components.BaseSourceItem
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.ui.browse.source.SourcesScreenModel
import eu.kanade.tachiyomi.ui.browse.source.browse.BrowseSourceScreenModel.Listing
import eu.kanade.tachiyomi.util.system.LocaleHelper
import kotlinx.collections.immutable.ImmutableList
import tachiyomi.domain.source.model.Pin
import tachiyomi.domain.source.model.Source
import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.components.LabeledCheckbox
import tachiyomi.presentation.core.components.ScrollbarLazyColumn
import tachiyomi.presentation.core.components.material.SecondaryItemAlpha
import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.components.material.topSmallPaddingValues
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.screens.EmptyScreen
import tachiyomi.presentation.core.screens.LoadingScreen
import tachiyomi.presentation.core.theme.header
@ -54,7 +56,7 @@ fun SourcesScreen(
when {
state.isLoading -> LoadingScreen(Modifier.padding(contentPadding))
state.isEmpty -> EmptyScreen(
textResource = R.string.source_empty_screen,
MR.strings.source_empty_screen,
modifier = Modifier.padding(contentPadding),
)
else -> {
@ -146,7 +148,7 @@ private fun SourceItem(
if (source.supportsLatest /* SY --> */ && showLatest /* SY <-- */) {
TextButton(onClick = { onClickItem(source, Listing.Latest) }) {
Text(
text = stringResource(R.string.latest),
text = stringResource(MR.strings.latest),
style = LocalTextStyle.current.copy(
color = MaterialTheme.colorScheme.primary,
),
@ -178,7 +180,7 @@ private fun SourcePinButton(
alpha = SecondaryItemAlpha,
)
}
val description = if (isPinned) R.string.action_unpin else R.string.action_pin
val description = if (isPinned) MR.strings.action_unpin else MR.strings.action_pin
IconButton(onClick = onClick) {
Icon(
imageVector = icon,
@ -205,7 +207,7 @@ fun SourceOptionsDialog(
},
text = {
Column {
val textId = if (Pin.Pinned in source.pin) R.string.action_unpin else R.string.action_pin
val textId = if (Pin.Pinned in source.pin) MR.strings.action_unpin else MR.strings.action_pin
Text(
text = stringResource(textId),
modifier = Modifier
@ -215,7 +217,7 @@ fun SourceOptionsDialog(
)
if (!source.isLocal()) {
Text(
text = stringResource(R.string.action_disable),
text = stringResource(MR.strings.action_disable),
modifier = Modifier
.clickable(onClick = onClickDisable)
.fillMaxWidth()
@ -225,7 +227,7 @@ fun SourceOptionsDialog(
// SY -->
if (onClickSetCategories != null) {
Text(
text = stringResource(id = R.string.categories),
text = stringResource(MR.strings.categories),
modifier = Modifier
.clickable(onClick = onClickSetCategories)
.fillMaxWidth()
@ -235,9 +237,9 @@ fun SourceOptionsDialog(
if (onClickToggleDataSaver != null) {
Text(
text = if (source.isExcludedFromDataSaver) {
stringResource(id = R.string.data_saver_stop_exclude)
stringResource(SYMR.strings.data_saver_stop_exclude)
} else {
stringResource(id = R.string.data_saver_exclude)
stringResource(SYMR.strings.data_saver_exclude)
},
modifier = Modifier
.clickable(onClick = onClickToggleDataSaver)
@ -262,7 +264,7 @@ sealed interface SourceUiModel {
@Composable
fun SourceCategoriesDialog(
source: Source,
categories: List<String>,
categories: ImmutableList<String>,
onClickCategories: (List<String>) -> Unit,
onDismissRequest: () -> Unit,
) {
@ -293,7 +295,7 @@ fun SourceCategoriesDialog(
onDismissRequest = onDismissRequest,
confirmButton = {
TextButton(onClick = { onClickCategories(newCategories.toList()) }) {
Text(text = stringResource(R.string.action_ok))
Text(text = stringResource(MR.strings.action_ok))
}
},
)

View File

@ -11,7 +11,6 @@ import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.paging.LoadState
import androidx.paging.compose.LazyPagingItems
@ -24,6 +23,7 @@ import kotlinx.coroutines.flow.StateFlow
import tachiyomi.domain.manga.model.Manga
import tachiyomi.domain.manga.model.MangaCover
import tachiyomi.presentation.core.components.Badge
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.plus
@Composable
@ -114,7 +114,7 @@ private fun BrowseSourceComfortableGridItem(
}
metadata.relation?.let {
Badge(
text = stringResource(it.resId),
text = stringResource(it.res),
color = MaterialTheme.colorScheme.tertiary,
textColor = MaterialTheme.colorScheme.onTertiary,
)

View File

@ -11,7 +11,6 @@ import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.paging.LoadState
import androidx.paging.compose.LazyPagingItems
@ -24,6 +23,7 @@ import kotlinx.coroutines.flow.StateFlow
import tachiyomi.domain.manga.model.Manga
import tachiyomi.domain.manga.model.MangaCover
import tachiyomi.presentation.core.components.Badge
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.plus
@Composable
@ -114,7 +114,7 @@ private fun BrowseSourceCompactGridItem(
}
metadata.relation?.let {
Badge(
text = stringResource(it.resId),
text = stringResource(it.res),
color = MaterialTheme.colorScheme.tertiary,
textColor = MaterialTheme.colorScheme.onTertiary,
)

View File

@ -12,13 +12,13 @@ import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.input.TextFieldValue
import androidx.compose.ui.window.DialogProperties
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.util.system.toast
import kotlinx.collections.immutable.ImmutableList
import tachiyomi.domain.manga.model.Manga
import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.i18n.stringResource
@Composable
@ -63,7 +63,7 @@ fun SavedSearchDeleteDialog(
onDismissRequest = onDismissRequest,
confirmButton = {
TextButton(onClick = onDismissRequest) {
Text(text = stringResource(R.string.action_cancel))
Text(text = stringResource(MR.strings.action_cancel))
}
},
dismissButton = {
@ -73,14 +73,14 @@ fun SavedSearchDeleteDialog(
onDismissRequest()
},
) {
Text(text = stringResource(R.string.action_ok))
Text(text = stringResource(MR.strings.action_ok))
}
},
title = {
Text(text = stringResource(R.string.save_search_delete))
Text(text = stringResource(SYMR.strings.save_search_delete))
},
text = {
Text(text = stringResource(R.string.save_search_delete_message, name))
Text(text = stringResource(SYMR.strings.save_search_delete_message, name))
},
)
}
@ -88,7 +88,7 @@ fun SavedSearchDeleteDialog(
@Composable
fun SavedSearchCreateDialog(
onDismissRequest: () -> Unit,
currentSavedSearches: List<String>,
currentSavedSearches: ImmutableList<String>,
saveSearch: (String) -> Unit,
) {
var textFieldValue by rememberSaveable(stateSaver = TextFieldValue.Saver) {
@ -97,7 +97,7 @@ fun SavedSearchCreateDialog(
val context = LocalContext.current
AlertDialog(
onDismissRequest = onDismissRequest,
title = { Text(text = stringResource(R.string.save_search)) },
title = { Text(text = stringResource(SYMR.strings.save_search)) },
text = {
OutlinedTextField(
value = textFieldValue,
@ -105,7 +105,7 @@ fun SavedSearchCreateDialog(
singleLine = true,
modifier = Modifier.fillMaxWidth(),
placeholder = {
Text(text = stringResource(R.string.save_search_hint))
Text(text = stringResource(SYMR.strings.save_search_hint))
},
)
},
@ -120,16 +120,16 @@ fun SavedSearchCreateDialog(
saveSearch(searchName)
onDismissRequest()
} else {
context.toast(R.string.save_search_invalid_name)
context.toast(SYMR.strings.save_search_invalid_name)
}
},
) {
Text(text = stringResource(R.string.action_ok))
Text(text = stringResource(MR.strings.action_ok))
}
},
dismissButton = {
TextButton(onClick = onDismissRequest) {
Text(text = stringResource(R.string.action_cancel))
Text(text = stringResource(MR.strings.action_cancel))
}
},
)

View File

@ -25,7 +25,6 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.drawWithContent
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
@ -33,8 +32,8 @@ import androidx.paging.LoadState
import androidx.paging.compose.LazyPagingItems
import com.gowtham.ratingbar.RatingBar
import com.gowtham.ratingbar.RatingBarConfig
import dev.icerock.moko.resources.StringResource
import eu.kanade.presentation.manga.components.MangaCover
import eu.kanade.tachiyomi.R
import exh.metadata.MetadataUtil
import exh.metadata.metadata.EHentaiSearchMetadata
import exh.metadata.metadata.RaisedSearchMetadata
@ -42,11 +41,15 @@ import exh.util.SourceTagsUtil
import exh.util.SourceTagsUtil.GenreColor
import exh.util.floor
import kotlinx.coroutines.flow.StateFlow
import tachiyomi.core.i18n.pluralStringResource
import tachiyomi.core.util.lang.withIOContext
import tachiyomi.domain.manga.model.Manga
import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.components.Badge
import tachiyomi.presentation.core.components.BadgeGroup
import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.i18n.stringResource
import java.util.Date
@Composable
@ -100,7 +103,7 @@ fun BrowseSourceEHentaiListItem(
if (metadata !is EHentaiSearchMetadata) return
val overlayColor = MaterialTheme.colorScheme.background.copy(alpha = 0.66f)
val resources = LocalContext.current.resources
val context = LocalContext.current
val languageText by produceState("", metadata) {
value = withIOContext {
val locale = SourceTagsUtil.getLocaleSourceUtil(
@ -110,14 +113,14 @@ fun BrowseSourceEHentaiListItem(
)
val pageCount = metadata.length
if (locale != null && pageCount != null) {
resources.getQuantityString(
R.plurals.browse_language_and_pages,
context.pluralStringResource(
SYMR.plurals.browse_language_and_pages,
pageCount,
pageCount,
locale.toLanguageTag().uppercase()
locale.toLanguageTag().uppercase(),
)
} else if (pageCount != null) {
resources.getQuantityString(R.plurals.num_pages, pageCount, pageCount)
context.pluralStringResource(SYMR.plurals.num_pages, pageCount, pageCount)
} else {
locale?.toLanguageTag()?.uppercase().orEmpty()
}
@ -130,19 +133,19 @@ fun BrowseSourceEHentaiListItem(
.orEmpty()
}
}
val genre by produceState<Pair<GenreColor, Int>?>(null, metadata) {
val genre by produceState<Pair<GenreColor, StringResource>?>(null, metadata) {
value = withIOContext {
when (metadata.genre) {
"doujinshi" -> GenreColor.DOUJINSHI_COLOR to R.string.doujinshi
"manga" -> GenreColor.MANGA_COLOR to R.string.entry_type_manga
"artistcg" -> GenreColor.ARTIST_CG_COLOR to R.string.artist_cg
"gamecg" -> GenreColor.GAME_CG_COLOR to R.string.game_cg
"western" -> GenreColor.WESTERN_COLOR to R.string.western
"non-h" -> GenreColor.NON_H_COLOR to R.string.non_h
"imageset" -> GenreColor.IMAGE_SET_COLOR to R.string.image_set
"cosplay" -> GenreColor.COSPLAY_COLOR to R.string.cosplay
"asianporn" -> GenreColor.ASIAN_PORN_COLOR to R.string.asian_porn
"misc" -> GenreColor.MISC_COLOR to R.string.misc
"doujinshi" -> GenreColor.DOUJINSHI_COLOR to SYMR.strings.doujinshi
"manga" -> GenreColor.MANGA_COLOR to SYMR.strings.entry_type_manga
"artistcg" -> GenreColor.ARTIST_CG_COLOR to SYMR.strings.artist_cg
"gamecg" -> GenreColor.GAME_CG_COLOR to SYMR.strings.game_cg
"western" -> GenreColor.WESTERN_COLOR to SYMR.strings.western
"non-h" -> GenreColor.NON_H_COLOR to SYMR.strings.non_h
"imageset" -> GenreColor.IMAGE_SET_COLOR to SYMR.strings.image_set
"cosplay" -> GenreColor.COSPLAY_COLOR to SYMR.strings.cosplay
"asianporn" -> GenreColor.ASIAN_PORN_COLOR to SYMR.strings.asian_porn
"misc" -> GenreColor.MISC_COLOR to SYMR.strings.misc
else -> null
}
}
@ -182,7 +185,7 @@ fun BrowseSourceEHentaiListItem(
.padding(4.dp)
.align(Alignment.TopStart),
) {
Badge(stringResource(R.string.in_library))
Badge(stringResource(MR.strings.in_library))
}
}
}

View File

@ -6,9 +6,10 @@ import androidx.compose.material3.Icon
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import eu.kanade.tachiyomi.R
import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.components.material.ExtendedFloatingActionButton
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun BrowseSourceFloatingActionButton(
@ -21,9 +22,9 @@ fun BrowseSourceFloatingActionButton(
text = {
Text(
text = if (isVisible) {
stringResource(R.string.action_filter)
stringResource(MR.strings.action_filter)
} else {
stringResource(R.string.saved_searches)
stringResource(SYMR.strings.saved_searches)
},
)
},

View File

@ -8,7 +8,6 @@ import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.paging.LoadState
import androidx.paging.compose.LazyPagingItems
@ -21,6 +20,7 @@ import kotlinx.coroutines.flow.StateFlow
import tachiyomi.domain.manga.model.Manga
import tachiyomi.domain.manga.model.MangaCover
import tachiyomi.presentation.core.components.Badge
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.plus
@Composable
@ -105,7 +105,7 @@ private fun BrowseSourceListItem(
}
metadata.relation?.let {
Badge(
text = stringResource(it.resId),
text = stringResource(it.res),
color = MaterialTheme.colorScheme.tertiary,
textColor = MaterialTheme.colorScheme.onTertiary,
)

View File

@ -12,13 +12,13 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.res.stringResource
import eu.kanade.presentation.components.AppBar
import eu.kanade.presentation.components.AppBarActions
import eu.kanade.presentation.components.DropdownMenu
import eu.kanade.tachiyomi.R
import kotlinx.collections.immutable.persistentListOf
import tachiyomi.domain.library.model.LibraryDisplayMode
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun BrowseSourceSimpleToolbar(
@ -37,7 +37,7 @@ fun BrowseSourceSimpleToolbar(
// SY -->
actions = persistentListOf(
AppBar.Action(
title = stringResource(id = R.string.action_display_mode),
title = stringResource(MR.strings.action_display_mode),
icon = Icons.Outlined.ViewModule,
onClick = { selectingDisplayMode = true },
),
@ -48,7 +48,7 @@ fun BrowseSourceSimpleToolbar(
onDismissRequest = { selectingDisplayMode = false },
) {
DropdownMenuItem(
text = { Text(text = stringResource(id = R.string.action_display_comfortable_grid)) },
text = { Text(text = stringResource(MR.strings.action_display_comfortable_grid)) },
onClick = { onDisplayModeChange(LibraryDisplayMode.ComfortableGrid) },
trailingIcon = {
if (displayMode == LibraryDisplayMode.ComfortableGrid) {
@ -60,7 +60,7 @@ fun BrowseSourceSimpleToolbar(
},
)
DropdownMenuItem(
text = { Text(text = stringResource(id = R.string.action_display_grid)) },
text = { Text(text = stringResource(MR.strings.action_display_grid)) },
onClick = { onDisplayModeChange(LibraryDisplayMode.CompactGrid) },
trailingIcon = {
if (displayMode == LibraryDisplayMode.CompactGrid) {
@ -72,7 +72,7 @@ fun BrowseSourceSimpleToolbar(
},
)
DropdownMenuItem(
text = { Text(text = stringResource(id = R.string.action_display_list)) },
text = { Text(text = stringResource(MR.strings.action_display_list)) },
onClick = { onDisplayModeChange(LibraryDisplayMode.List) },
trailingIcon = {
if (displayMode == LibraryDisplayMode.List) {

View File

@ -24,7 +24,7 @@ import exh.source.anyIs
import kotlinx.collections.immutable.persistentListOf
import tachiyomi.domain.library.model.LibraryDisplayMode
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.localize
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.source.local.LocalSource
@Composable
@ -62,7 +62,7 @@ fun BrowseSourceToolbar(
if (displayMode != null) {
add(
AppBar.Action(
title = stringResource(R.string.action_display_mode),
title = stringResource(MR.strings.action_display_mode),
icon = if (displayMode == LibraryDisplayMode.List) {
Icons.AutoMirrored.Filled.ViewList
} else {
@ -76,14 +76,14 @@ fun BrowseSourceToolbar(
if (isConfigurableSource && displayMode != null) {
add(
AppBar.OverflowAction(
title = stringResource(R.string.label_help),
title = stringResource(MR.strings.label_help),
onClick = onHelpClick,
),
)
} else {
add(
AppBar.Action(
title = stringResource(R.string.label_help),
title = stringResource(MR.strings.label_help),
icon = Icons.Outlined.Help,
onClick = onHelpClick,
),
@ -93,17 +93,17 @@ fun BrowseSourceToolbar(
if (isConfigurableSource && displayMode != null) {
add(
AppBar.OverflowAction(
title = stringResource(R.string.action_web_view),
title = stringResource(MR.strings.action_web_view),
onClick = onWebViewClick,
)
),
)
} else {
add(
AppBar.Action(
title = stringResource(R.string.action_web_view),
title = stringResource(MR.strings.action_web_view),
icon = Icons.Outlined.Public,
onClick = onWebViewClick,
)
),
)
}
}
@ -111,7 +111,7 @@ fun BrowseSourceToolbar(
if (isConfigurableSource) {
add(
AppBar.OverflowAction(
title = localize(MR.strings.action_settings),
title = stringResource(MR.strings.action_settings),
onClick = onSettingsClick,
),
)
@ -125,21 +125,21 @@ fun BrowseSourceToolbar(
onDismissRequest = { selectingDisplayMode = false },
) {
RadioMenuItem(
text = { Text(text = localize(MR.strings.action_display_comfortable_grid)) },
text = { Text(text = stringResource(MR.strings.action_display_comfortable_grid)) },
isChecked = displayMode == LibraryDisplayMode.ComfortableGrid,
) {
selectingDisplayMode = false
onDisplayModeChange(LibraryDisplayMode.ComfortableGrid)
}
RadioMenuItem(
text = { Text(text = localize(MR.strings.action_display_grid)) },
text = { Text(text = stringResource(MR.strings.action_display_grid)) },
isChecked = displayMode == LibraryDisplayMode.CompactGrid,
) {
selectingDisplayMode = false
onDisplayModeChange(LibraryDisplayMode.CompactGrid)
}
RadioMenuItem(
text = { Text(text = localize(MR.strings.action_display_list)) },
text = { Text(text = stringResource(MR.strings.action_display_list)) },
isChecked = displayMode == LibraryDisplayMode.List,
) {
selectingDisplayMode = false

View File

@ -15,11 +15,12 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.DpOffset
import androidx.compose.ui.unit.dp
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.ui.browse.migration.advanced.process.MigratingManga
import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun MigrationActionIcon(
@ -38,14 +39,14 @@ fun MigrationActionIcon(
IconButton(onClick = skipManga) {
Icon(
imageVector = Icons.Outlined.Close,
contentDescription = stringResource(R.string.action_stop),
contentDescription = stringResource(SYMR.strings.action_stop),
)
}
} else if (result is MigratingManga.SearchResult.Result || result is MigratingManga.SearchResult.NotFound) {
IconButton(onClick = { moreExpanded = !moreExpanded }) {
Icon(
imageVector = Icons.Outlined.MoreVert,
contentDescription = stringResource(R.string.abc_action_menu_overflow_description),
contentDescription = stringResource(MR.strings.action_menu_overflow_description),
)
}
DropdownMenu(
@ -54,14 +55,14 @@ fun MigrationActionIcon(
offset = DpOffset(8.dp, (-56).dp),
) {
DropdownMenuItem(
text = { Text(stringResource(R.string.action_search_manually)) },
text = { Text(stringResource(SYMR.strings.action_search_manually)) },
onClick = {
searchManually()
closeMenu()
},
)
DropdownMenuItem(
text = { Text(stringResource(R.string.action_skip_entry)) },
text = { Text(stringResource(SYMR.strings.action_skip_entry)) },
onClick = {
skipManga()
closeMenu()
@ -69,14 +70,14 @@ fun MigrationActionIcon(
)
if (result is MigratingManga.SearchResult.Result) {
DropdownMenuItem(
text = { Text(stringResource(R.string.action_migrate_now)) },
text = { Text(stringResource(SYMR.strings.action_migrate_now)) },
onClick = {
migrateNow()
closeMenu()
},
)
DropdownMenuItem(
text = { Text(stringResource(R.string.action_copy_now)) },
text = { Text(stringResource(SYMR.strings.action_copy_now)) },
onClick = {
copyNow()
closeMenu()

View File

@ -4,8 +4,9 @@ import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.ui.res.stringResource
import eu.kanade.tachiyomi.R
import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun MigrationExitDialog(
@ -16,16 +17,16 @@ fun MigrationExitDialog(
onDismissRequest = onDismissRequest,
confirmButton = {
TextButton(onClick = exitMigration) {
Text(text = stringResource(R.string.action_stop))
Text(text = stringResource(SYMR.strings.action_stop))
}
},
dismissButton = {
TextButton(onClick = onDismissRequest) {
Text(text = stringResource(R.string.action_cancel))
Text(text = stringResource(MR.strings.action_cancel))
}
},
title = {
Text(text = stringResource(R.string.stop_migrating))
Text(text = stringResource(SYMR.strings.stop_migrating))
},
)
}

View File

@ -22,17 +22,17 @@ import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Shadow
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import eu.kanade.presentation.manga.components.MangaCover
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.ui.browse.migration.advanced.process.MigratingManga
import tachiyomi.core.util.lang.withIOContext
import tachiyomi.domain.manga.model.Manga
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.Badge
import tachiyomi.presentation.core.components.BadgeGroup
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun MigrationItem(
@ -77,7 +77,7 @@ fun MigrationItem(
modifier = Modifier
.padding(8.dp)
.align(Alignment.BottomStart),
text = manga.title.ifBlank { stringResource(R.string.unknown) },
text = manga.title.ifBlank { stringResource(MR.strings.unknown) },
fontSize = 12.sp,
lineHeight = 18.sp,
maxLines = 2,

View File

@ -20,7 +20,6 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import eu.kanade.presentation.manga.components.MangaCover
import eu.kanade.presentation.util.rememberResourceBitmapPainter
@ -28,6 +27,8 @@ import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.ui.browse.migration.advanced.process.MigratingManga
import tachiyomi.core.util.lang.withIOContext
import tachiyomi.domain.manga.model.Manga
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun MigrationItemResult(
@ -66,7 +67,7 @@ fun MigrationItemResult(
contentScale = ContentScale.Crop,
)
Text(
text = stringResource(R.string.no_alternatives_found),
text = stringResource(SYMR.strings.no_alternatives_found),
modifier = Modifier.padding(top = 4.dp, bottom = 1.dp, start = 8.dp),
style = MaterialTheme.typography.titleSmall,
)

View File

@ -4,9 +4,10 @@ import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.ui.res.pluralStringResource
import androidx.compose.ui.res.stringResource
import eu.kanade.tachiyomi.R
import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.i18n.pluralStringResource
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun MigrationMangaDialog(
@ -29,21 +30,21 @@ fun MigrationMangaDialog(
}
},
) {
Text(text = stringResource(if (copy) R.string.copy else R.string.migrate))
Text(text = stringResource(if (copy) MR.strings.copy else MR.strings.migrate))
}
},
dismissButton = {
TextButton(onClick = onDismissRequest) {
Text(text = stringResource(R.string.action_cancel))
Text(text = stringResource(MR.strings.action_cancel))
}
},
text = {
Text(
text = pluralStringResource(
if (copy) R.plurals.copy_entry else R.plurals.migrate_entry,
if (copy) SYMR.plurals.copy_entry else SYMR.plurals.migrate_entry,
count = mangaSet,
mangaSet,
(if (mangaSkipped > 0) " " + stringResource(R.string.skipping_, mangaSkipped) else ""),
(if (mangaSkipped > 0) " " + stringResource(SYMR.strings.skipping_, mangaSkipped) else ""),
),
)
},

View File

@ -8,9 +8,9 @@ import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.window.DialogProperties
import eu.kanade.tachiyomi.R
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun MigrationProgressDialog(
@ -21,7 +21,7 @@ fun MigrationProgressDialog(
onDismissRequest = {},
confirmButton = {
TextButton(onClick = exitMigration) {
Text(text = stringResource(R.string.action_cancel))
Text(text = stringResource(MR.strings.action_cancel))
}
},
text = {
@ -29,8 +29,11 @@ fun MigrationProgressDialog(
val progressAnimated by animateFloatAsState(
targetValue = progress,
animationSpec = ProgressIndicatorDefaults.ProgressAnimationSpec,
label = "migration_progress",
)
LinearProgressIndicator(
progress = { progressAnimated },
)
LinearProgressIndicator(progressAnimated)
}
},
properties = DialogProperties(

View File

@ -4,8 +4,9 @@ import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.ui.res.stringResource
import eu.kanade.tachiyomi.R
import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun SourceFeedAddDialog(
@ -17,19 +18,19 @@ fun SourceFeedAddDialog(
onDismissRequest = onDismissRequest,
confirmButton = {
TextButton(onClick = addFeed) {
Text(text = stringResource(R.string.action_add))
Text(text = stringResource(MR.strings.action_add))
}
},
dismissButton = {
TextButton(onClick = onDismissRequest) {
Text(text = stringResource(R.string.action_cancel))
Text(text = stringResource(MR.strings.action_cancel))
}
},
title = {
Text(text = stringResource(R.string.feed))
Text(text = stringResource(SYMR.strings.feed))
},
text = {
Text(text = stringResource(R.string.feed_add, name))
Text(text = stringResource(SYMR.strings.feed_add, name))
},
)
}
@ -43,19 +44,19 @@ fun SourceFeedDeleteDialog(
onDismissRequest = onDismissRequest,
confirmButton = {
TextButton(onClick = deleteFeed) {
Text(text = stringResource(R.string.action_delete))
Text(text = stringResource(MR.strings.action_delete))
}
},
dismissButton = {
TextButton(onClick = onDismissRequest) {
Text(text = stringResource(R.string.action_cancel))
Text(text = stringResource(MR.strings.action_cancel))
}
},
title = {
Text(text = stringResource(R.string.feed))
Text(text = stringResource(SYMR.strings.feed))
},
text = {
Text(text = stringResource(R.string.feed_delete))
Text(text = stringResource(SYMR.strings.feed_delete))
},
)
}

View File

@ -6,16 +6,16 @@ import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import eu.kanade.presentation.category.components.CategoryFloatingActionButton
import eu.kanade.presentation.category.components.biometric.BiometricTimesContent
import eu.kanade.presentation.components.AppBar
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.ui.category.biometric.BiometricTimesScreenState
import eu.kanade.tachiyomi.ui.category.biometric.TimeRangeItem
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.components.material.topSmallPaddingValues
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.screens.EmptyScreen
import tachiyomi.presentation.core.util.plus
@ -31,7 +31,7 @@ fun BiometricTimesScreen(
topBar = { scrollBehavior ->
AppBar(
navigateUp = navigateUp,
title = stringResource(R.string.biometric_lock_times),
title = stringResource(SYMR.strings.biometric_lock_times),
scrollBehavior = scrollBehavior,
)
},
@ -44,7 +44,7 @@ fun BiometricTimesScreen(
) { paddingValues ->
if (state.isEmpty) {
EmptyScreen(
textResource = R.string.biometric_lock_times_empty,
SYMR.strings.biometric_lock_times_empty,
modifier = Modifier.padding(paddingValues),
)
return@Scaffold

View File

@ -17,6 +17,7 @@ import eu.kanade.presentation.category.components.CategoryListItem
import eu.kanade.presentation.components.AppBar
import eu.kanade.presentation.components.AppBarActions
import eu.kanade.tachiyomi.ui.category.CategoryScreenState
import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.persistentListOf
import tachiyomi.domain.category.model.Category
import tachiyomi.i18n.MR
@ -88,7 +89,7 @@ fun CategoryScreen(
@Composable
private fun CategoryContent(
categories: List<Category>,
categories: ImmutableList<Category>,
lazyListState: LazyListState,
paddingValues: PaddingValues,
onClickRename: (Category) -> Unit,

View File

@ -6,15 +6,15 @@ import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import eu.kanade.presentation.category.components.CategoryFloatingActionButton
import eu.kanade.presentation.category.components.genre.SortTagContent
import eu.kanade.presentation.components.AppBar
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.ui.category.genre.SortTagScreenState
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.components.material.topSmallPaddingValues
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.screens.EmptyScreen
import tachiyomi.presentation.core.util.plus
@ -32,7 +32,7 @@ fun SortTagScreen(
topBar = { scrollBehavior ->
AppBar(
navigateUp = navigateUp,
title = stringResource(R.string.action_edit_tags),
title = stringResource(SYMR.strings.action_edit_tags),
scrollBehavior = scrollBehavior,
)
},
@ -45,7 +45,7 @@ fun SortTagScreen(
) { paddingValues ->
if (state.isEmpty) {
EmptyScreen(
textResource = R.string.information_empty_tags,
SYMR.strings.information_empty_tags,
modifier = Modifier.padding(paddingValues),
)
return@Scaffold

View File

@ -6,15 +6,16 @@ import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import eu.kanade.presentation.category.components.CategoryFloatingActionButton
import eu.kanade.presentation.category.components.sources.SourceCategoryContent
import eu.kanade.presentation.components.AppBar
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.ui.category.sources.SourceCategoryScreenState
import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.components.material.topSmallPaddingValues
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.screens.EmptyScreen
import tachiyomi.presentation.core.util.plus
@ -31,7 +32,7 @@ fun SourceCategoryScreen(
topBar = { scrollBehavior ->
AppBar(
navigateUp = navigateUp,
title = stringResource(R.string.action_edit_categories),
title = stringResource(MR.strings.action_edit_categories),
scrollBehavior = scrollBehavior,
)
},
@ -44,7 +45,7 @@ fun SourceCategoryScreen(
) { paddingValues ->
if (state.isEmpty) {
EmptyScreen(
textResource = R.string.no_source_categories,
SYMR.strings.no_source_categories,
modifier = Modifier.padding(paddingValues),
)
return@Scaffold

View File

@ -6,15 +6,15 @@ import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import eu.kanade.presentation.category.components.CategoryFloatingActionButton
import eu.kanade.presentation.category.components.repo.SourceRepoContent
import eu.kanade.presentation.components.AppBar
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.ui.category.repos.RepoScreenState
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.components.material.topSmallPaddingValues
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.screens.EmptyScreen
import tachiyomi.presentation.core.util.plus
@ -30,7 +30,7 @@ fun SourceRepoScreen(
topBar = { scrollBehavior ->
AppBar(
navigateUp = navigateUp,
title = stringResource(R.string.action_edit_repos),
title = stringResource(SYMR.strings.action_edit_repos),
scrollBehavior = scrollBehavior,
)
},
@ -43,7 +43,7 @@ fun SourceRepoScreen(
) { paddingValues ->
if (state.isEmpty) {
EmptyScreen(
textResource = R.string.information_empty_repos,
SYMR.strings.information_empty_repos,
modifier = Modifier.padding(paddingValues),
)
return@Scaffold

View File

@ -25,14 +25,17 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.res.stringResource
import dev.icerock.moko.resources.StringResource
import eu.kanade.core.preference.asToggleableState
import eu.kanade.presentation.category.visualName
import eu.kanade.tachiyomi.R
import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.toImmutableList
import kotlinx.coroutines.delay
import tachiyomi.core.preference.CheckboxState
import tachiyomi.domain.category.model.Category
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.i18n.stringResource
import kotlin.time.Duration.Companion.seconds
@Composable
@ -40,10 +43,10 @@ fun CategoryCreateDialog(
onDismissRequest: () -> Unit,
onCreate: (String) -> Unit,
// SY -->
categories: List<String>,
categories: ImmutableList<String>,
title: String,
extraMessage: String? = null,
alreadyExistsError: Int = R.string.error_category_exists,
alreadyExistsError: StringResource = MR.strings.error_category_exists,
// SY <--
) {
var name by remember { mutableStateOf("") }
@ -61,12 +64,12 @@ fun CategoryCreateDialog(
onDismissRequest()
},
) {
Text(text = stringResource(R.string.action_add))
Text(text = stringResource(MR.strings.action_add))
}
},
dismissButton = {
TextButton(onClick = onDismissRequest) {
Text(text = stringResource(R.string.action_cancel))
Text(text = stringResource(MR.strings.action_cancel))
}
},
title = {
@ -85,13 +88,13 @@ fun CategoryCreateDialog(
value = name,
onValueChange = { name = it },
label = {
Text(text = stringResource(R.string.name))
Text(text = stringResource(MR.strings.name))
},
supportingText = {
val msgRes = if (name.isNotEmpty() && nameAlreadyExists) {
alreadyExistsError
} else {
R.string.information_required_plain
MR.strings.information_required_plain
}
Text(text = stringResource(msgRes))
},
@ -116,9 +119,9 @@ fun CategoryRenameDialog(
onDismissRequest: () -> Unit,
onRename: (String) -> Unit,
// SY -->
categories: List<String>,
categories: ImmutableList<String>,
category: String,
alreadyExistsError: Int = R.string.error_category_exists,
alreadyExistsError: StringResource = MR.strings.error_category_exists,
// SY <--
) {
var name by remember { mutableStateOf(category) }
@ -136,16 +139,16 @@ fun CategoryRenameDialog(
onDismissRequest()
},
) {
Text(text = stringResource(R.string.action_ok))
Text(text = stringResource(MR.strings.action_ok))
}
},
dismissButton = {
TextButton(onClick = onDismissRequest) {
Text(text = stringResource(R.string.action_cancel))
Text(text = stringResource(MR.strings.action_cancel))
}
},
title = {
Text(text = stringResource(R.string.action_rename_category))
Text(text = stringResource(MR.strings.action_rename_category))
},
text = {
OutlinedTextField(
@ -155,12 +158,12 @@ fun CategoryRenameDialog(
valueHasChanged = name != it
name = it
},
label = { Text(text = stringResource(R.string.name)) },
label = { Text(text = stringResource(MR.strings.name)) },
supportingText = {
val msgRes = if (valueHasChanged && nameAlreadyExists) {
alreadyExistsError
} else {
R.string.information_required_plain
MR.strings.information_required_plain
}
Text(text = stringResource(msgRes))
},
@ -193,12 +196,12 @@ fun CategoryDeleteDialog(
onDelete()
onDismissRequest()
}) {
Text(text = stringResource(R.string.action_ok))
Text(text = stringResource(MR.strings.action_ok))
}
},
dismissButton = {
TextButton(onClick = onDismissRequest) {
Text(text = stringResource(R.string.action_cancel))
Text(text = stringResource(MR.strings.action_cancel))
}
},
title = {
@ -222,26 +225,26 @@ fun CategorySortAlphabeticallyDialog(
onSort()
onDismissRequest()
}) {
Text(text = stringResource(R.string.action_ok))
Text(text = stringResource(MR.strings.action_ok))
}
},
dismissButton = {
TextButton(onClick = onDismissRequest) {
Text(text = stringResource(R.string.action_cancel))
Text(text = stringResource(MR.strings.action_cancel))
}
},
title = {
Text(text = stringResource(R.string.action_sort_category))
Text(text = stringResource(MR.strings.action_sort_category))
},
text = {
Text(text = stringResource(R.string.sort_category_confirmation))
Text(text = stringResource(MR.strings.sort_category_confirmation))
},
)
}
@Composable
fun ChangeCategoryDialog(
initialSelection: List<CheckboxState<Category>>,
initialSelection: ImmutableList<CheckboxState<Category>>,
onDismissRequest: () -> Unit,
onEditCategories: () -> Unit,
onConfirm: (List<Long>, List<Long>) -> Unit,
@ -256,14 +259,14 @@ fun ChangeCategoryDialog(
onEditCategories()
},
) {
Text(text = stringResource(R.string.action_edit_categories))
Text(text = stringResource(MR.strings.action_edit_categories))
}
},
title = {
Text(text = stringResource(R.string.action_move_category))
Text(text = stringResource(MR.strings.action_move_category))
},
text = {
Text(text = stringResource(R.string.information_empty_category_dialog))
Text(text = stringResource(MR.strings.information_empty_category_dialog))
},
)
return
@ -277,11 +280,11 @@ fun ChangeCategoryDialog(
onDismissRequest()
onEditCategories()
}) {
Text(text = stringResource(R.string.action_edit))
Text(text = stringResource(MR.strings.action_edit))
}
Spacer(modifier = Modifier.weight(1f))
tachiyomi.presentation.core.components.material.TextButton(onClick = onDismissRequest) {
Text(text = stringResource(R.string.action_cancel))
Text(text = stringResource(MR.strings.action_cancel))
}
tachiyomi.presentation.core.components.material.TextButton(
onClick = {
@ -296,12 +299,12 @@ fun ChangeCategoryDialog(
)
},
) {
Text(text = stringResource(R.string.action_ok))
Text(text = stringResource(MR.strings.action_ok))
}
}
},
title = {
Text(text = stringResource(R.string.action_move_category))
Text(text = stringResource(MR.strings.action_move_category))
},
text = {
Column(
@ -313,7 +316,7 @@ fun ChangeCategoryDialog(
if (index != -1) {
val mutableList = selection.toMutableList()
mutableList[index] = it.next()
selection = mutableList.toList()
selection = mutableList.toList().toImmutableList()
}
}
Row(

View File

@ -9,11 +9,12 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import eu.kanade.tachiyomi.ui.category.biometric.TimeRangeItem
import kotlinx.collections.immutable.ImmutableList
import tachiyomi.presentation.core.components.material.padding
@Composable
fun BiometricTimesContent(
timeRanges: List<TimeRangeItem>,
timeRanges: ImmutableList<TimeRangeItem>,
lazyListState: LazyListState,
paddingValues: PaddingValues,
onClickDelete: (TimeRangeItem) -> Unit,

View File

@ -5,6 +5,7 @@ import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.outlined.Label
import androidx.compose.material.icons.outlined.Delete
import androidx.compose.material.icons.outlined.Label
import androidx.compose.material3.ElevatedCard
@ -33,11 +34,11 @@ fun BiometricTimesListItem(
.padding(
start = MaterialTheme.padding.medium,
top = MaterialTheme.padding.medium,
end = MaterialTheme.padding.medium
end = MaterialTheme.padding.medium,
),
verticalAlignment = Alignment.CenterVertically,
) {
Icon(imageVector = Icons.Outlined.Label, contentDescription = "")
Icon(imageVector = Icons.AutoMirrored.Outlined.Label, contentDescription = "")
Text(text = timeRange.formattedString, modifier = Modifier.padding(start = MaterialTheme.padding.medium))
}
Row {

View File

@ -8,11 +8,12 @@ import androidx.compose.foundation.lazy.itemsIndexed
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import kotlinx.collections.immutable.ImmutableList
import tachiyomi.presentation.core.components.material.padding
@Composable
fun SortTagContent(
tags: List<String>,
tags: ImmutableList<String>,
lazyListState: LazyListState,
paddingValues: PaddingValues,
onClickDelete: (String) -> Unit,

View File

@ -5,6 +5,7 @@ import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.outlined.Label
import androidx.compose.material.icons.outlined.ArrowDropDown
import androidx.compose.material.icons.outlined.ArrowDropUp
import androidx.compose.material.icons.outlined.Delete
@ -38,11 +39,11 @@ fun SortTagListItem(
.padding(
start = MaterialTheme.padding.medium,
top = MaterialTheme.padding.medium,
end = MaterialTheme.padding.medium
end = MaterialTheme.padding.medium,
),
verticalAlignment = Alignment.CenterVertically,
) {
Icon(imageVector = Icons.Outlined.Label, contentDescription = "")
Icon(imageVector = Icons.AutoMirrored.Outlined.Label, contentDescription = "")
Text(text = tag, modifier = Modifier.padding(start = MaterialTheme.padding.medium))
}
Row {

View File

@ -8,11 +8,12 @@ import androidx.compose.foundation.lazy.items
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import kotlinx.collections.immutable.ImmutableList
import tachiyomi.presentation.core.components.material.padding
@Composable
fun SourceRepoContent(
repos: List<String>,
repos: ImmutableList<String>,
lazyListState: LazyListState,
paddingValues: PaddingValues,
onClickDelete: (String) -> Unit,

View File

@ -5,6 +5,7 @@ import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.outlined.Label
import androidx.compose.material.icons.outlined.Delete
import androidx.compose.material.icons.outlined.Label
import androidx.compose.material3.ElevatedCard
@ -32,11 +33,11 @@ fun SourceRepoListItem(
.padding(
start = MaterialTheme.padding.medium,
top = MaterialTheme.padding.medium,
end = MaterialTheme.padding.medium
end = MaterialTheme.padding.medium,
),
verticalAlignment = Alignment.CenterVertically,
) {
Icon(imageVector = Icons.Outlined.Label, contentDescription = "")
Icon(imageVector = Icons.AutoMirrored.Outlined.Label, contentDescription = "")
Text(text = repo, modifier = Modifier.padding(start = MaterialTheme.padding.medium))
}
Row {

View File

@ -8,11 +8,12 @@ import androidx.compose.foundation.lazy.items
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import kotlinx.collections.immutable.ImmutableList
import tachiyomi.presentation.core.components.material.padding
@Composable
fun SourceCategoryContent(
categories: List<String>,
categories: ImmutableList<String>,
lazyListState: LazyListState,
paddingValues: PaddingValues,
onClickRename: (String) -> Unit,

View File

@ -6,6 +6,7 @@ import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.outlined.Label
import androidx.compose.material.icons.outlined.Delete
import androidx.compose.material.icons.outlined.Edit
import androidx.compose.material.icons.outlined.Label
@ -36,11 +37,11 @@ fun SourceCategoryListItem(
.padding(
start = MaterialTheme.padding.medium,
top = MaterialTheme.padding.medium,
end = MaterialTheme.padding.medium
end = MaterialTheme.padding.medium,
),
verticalAlignment = Alignment.CenterVertically,
) {
Icon(imageVector = Icons.Outlined.Label, contentDescription = "")
Icon(imageVector = Icons.AutoMirrored.Outlined.Label, contentDescription = "")
Text(text = category, modifier = Modifier.padding(start = MaterialTheme.padding.medium))
}
Row {

View File

@ -43,7 +43,6 @@ import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.platform.LocalFocusManager
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.text.input.VisualTransformation

View File

@ -11,10 +11,10 @@ import androidx.compose.ui.util.fastMaxBy
@Composable
fun AroundLayout(
modifier: Modifier = Modifier,
startLayout: @Composable () -> Unit,
endLayout: @Composable () -> Unit,
content: @Composable () -> Unit,
modifier: Modifier = Modifier,
) {
SubcomposeLayout(modifier) { constraints ->
val layoutWidth = constraints.maxWidth

View File

@ -21,6 +21,7 @@ import eu.kanade.presentation.components.SearchToolbar
import eu.kanade.presentation.history.components.HistoryItem
import eu.kanade.presentation.theme.TachiyomiTheme
import eu.kanade.tachiyomi.ui.history.HistoryScreenModel
import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.persistentListOf
import tachiyomi.core.preference.InMemoryPreferenceStore
import tachiyomi.domain.history.model.HistoryWithRelations
@ -97,7 +98,7 @@ fun HistoryScreen(
@Composable
private fun HistoryScreenContent(
history: List<HistoryUiModel>,
history: ImmutableList<HistoryUiModel>,
contentPadding: PaddingValues,
onClickCover: (HistoryWithRelations) -> Unit,
onClickResume: (HistoryWithRelations) -> Unit,

View File

@ -2,6 +2,8 @@ package eu.kanade.presentation.history
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
import eu.kanade.tachiyomi.ui.history.HistoryScreenModel
import kotlinx.collections.immutable.persistentListOf
import kotlinx.collections.immutable.toImmutableList
import tachiyomi.domain.history.model.HistoryWithRelations
import tachiyomi.domain.manga.model.MangaCover
import java.time.Instant
@ -14,20 +16,20 @@ class HistoryScreenModelStateProvider : PreviewParameterProvider<HistoryScreenMo
private val multiPage = HistoryScreenModel.State(
searchQuery = null,
list =
listOf(HistoryUiModelExamples.headerToday)
persistentListOf(HistoryUiModelExamples.headerToday)
.asSequence()
.plus(HistoryUiModelExamples.items().take(3))
.plus(HistoryUiModelExamples.header { it.minus(1, ChronoUnit.DAYS) })
.plus(HistoryUiModelExamples.items().take(1))
.plus(HistoryUiModelExamples.header { it.minus(2, ChronoUnit.DAYS) })
.plus(HistoryUiModelExamples.items().take(7))
.toList(),
.toImmutableList(),
dialog = null,
)
private val shortRecent = HistoryScreenModel.State(
searchQuery = null,
list = listOf(
list = persistentListOf(
HistoryUiModelExamples.headerToday,
HistoryUiModelExamples.items().first(),
),
@ -36,7 +38,7 @@ class HistoryScreenModelStateProvider : PreviewParameterProvider<HistoryScreenMo
private val shortFuture = HistoryScreenModel.State(
searchQuery = null,
list = listOf(
list = persistentListOf(
HistoryUiModelExamples.headerTomorrow,
HistoryUiModelExamples.items().first(),
),
@ -45,7 +47,7 @@ class HistoryScreenModelStateProvider : PreviewParameterProvider<HistoryScreenMo
private val empty = HistoryScreenModel.State(
searchQuery = null,
list = listOf(),
list = persistentListOf(),
dialog = null,
)

View File

@ -15,13 +15,14 @@ import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.util.fastForEach
import dev.icerock.moko.resources.StringResource
import eu.kanade.presentation.components.TabbedDialog
import eu.kanade.presentation.components.TabbedDialogPaddings
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.ui.library.LibrarySettingsScreenModel
import kotlinx.collections.immutable.persistentListOf
import kotlinx.collections.immutable.toImmutableList
import kotlinx.coroutines.flow.map
import tachiyomi.core.preference.TriState
import tachiyomi.domain.category.model.Category
@ -30,6 +31,8 @@ import tachiyomi.domain.library.model.LibraryGroup
import tachiyomi.domain.library.model.LibrarySort
import tachiyomi.domain.library.model.sort
import tachiyomi.domain.library.service.LibraryPreferences
import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.components.CheckboxItem
import tachiyomi.presentation.core.components.HeadingItem
import tachiyomi.presentation.core.components.IconItem
@ -37,6 +40,7 @@ import tachiyomi.presentation.core.components.SettingsChipRow
import tachiyomi.presentation.core.components.SliderItem
import tachiyomi.presentation.core.components.SortItem
import tachiyomi.presentation.core.components.TriStateItem
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.collectAsState
@Composable
@ -51,11 +55,11 @@ fun LibrarySettingsDialog(
TabbedDialog(
onDismissRequest = onDismissRequest,
tabTitles = persistentListOf(
stringResource(R.string.action_filter),
stringResource(R.string.action_sort),
stringResource(R.string.action_display),
stringResource(MR.strings.action_filter),
stringResource(MR.strings.action_sort),
stringResource(MR.strings.action_display),
// SY -->
stringResource(R.string.group),
stringResource(SYMR.strings.group),
// SY <--
),
) { page ->
@ -93,7 +97,7 @@ private fun ColumnScope.FilterPage(
val filterDownloaded by screenModel.libraryPreferences.filterDownloaded().collectAsState()
val downloadedOnly by screenModel.preferences.downloadedOnly().collectAsState()
TriStateItem(
label = stringResource(R.string.label_downloaded),
label = stringResource(MR.strings.label_downloaded),
state = if (downloadedOnly) {
TriState.ENABLED_IS
} else {
@ -104,32 +108,32 @@ private fun ColumnScope.FilterPage(
)
val filterUnread by screenModel.libraryPreferences.filterUnread().collectAsState()
TriStateItem(
label = stringResource(R.string.action_filter_unread),
label = stringResource(MR.strings.action_filter_unread),
state = filterUnread,
onClick = { screenModel.toggleFilter(LibraryPreferences::filterUnread) },
)
val filterStarted by screenModel.libraryPreferences.filterStarted().collectAsState()
TriStateItem(
label = stringResource(R.string.label_started),
label = stringResource(MR.strings.label_started),
state = filterStarted,
onClick = { screenModel.toggleFilter(LibraryPreferences::filterStarted) },
)
val filterBookmarked by screenModel.libraryPreferences.filterBookmarked().collectAsState()
TriStateItem(
label = stringResource(R.string.action_filter_bookmarked),
label = stringResource(MR.strings.action_filter_bookmarked),
state = filterBookmarked,
onClick = { screenModel.toggleFilter(LibraryPreferences::filterBookmarked) },
)
val filterCompleted by screenModel.libraryPreferences.filterCompleted().collectAsState()
TriStateItem(
label = stringResource(R.string.completed),
label = stringResource(MR.strings.completed),
state = filterCompleted,
onClick = { screenModel.toggleFilter(LibraryPreferences::filterCompleted) },
)
// SY -->
val filterLewd by screenModel.libraryPreferences.filterLewd().collectAsState()
TriStateItem(
label = stringResource(R.string.lewd),
label = stringResource(SYMR.strings.lewd),
state = filterLewd,
onClick = { screenModel.toggleFilter(LibraryPreferences::filterLewd) },
)
@ -144,13 +148,13 @@ private fun ColumnScope.FilterPage(
val service = trackers[0]
val filterTracker by screenModel.libraryPreferences.filterTracking(service.id.toInt()).collectAsState()
TriStateItem(
label = stringResource(R.string.action_filter_tracked),
label = stringResource(MR.strings.action_filter_tracked),
state = filterTracker,
onClick = { screenModel.toggleTracker(service.id.toInt()) },
)
}
else -> {
HeadingItem(R.string.action_filter_tracked)
HeadingItem(MR.strings.action_filter_tracked)
trackers.map { service ->
val filterTracker by screenModel.libraryPreferences.filterTracking(service.id.toInt()).collectAsState()
TriStateItem(
@ -190,21 +194,21 @@ private fun ColumnScope.SortPage(
if (screenModel.trackers.isEmpty()) {
emptyList()
} else {
listOf(R.string.action_sort_tracker_score to LibrarySort.Type.TrackerMean)
listOf(MR.strings.action_sort_tracker_score to LibrarySort.Type.TrackerMean)
}
listOfNotNull(
R.string.action_sort_alpha to LibrarySort.Type.Alphabetical,
R.string.action_sort_total to LibrarySort.Type.TotalChapters,
R.string.action_sort_last_read to LibrarySort.Type.LastRead,
R.string.action_sort_last_manga_update to LibrarySort.Type.LastUpdate,
R.string.action_sort_unread_count to LibrarySort.Type.UnreadCount,
R.string.action_sort_latest_chapter to LibrarySort.Type.LatestChapter,
R.string.action_sort_chapter_fetch_date to LibrarySort.Type.ChapterFetchDate,
R.string.action_sort_date_added to LibrarySort.Type.DateAdded,
MR.strings.action_sort_alpha to LibrarySort.Type.Alphabetical,
MR.strings.action_sort_total to LibrarySort.Type.TotalChapters,
MR.strings.action_sort_last_read to LibrarySort.Type.LastRead,
MR.strings.action_sort_last_manga_update to LibrarySort.Type.LastUpdate,
MR.strings.action_sort_unread_count to LibrarySort.Type.UnreadCount,
MR.strings.action_sort_latest_chapter to LibrarySort.Type.LatestChapter,
MR.strings.action_sort_chapter_fetch_date to LibrarySort.Type.ChapterFetchDate,
MR.strings.action_sort_date_added to LibrarySort.Type.DateAdded,
// SY -->
if (hasSortTags) {
R.string.tag_sorting to LibrarySort.Type.TagList
SYMR.strings.tag_sorting to LibrarySort.Type.TagList
} else {
null
},
@ -230,10 +234,10 @@ private fun ColumnScope.SortPage(
}
private val displayModes = listOf(
R.string.action_display_grid to LibraryDisplayMode.CompactGrid,
R.string.action_display_comfortable_grid to LibraryDisplayMode.ComfortableGrid,
R.string.action_display_cover_only_grid to LibraryDisplayMode.CoverOnlyGrid,
R.string.action_display_list to LibraryDisplayMode.List,
MR.strings.action_display_grid to LibraryDisplayMode.CompactGrid,
MR.strings.action_display_comfortable_grid to LibraryDisplayMode.ComfortableGrid,
MR.strings.action_display_cover_only_grid to LibraryDisplayMode.CoverOnlyGrid,
MR.strings.action_display_list to LibraryDisplayMode.List,
)
@Composable
@ -241,7 +245,7 @@ private fun ColumnScope.DisplayPage(
screenModel: LibrarySettingsScreenModel,
) {
val displayMode by screenModel.libraryPreferences.displayMode().collectAsState()
SettingsChipRow(R.string.action_display_mode) {
SettingsChipRow(MR.strings.action_display_mode) {
displayModes.map { (titleRes, mode) ->
FilterChip(
selected = displayMode == mode,
@ -263,43 +267,43 @@ private fun ColumnScope.DisplayPage(
val columns by columnPreference.collectAsState()
SliderItem(
label = stringResource(R.string.pref_library_columns),
label = stringResource(MR.strings.pref_library_columns),
max = 10,
value = columns,
valueText = if (columns > 0) {
stringResource(R.string.pref_library_columns_per_row, columns)
stringResource(MR.strings.pref_library_columns_per_row, columns)
} else {
stringResource(R.string.label_default)
stringResource(MR.strings.label_default)
},
onChange = columnPreference::set,
)
}
HeadingItem(R.string.overlay_header)
HeadingItem(MR.strings.overlay_header)
CheckboxItem(
label = stringResource(R.string.action_display_download_badge),
label = stringResource(MR.strings.action_display_download_badge),
pref = screenModel.libraryPreferences.downloadBadge(),
)
CheckboxItem(
label = stringResource(R.string.action_display_local_badge),
label = stringResource(MR.strings.action_display_local_badge),
pref = screenModel.libraryPreferences.localBadge(),
)
CheckboxItem(
label = stringResource(R.string.action_display_language_badge),
label = stringResource(MR.strings.action_display_language_badge),
pref = screenModel.libraryPreferences.languageBadge(),
)
CheckboxItem(
label = stringResource(R.string.action_display_show_continue_reading_button),
label = stringResource(MR.strings.action_display_show_continue_reading_button),
pref = screenModel.libraryPreferences.showContinueReadingButton(),
)
HeadingItem(R.string.tabs_header)
HeadingItem(MR.strings.tabs_header)
CheckboxItem(
label = stringResource(R.string.action_display_show_tabs),
label = stringResource(MR.strings.action_display_show_tabs),
pref = screenModel.libraryPreferences.categoryTabs(),
)
CheckboxItem(
label = stringResource(R.string.action_display_show_number_of_items),
label = stringResource(MR.strings.action_display_show_number_of_items),
pref = screenModel.libraryPreferences.categoryNumberOfItems(),
)
}
@ -307,7 +311,7 @@ private fun ColumnScope.DisplayPage(
// SY -->
data class GroupMode(
val int: Int,
val nameRes: Int,
val nameRes: StringResource,
val drawableRes: Int,
)
@ -343,7 +347,7 @@ private fun ColumnScope.GroupPage(
LibraryGroup.groupTypeStringRes(it, hasCategories),
groupTypeDrawableRes(it),
)
}
}.toImmutableList()
}
groups.fastForEach {

View File

@ -21,6 +21,7 @@ import eu.kanade.presentation.components.AppBarActions
import eu.kanade.presentation.components.SearchToolbar
import kotlinx.collections.immutable.persistentListOf
import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.components.Pill
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.theme.active
@ -130,9 +131,9 @@ private fun LibraryRegularToolbar(
if (onClickSyncExh != null) {
add(
AppBar.OverflowAction(
title = stringResource(R.string.sync_favorites),
title = stringResource(SYMR.strings.sync_favorites),
onClick = onClickSyncExh,
)
),
)
}
// SY <--

View File

@ -1,57 +0,0 @@
package eu.kanade.presentation.library.components
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.Surface
import androidx.compose.material3.Icon
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import eu.kanade.tachiyomi.R
@Composable
fun StartReadingButton(
modifier: Modifier = Modifier,
onOpenReader: () -> Unit,
) {
Box(
modifier then Modifier
.size(50.dp)
.clip(CircleShape),
contentAlignment = Alignment.Center,
) {
Box(
Modifier
.size(32.dp)
.clip(CircleShape)
.background(Color(0xAD212121))
.clickable(onClick = onOpenReader),
)
Icon(
painter = painterResource(R.drawable.ic_start_reading_24dp),
contentDescription = stringResource(R.string.action_start_reading),
tint = Color.White,
modifier = Modifier
.size(24.dp)
.padding(3.dp),
)
}
}
@Preview
@Composable
fun StartReadingPreview() {
Surface {
StartReadingButton {}
}
}

View File

@ -4,9 +4,10 @@ import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.window.DialogProperties
import eu.kanade.tachiyomi.R
import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun SyncFavoritesConfirmDialog(
@ -17,19 +18,19 @@ fun SyncFavoritesConfirmDialog(
onDismissRequest = onDismissRequest,
confirmButton = {
TextButton(onClick = onAccept) {
Text(text = stringResource(R.string.action_ok))
Text(text = stringResource(MR.strings.action_ok))
}
},
dismissButton = {
TextButton(onClick = onDismissRequest) {
Text(text = stringResource(R.string.action_cancel))
Text(text = stringResource(MR.strings.action_cancel))
}
},
title = {
Text(stringResource(R.string.favorites_sync))
Text(stringResource(SYMR.strings.favorites_sync))
},
text = {
Text(text = stringResource(R.string.favorites_sync_conformation_message))
Text(text = stringResource(SYMR.strings.favorites_sync_conformation_message))
},
properties = DialogProperties(dismissOnClickOutside = false),
)

View File

@ -12,10 +12,12 @@ import androidx.compose.runtime.produceState
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.window.DialogProperties
import eu.kanade.tachiyomi.R
import exh.favorites.FavoritesSyncStatus
import kotlinx.coroutines.delay
import tachiyomi.core.i18n.stringResource
import tachiyomi.domain.manga.model.Manga
import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR
import kotlin.time.Duration.Companion.seconds
data class SyncFavoritesProgressProperties(
@ -38,42 +40,42 @@ fun SyncFavoritesProgressDialog(
val properties by produceState<SyncFavoritesProgressProperties?>(initialValue = null, status) {
when (status) {
is FavoritesSyncStatus.BadLibraryState.MangaInMultipleCategories -> value = SyncFavoritesProgressProperties(
title = context.getString(R.string.favorites_sync_error),
text = context.getString(R.string.favorites_sync_bad_library_state, status.message),
title = context.stringResource(SYMR.strings.favorites_sync_error),
text = context.stringResource(SYMR.strings.favorites_sync_bad_library_state, status.message),
canDismiss = false,
positiveButtonText = context.getString(R.string.show_gallery),
positiveButtonText = context.stringResource(SYMR.strings.show_gallery),
positiveButton = {
openManga(status.manga)
setStatusIdle()
},
negativeButtonText = context.getString(R.string.action_ok),
negativeButtonText = context.stringResource(MR.strings.action_ok),
negativeButton = setStatusIdle,
)
is FavoritesSyncStatus.CompleteWithErrors -> value = SyncFavoritesProgressProperties(
title = context.getString(R.string.favorites_sync_done_errors),
text = context.getString(R.string.favorites_sync_done_errors_message, status.message),
title = context.stringResource(SYMR.strings.favorites_sync_done_errors),
text = context.stringResource(SYMR.strings.favorites_sync_done_errors_message, status.message),
canDismiss = false,
positiveButtonText = context.getString(R.string.action_ok),
positiveButtonText = context.stringResource(MR.strings.action_ok),
positiveButton = setStatusIdle,
)
is FavoritesSyncStatus.Error -> value = SyncFavoritesProgressProperties(
title = context.getString(R.string.favorites_sync_error),
text = context.getString(R.string.favorites_sync_error_string, status.message),
title = context.stringResource(SYMR.strings.favorites_sync_error),
text = context.stringResource(SYMR.strings.favorites_sync_error_string, status.message),
canDismiss = false,
positiveButtonText = context.getString(R.string.action_ok),
positiveButtonText = context.stringResource(MR.strings.action_ok),
positiveButton = setStatusIdle,
)
is FavoritesSyncStatus.Idle -> value = null
is FavoritesSyncStatus.Initializing, is FavoritesSyncStatus.Processing -> {
value = SyncFavoritesProgressProperties(
title = context.getString(R.string.favorites_syncing),
title = context.stringResource(SYMR.strings.favorites_syncing),
text = status.message,
canDismiss = false,
)
if (status is FavoritesSyncStatus.Processing && status.title != null) {
delay(5.seconds)
value = SyncFavoritesProgressProperties(
title = context.getString(R.string.favorites_syncing),
title = context.stringResource(SYMR.strings.favorites_syncing),
text = status.delayedMessage ?: status.message,
canDismiss = false,
)

View File

@ -10,11 +10,13 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.window.DialogProperties
import androidx.core.text.HtmlCompat
import eu.kanade.tachiyomi.R
import exh.util.toAnnotatedString
import tachiyomi.core.i18n.stringResource
import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun SyncFavoritesWarningDialog(
@ -24,19 +26,19 @@ fun SyncFavoritesWarningDialog(
val context = LocalContext.current
val text = remember {
HtmlCompat.fromHtml(
context.getString(R.string.favorites_sync_notes_message),
HtmlCompat.FROM_HTML_MODE_LEGACY
context.stringResource(SYMR.strings.favorites_sync_notes_message),
HtmlCompat.FROM_HTML_MODE_LEGACY,
).toAnnotatedString()
}
AlertDialog(
onDismissRequest = onDismissRequest,
confirmButton = {
TextButton(onClick = onAccept) {
Text(text = stringResource(R.string.action_ok))
Text(text = stringResource(MR.strings.action_ok))
}
},
title = {
Text(stringResource(R.string.favorites_sync_notes))
Text(stringResource(SYMR.strings.favorites_sync_notes))
},
text = {
Column(

View File

@ -52,7 +52,6 @@ import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.hapticfeedback.HapticFeedbackType
import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.platform.LocalHapticFeedback
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.res.vectorResource
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
@ -65,6 +64,9 @@ import kotlinx.coroutines.Job
import kotlinx.coroutines.delay
import kotlinx.coroutines.isActive
import kotlinx.coroutines.launch
import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.i18n.stringResource
import kotlin.time.Duration.Companion.seconds
@Composable
@ -113,7 +115,7 @@ fun MangaBottomActionMenu(
) {
if (onBookmarkClicked != null) {
Button(
title = stringResource(R.string.action_bookmark),
title = stringResource(MR.strings.action_bookmark),
icon = Icons.Outlined.BookmarkAdd,
toConfirm = confirm[0],
onLongClick = { onLongClickItem(0) },
@ -122,7 +124,7 @@ fun MangaBottomActionMenu(
}
if (onRemoveBookmarkClicked != null) {
Button(
title = stringResource(R.string.action_remove_bookmark),
title = stringResource(MR.strings.action_remove_bookmark),
icon = Icons.Outlined.BookmarkRemove,
toConfirm = confirm[1],
onLongClick = { onLongClickItem(1) },
@ -131,7 +133,7 @@ fun MangaBottomActionMenu(
}
if (onMarkAsReadClicked != null) {
Button(
title = stringResource(R.string.action_mark_as_read),
title = stringResource(MR.strings.action_mark_as_read),
icon = Icons.Outlined.DoneAll,
toConfirm = confirm[2],
onLongClick = { onLongClickItem(2) },
@ -140,7 +142,7 @@ fun MangaBottomActionMenu(
}
if (onMarkAsUnreadClicked != null) {
Button(
title = stringResource(R.string.action_mark_as_unread),
title = stringResource(MR.strings.action_mark_as_unread),
icon = Icons.Outlined.RemoveDone,
toConfirm = confirm[3],
onLongClick = { onLongClickItem(3) },
@ -149,7 +151,7 @@ fun MangaBottomActionMenu(
}
if (onMarkPreviousAsReadClicked != null) {
Button(
title = stringResource(R.string.action_mark_previous_as_read),
title = stringResource(MR.strings.action_mark_previous_as_read),
icon = ImageVector.vectorResource(R.drawable.ic_done_prev_24dp),
toConfirm = confirm[4],
onLongClick = { onLongClickItem(4) },
@ -158,7 +160,7 @@ fun MangaBottomActionMenu(
}
if (onDownloadClicked != null) {
Button(
title = stringResource(R.string.action_download),
title = stringResource(MR.strings.action_download),
icon = Icons.Outlined.Download,
toConfirm = confirm[5],
onLongClick = { onLongClickItem(5) },
@ -167,7 +169,7 @@ fun MangaBottomActionMenu(
}
if (onDeleteClicked != null) {
Button(
title = stringResource(R.string.action_delete),
title = stringResource(MR.strings.action_delete),
icon = Icons.Outlined.Delete,
toConfirm = confirm[6],
onLongClick = { onLongClickItem(6) },
@ -276,7 +278,7 @@ fun LibraryBottomActionMenu(
.padding(horizontal = 8.dp, vertical = 12.dp),
) {
Button(
title = stringResource(R.string.action_move_category),
title = stringResource(MR.strings.action_move_category),
icon = Icons.AutoMirrored.Outlined.Label,
toConfirm = confirm[0],
onLongClick = { onLongClickItem(0) },
@ -285,7 +287,7 @@ fun LibraryBottomActionMenu(
if (onDownloadClicked != null) {
var downloadExpanded by remember { mutableStateOf(false) }
Button(
title = stringResource(R.string.action_download),
title = stringResource(MR.strings.action_download),
icon = Icons.Outlined.Download,
toConfirm = confirm[3],
onLongClick = { onLongClickItem(3) },
@ -300,7 +302,7 @@ fun LibraryBottomActionMenu(
}
}
Button(
title = stringResource(R.string.action_delete),
title = stringResource(MR.strings.action_delete),
icon = Icons.Outlined.Delete,
toConfirm = confirm[4],
onLongClick = { onLongClickItem(4) },
@ -308,7 +310,7 @@ fun LibraryBottomActionMenu(
)
// SY -->
Button(
title = stringResource(R.string.action_mark_as_read),
title = stringResource(MR.strings.action_mark_as_read),
icon = Icons.Outlined.DoneAll,
toConfirm = confirm[1],
onLongClick = { onLongClickItem(1) },
@ -317,7 +319,7 @@ fun LibraryBottomActionMenu(
if (showOverflow) {
if (!moveMarkPrev) {
Button(
title = stringResource(R.string.action_mark_as_unread),
title = stringResource(MR.strings.action_mark_as_unread),
icon = Icons.Outlined.RemoveDone,
toConfirm = confirm[2],
onLongClick = { onLongClickItem(2) },
@ -325,7 +327,7 @@ fun LibraryBottomActionMenu(
)
}
Button(
title = stringResource(R.string.label_more),
title = stringResource(MR.strings.label_more),
icon = Icons.Outlined.MoreVert,
toConfirm = confirm[5],
onLongClick = { onLongClickItem(5) },
@ -337,32 +339,32 @@ fun LibraryBottomActionMenu(
) {
if (moveMarkPrev) {
DropdownMenuItem(
text = { Text(stringResource(R.string.action_mark_as_unread)) },
text = { Text(stringResource(MR.strings.action_mark_as_unread)) },
onClick = onMarkAsUnreadClicked,
)
}
if (onClickCleanTitles != null) {
DropdownMenuItem(
text = { Text(stringResource(R.string.action_clean_titles)) },
text = { Text(stringResource(SYMR.strings.action_clean_titles)) },
onClick = onClickCleanTitles,
)
}
if (onClickMigrate != null) {
DropdownMenuItem(
text = { Text(stringResource(R.string.migrate)) },
text = { Text(stringResource(MR.strings.migrate)) },
onClick = onClickMigrate,
)
}
if (onClickAddToMangaDex != null) {
DropdownMenuItem(
text = { Text(stringResource(R.string.mangadex_add_to_follows)) },
text = { Text(stringResource(SYMR.strings.mangadex_add_to_follows)) },
onClick = onClickAddToMangaDex,
)
}
}
} else {
Button(
title = stringResource(R.string.action_mark_as_unread),
title = stringResource(MR.strings.action_mark_as_unread),
icon = Icons.Outlined.RemoveDone,
toConfirm = confirm[2],
onLongClick = { onLongClickItem(2) },
@ -370,7 +372,7 @@ fun LibraryBottomActionMenu(
)
if (onClickMigrate != null) {
Button(
title = stringResource(R.string.migrate),
title = stringResource(MR.strings.migrate),
icon = Icons.Outlined.SwapCalls,
toConfirm = confirm[5],
onLongClick = { onLongClickItem(5) },

View File

@ -189,7 +189,9 @@ fun MangaChapterListItem(
readProgress != null ||
scanlator != null/* SY --> */ ||
sourceName != null/* SY <-- */
) DotSeparatorText()
) {
DotSeparatorText()
}
}
if (readProgress != null) {
Text(

View File

@ -2,28 +2,23 @@ package eu.kanade.presentation.manga.components
import androidx.compose.foundation.layout.BoxWithConstraints
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.runtime.toMutableStateList
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.DpSize
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.DialogProperties
import eu.kanade.tachiyomi.R
import kotlinx.collections.immutable.toImmutableList
import tachiyomi.domain.manga.interactor.FetchInterval
import tachiyomi.presentation.core.components.LabeledCheckbox
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.WheelTextPicker
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun DeleteChaptersDialog(
@ -34,7 +29,7 @@ fun DeleteChaptersDialog(
onDismissRequest = onDismissRequest,
dismissButton = {
TextButton(onClick = onDismissRequest) {
Text(text = stringResource(R.string.action_cancel))
Text(text = stringResource(MR.strings.action_cancel))
}
},
confirmButton = {
@ -44,14 +39,14 @@ fun DeleteChaptersDialog(
onConfirm()
},
) {
Text(text = stringResource(R.string.action_ok))
Text(text = stringResource(MR.strings.action_ok))
}
},
title = {
Text(text = stringResource(R.string.are_you_sure))
Text(text = stringResource(MR.strings.are_you_sure))
},
text = {
Text(text = stringResource(R.string.confirm_delete_chapters))
Text(text = stringResource(MR.strings.confirm_delete_chapters))
},
)
}
@ -66,7 +61,7 @@ fun SetIntervalDialog(
AlertDialog(
onDismissRequest = onDismissRequest,
title = { Text(text = stringResource(R.string.manga_modify_calculated_interval_title)) },
title = { Text(text = stringResource(MR.strings.manga_modify_calculated_interval_title)) },
text = {
BoxWithConstraints(
modifier = Modifier.fillMaxWidth(),
@ -76,7 +71,7 @@ fun SetIntervalDialog(
val items = (0..FetchInterval.MAX_INTERVAL)
.map {
if (it == 0) {
stringResource(R.string.label_default)
stringResource(MR.strings.label_default)
} else {
it.toString()
}
@ -92,7 +87,7 @@ fun SetIntervalDialog(
},
dismissButton = {
TextButton(onClick = onDismissRequest) {
Text(text = stringResource(R.string.action_cancel))
Text(text = stringResource(MR.strings.action_cancel))
}
},
confirmButton = {
@ -100,68 +95,8 @@ fun SetIntervalDialog(
onValueChanged(selectedInterval)
onDismissRequest()
}) {
Text(text = stringResource(R.string.action_ok))
Text(text = stringResource(MR.strings.action_ok))
}
},
)
}
// SY -->
@Composable
fun SelectScanlatorsDialog(
onDismissRequest: () -> Unit,
availableScanlators: List<String>,
initialSelectedScanlators: List<String>,
onSelectScanlators: (List<String>) -> Unit,
) {
val selected = remember {
initialSelectedScanlators.toMutableStateList()
}
AlertDialog(
onDismissRequest = onDismissRequest,
title = { Text(text = stringResource(R.string.select_scanlators)) },
text = {
LazyColumn {
availableScanlators.forEach { current ->
item {
val isSelected = selected.contains(current)
LabeledCheckbox(
label = current,
checked = isSelected,
onCheckedChange = {
when (it) {
true -> selected.add(current)
false -> selected.remove(current)
}
},
)
}
}
}
},
properties = DialogProperties(
usePlatformDefaultWidth = true,
),
confirmButton = {
TextButton(
onClick = {
onSelectScanlators(selected.toList())
onDismissRequest()
},
) {
Text(text = stringResource(R.string.action_ok))
}
},
dismissButton = {
TextButton(
onClick = {
onSelectScanlators(availableScanlators)
onDismissRequest()
},
) {
Text(text = stringResource(R.string.action_reset))
}
},
)
}
// SY <--

View File

@ -6,10 +6,10 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import eu.kanade.tachiyomi.R
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.components.material.Button
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun MangaInfoButtons(
@ -27,7 +27,7 @@ fun MangaInfoButtons(
.fillMaxWidth()
.padding(horizontal = 16.dp, vertical = 4.dp),
) {
Text(stringResource(R.string.merge_with_another_source))
Text(stringResource(SYMR.strings.merge_with_another_source))
}
}
if (showRecommendsButton) {
@ -37,7 +37,7 @@ fun MangaInfoButtons(
.fillMaxWidth()
.padding(horizontal = 16.dp, vertical = 4.dp),
) {
Text(stringResource(R.string.az_recommends))
Text(stringResource(SYMR.strings.az_recommends))
}
}
}

View File

@ -23,6 +23,7 @@ import androidx.compose.foundation.lazy.LazyRow
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.text.selection.SelectionContainer
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.outlined.CallMerge
import androidx.compose.material.icons.filled.Brush
import androidx.compose.material.icons.filled.Favorite
import androidx.compose.material.icons.filled.HourglassEmpty
@ -78,6 +79,7 @@ import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.util.system.copyToClipboard
import tachiyomi.domain.manga.model.Manga
import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.components.material.TextButton
import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.i18n.pluralStringResource
@ -226,8 +228,8 @@ fun MangaActionRow(
// SY -->
if (onMergeClicked != null) {
MangaActionButton(
title = stringResource(R.string.merge),
icon = Icons.Outlined.CallMerge,
title = stringResource(SYMR.strings.merge),
icon = Icons.AutoMirrored.Outlined.CallMerge,
color = defaultActionButtonColor,
onClick = onMergeClicked,
)
@ -292,7 +294,7 @@ fun ExpandableMangaDescription(
)
// SY -->
DropdownMenuItem(
text = { Text(text = stringResource(R.string.action_global_search)) },
text = { Text(text = stringResource(MR.strings.action_global_search)) },
onClick = {
doSearch(tagSelected, true)
showMenu = false

View File

@ -30,6 +30,7 @@ import eu.kanade.presentation.components.UpIcon
import eu.kanade.presentation.manga.DownloadAction
import kotlinx.collections.immutable.persistentListOf
import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.theme.active
@ -158,7 +159,7 @@ fun MangaToolbar(
if (onClickMerge != null) {
add(
AppBar.OverflowAction(
title = stringResource(R.string.merge),
title = stringResource(SYMR.strings.merge),
onClick = onClickMerge,
),
)
@ -166,7 +167,7 @@ fun MangaToolbar(
if (onClickEditInfo != null) {
add(
AppBar.OverflowAction(
title = stringResource(R.string.action_edit_info),
title = stringResource(SYMR.strings.action_edit_info),
onClick = onClickEditInfo,
),
)
@ -174,7 +175,7 @@ fun MangaToolbar(
if (onClickRecommend != null) {
add(
AppBar.OverflowAction(
title = stringResource(R.string.az_recommends),
title = stringResource(SYMR.strings.az_recommends),
onClick = onClickRecommend,
),
)
@ -182,7 +183,7 @@ fun MangaToolbar(
if (onClickMergedSettings != null) {
add(
AppBar.OverflowAction(
title = stringResource(R.string.merge_settings),
title = stringResource(SYMR.strings.merge_settings),
onClick = onClickMergedSettings,
),
)

View File

@ -26,16 +26,16 @@ import androidx.compose.ui.draw.clip
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.layout.onGloballyPositioned
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import coil.compose.SubcomposeAsyncImage
import coil.compose.SubcomposeAsyncImageContent
import eu.kanade.domain.manga.model.PagePreview
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.ui.manga.PagePreviewState
import exh.util.floor
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun PagePreviews(
@ -91,7 +91,7 @@ fun PagePreviews(
}
}
TextButton(onClick = onMorePreviewsClicked) {
Text(stringResource(R.string.more_previews))
Text(stringResource(SYMR.strings.more_previews))
}
}
}
@ -122,7 +122,9 @@ fun PagePreview(
if (progress < 0) {
CircularProgressIndicator()
} else {
CircularProgressIndicator(progress / 0.01F)
CircularProgressIndicator(
progress = { progress / 0.01F },
)
}
}
},

View File

@ -27,6 +27,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.DialogProperties
import kotlinx.collections.immutable.ImmutableSet
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.TextButton
import tachiyomi.presentation.core.components.material.padding
@ -36,8 +37,8 @@ import tachiyomi.presentation.core.util.isScrolledToStart
@Composable
fun ScanlatorFilterDialog(
availableScanlators: Set<String>,
excludedScanlators: Set<String>,
availableScanlators: ImmutableSet<String>,
excludedScanlators: ImmutableSet<String>,
onDismissRequest: () -> Unit,
onConfirm: (Set<String>) -> Unit,
) {

View File

@ -11,6 +11,7 @@ import androidx.compose.foundation.layout.windowInsetsPadding
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.outlined.HelpOutline
import androidx.compose.material.icons.automirrored.outlined.Label
import androidx.compose.material.icons.automirrored.outlined.PlaylistAdd
import androidx.compose.material.icons.outlined.CloudOff
import androidx.compose.material.icons.outlined.GetApp
import androidx.compose.material.icons.outlined.HelpOutline
@ -27,8 +28,6 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.platform.LocalUriHandler
import androidx.compose.ui.res.pluralStringResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.res.vectorResource
import eu.kanade.presentation.components.WarningBanner
import eu.kanade.presentation.more.settings.widget.SwitchPreferenceWidget
@ -36,8 +35,12 @@ import eu.kanade.presentation.more.settings.widget.TextPreferenceWidget
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.ui.more.DownloadQueueState
import tachiyomi.core.Constants
import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.components.ScrollbarLazyColumn
import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.i18n.pluralStringResource
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun MoreScreen(
@ -72,7 +75,7 @@ fun MoreScreen(
) {
if (isFDroid) {
WarningBanner(
textRes = R.string.fdroid_warning,
textRes = MR.strings.fdroid_warning,
modifier = Modifier.clickable {
uriHandler.openUri(
"https://tachiyomi.org/docs/faq/general#how-do-i-update-from-the-f-droid-builds",
@ -91,8 +94,8 @@ fun MoreScreen(
}
item {
SwitchPreferenceWidget(
title = stringResource(R.string.label_downloaded_only),
subtitle = stringResource(R.string.downloaded_only_summary),
title = stringResource(MR.strings.label_downloaded_only),
subtitle = stringResource(MR.strings.downloaded_only_summary),
icon = Icons.Outlined.CloudOff,
checked = downloadedOnly,
onCheckedChanged = onDownloadedOnlyChange,
@ -100,8 +103,8 @@ fun MoreScreen(
}
item {
SwitchPreferenceWidget(
title = stringResource(R.string.pref_incognito_mode),
subtitle = stringResource(R.string.pref_incognito_mode_summary),
title = stringResource(MR.strings.pref_incognito_mode),
subtitle = stringResource(MR.strings.pref_incognito_mode_summary),
icon = ImageVector.vectorResource(R.drawable.ic_glasses_24dp),
checked = incognitoMode,
onCheckedChanged = onIncognitoModeChange,
@ -114,7 +117,7 @@ fun MoreScreen(
if (!showNavUpdates) {
item {
TextPreferenceWidget(
title = stringResource(R.string.label_recent_updates),
title = stringResource(MR.strings.label_recent_updates),
icon = Icons.Outlined.NewReleases,
onPreferenceClick = onClickUpdates,
)
@ -123,7 +126,7 @@ fun MoreScreen(
if (!showNavHistory) {
item {
TextPreferenceWidget(
title = stringResource(R.string.label_recent_manga),
title = stringResource(MR.strings.label_recent_manga),
icon = Icons.Outlined.History,
onPreferenceClick = onClickHistory,
)
@ -134,17 +137,17 @@ fun MoreScreen(
item {
val downloadQueueState = downloadQueueStateProvider()
TextPreferenceWidget(
title = stringResource(R.string.label_download_queue),
title = stringResource(MR.strings.label_download_queue),
subtitle = when (downloadQueueState) {
DownloadQueueState.Stopped -> null
is DownloadQueueState.Paused -> {
val pending = downloadQueueState.pending
if (pending == 0) {
stringResource(R.string.paused)
stringResource(MR.strings.paused)
} else {
"${stringResource(R.string.paused)}${
"${stringResource(MR.strings.paused)}${
pluralStringResource(
id = R.plurals.download_queue_summary,
MR.plurals.download_queue_summary,
count = pending,
pending,
)
@ -153,7 +156,7 @@ fun MoreScreen(
}
is DownloadQueueState.Downloading -> {
val pending = downloadQueueState.pending
pluralStringResource(id = R.plurals.download_queue_summary, count = pending, pending)
pluralStringResource(MR.plurals.download_queue_summary, count = pending, pending)
}
},
icon = Icons.Outlined.GetApp,
@ -162,21 +165,21 @@ fun MoreScreen(
}
item {
TextPreferenceWidget(
title = stringResource(R.string.categories),
title = stringResource(MR.strings.categories),
icon = Icons.AutoMirrored.Outlined.Label,
onPreferenceClick = onClickCategories,
)
}
item {
TextPreferenceWidget(
title = stringResource(R.string.label_stats),
title = stringResource(MR.strings.label_stats),
icon = Icons.Outlined.QueryStats,
onPreferenceClick = onClickStats,
)
}
item {
TextPreferenceWidget(
title = stringResource(R.string.label_data_storage),
title = stringResource(MR.strings.label_data_storage),
icon = Icons.Outlined.Storage,
onPreferenceClick = onClickDataAndStorage,
)
@ -184,8 +187,8 @@ fun MoreScreen(
// SY -->
item {
TextPreferenceWidget(
title = stringResource(R.string.eh_batch_add),
icon = Icons.Outlined.PlaylistAdd,
title = stringResource(SYMR.strings.eh_batch_add),
icon = Icons.AutoMirrored.Outlined.PlaylistAdd,
onPreferenceClick = onClickBatchAdd,
)
}
@ -195,21 +198,21 @@ fun MoreScreen(
item {
TextPreferenceWidget(
title = stringResource(R.string.label_settings),
title = stringResource(MR.strings.label_settings),
icon = Icons.Outlined.Settings,
onPreferenceClick = onClickSettings,
)
}
item {
TextPreferenceWidget(
title = stringResource(R.string.pref_category_about),
title = stringResource(MR.strings.pref_category_about),
icon = Icons.Outlined.Info,
onPreferenceClick = onClickAbout,
)
}
item {
TextPreferenceWidget(
title = stringResource(R.string.label_help),
title = stringResource(MR.strings.label_help),
icon = Icons.AutoMirrored.Outlined.HelpOutline,
onPreferenceClick = { uriHandler.openUri(Constants.URL_HELP) },
)

View File

@ -10,9 +10,7 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.window.DialogProperties
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.util.system.toast
import exh.log.xLogE
import exh.uconfig.EHConfigurator
@ -22,6 +20,9 @@ import kotlinx.coroutines.delay
import kotlinx.coroutines.withContext
import tachiyomi.core.util.lang.launchUI
import tachiyomi.domain.UnsortedPreferences
import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.i18n.stringResource
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
import kotlin.time.Duration.Companion.seconds
@ -61,14 +62,14 @@ fun ConfigureExhDialog(run: Boolean, onRunning: () -> Unit) {
warnDialogOpen = false
},
) {
Text(text = stringResource(R.string.action_ok))
Text(text = stringResource(MR.strings.action_ok))
}
},
title = {
Text(text = stringResource(R.string.settings_profile_note))
Text(text = stringResource(SYMR.strings.settings_profile_note))
},
text = {
Text(text = stringResource(R.string.settings_profile_note_message))
Text(text = stringResource(SYMR.strings.settings_profile_note_message))
},
)
}
@ -80,7 +81,7 @@ fun ConfigureExhDialog(run: Boolean, onRunning: () -> Unit) {
delay(0.2.seconds)
EHConfigurator(context).configureAll()
launchUI {
context.toast(R.string.eh_settings_successfully_uploaded)
context.toast(SYMR.strings.eh_settings_successfully_uploaded)
}
} catch (e: Exception) {
configureFailedDialogOpen = e
@ -98,10 +99,10 @@ fun ConfigureExhDialog(run: Boolean, onRunning: () -> Unit) {
),
confirmButton = {},
title = {
Text(text = stringResource(R.string.eh_settings_uploading_to_server))
Text(text = stringResource(SYMR.strings.eh_settings_uploading_to_server))
},
text = {
Text(text = stringResource(R.string.eh_settings_uploading_to_server_message))
Text(text = stringResource(SYMR.strings.eh_settings_uploading_to_server_message))
},
)
}
@ -110,18 +111,18 @@ fun ConfigureExhDialog(run: Boolean, onRunning: () -> Unit) {
onDismissRequest = { configureFailedDialogOpen = null },
confirmButton = {
TextButton(onClick = { configureFailedDialogOpen = null }) {
Text(text = stringResource(R.string.action_ok))
Text(text = stringResource(MR.strings.action_ok))
}
},
title = {
Text(text = stringResource(R.string.eh_settings_configuration_failed))
Text(text = stringResource(SYMR.strings.eh_settings_configuration_failed))
},
text = {
Text(
text = stringResource(
R.string.eh_settings_configuration_failed_message,
configureFailedDialogOpen?.message.orEmpty()
)
SYMR.strings.eh_settings_configuration_failed_message,
configureFailedDialogOpen?.message.orEmpty(),
),
)
},
)

View File

@ -8,7 +8,6 @@ import android.provider.Settings
import android.webkit.WebStorage
import android.webkit.WebView
import android.widget.Toast
import androidx.annotation.StringRes
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Text
@ -24,7 +23,6 @@ import androidx.compose.runtime.setValue
import androidx.compose.runtime.toMutableStateList
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalUriHandler
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.window.DialogProperties
import androidx.core.net.toUri
import androidx.core.text.HtmlCompat
@ -73,6 +71,8 @@ import kotlinx.coroutines.Job
import kotlinx.coroutines.launch
import logcat.LogPriority
import okhttp3.Headers
import tachiyomi.core.i18n.pluralStringResource
import tachiyomi.core.i18n.stringResource
import tachiyomi.core.util.lang.launchNonCancellable
import tachiyomi.core.util.lang.withUIContext
import tachiyomi.core.util.system.logcat
@ -81,7 +81,10 @@ import tachiyomi.domain.chapter.interactor.GetChaptersByMangaId
import tachiyomi.domain.manga.interactor.GetAllManga
import tachiyomi.domain.manga.interactor.ResetViewerFlags
import tachiyomi.domain.source.service.SourceManager
import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.components.LabeledCheckbox
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.collectAsState
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
@ -91,8 +94,7 @@ object SettingsAdvancedScreen : SearchableSettings {
@ReadOnlyComposable
@Composable
@StringRes
override fun getTitleRes() = R.string.pref_category_advanced
override fun getTitleRes() = MR.strings.pref_category_advanced
@Composable
override fun getPreferences(): List<Preference> {
@ -108,13 +110,13 @@ object SettingsAdvancedScreen : SearchableSettings {
listOf(
/* SY --> Preference.PreferenceItem.SwitchPreference(
pref = basePreferences.acraEnabled(),
title = stringResource(R.string.pref_enable_acra),
subtitle = stringResource(R.string.pref_acra_summary),
title = stringResource(MR.strings.pref_enable_acra),
subtitle = stringResource(MR.strings.pref_acra_summary),
enabled = isPreviewBuildType || isReleaseBuildType,
), SY <-- */
Preference.PreferenceItem.TextPreference(
title = stringResource(R.string.pref_dump_crash_logs),
subtitle = stringResource(R.string.pref_dump_crash_logs_summary),
title = stringResource(MR.strings.pref_dump_crash_logs),
subtitle = stringResource(MR.strings.pref_dump_crash_logs_summary),
onClick = {
scope.launch {
CrashLogUtil(context).dumpLogs()
@ -123,15 +125,15 @@ object SettingsAdvancedScreen : SearchableSettings {
),
/* SY --> Preference.PreferenceItem.SwitchPreference(
pref = networkPreferences.verboseLogging(),
title = stringResource(R.string.pref_verbose_logging),
subtitle = stringResource(R.string.pref_verbose_logging_summary),
title = stringResource(MR.strings.pref_verbose_logging),
subtitle = stringResource(MR.strings.pref_verbose_logging_summary),
onValueChanged = {
context.toast(R.string.requires_app_restart)
context.toast(MR.strings.requires_app_restart)
true
},
), SY <-- */
Preference.PreferenceItem.TextPreference(
title = stringResource(R.string.pref_debug_info),
title = stringResource(MR.strings.pref_debug_info),
onClick = { navigator.push(DebugInfoScreen()) },
),
),
@ -139,7 +141,7 @@ object SettingsAdvancedScreen : SearchableSettings {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
add(
Preference.PreferenceItem.TextPreference(
title = stringResource(R.string.pref_manage_notifications),
title = stringResource(MR.strings.pref_manage_notifications),
onClick = {
val intent = Intent(Settings.ACTION_APP_NOTIFICATION_SETTINGS).apply {
putExtra(Settings.EXTRA_APP_PACKAGE, context.packageName)
@ -172,11 +174,11 @@ object SettingsAdvancedScreen : SearchableSettings {
val uriHandler = LocalUriHandler.current
return Preference.PreferenceGroup(
title = stringResource(R.string.label_background_activity),
title = stringResource(MR.strings.label_background_activity),
preferenceItems = listOf(
Preference.PreferenceItem.TextPreference(
title = stringResource(R.string.pref_disable_battery_optimization),
subtitle = stringResource(R.string.pref_disable_battery_optimization_summary),
title = stringResource(MR.strings.pref_disable_battery_optimization),
subtitle = stringResource(MR.strings.pref_disable_battery_optimization_summary),
onClick = {
val packageName: String = context.packageName
if (!context.powerManager.isIgnoringBatteryOptimizations(packageName)) {
@ -189,16 +191,16 @@ object SettingsAdvancedScreen : SearchableSettings {
}
context.startActivity(intent)
} catch (e: ActivityNotFoundException) {
context.toast(R.string.battery_optimization_setting_activity_not_found)
context.toast(MR.strings.battery_optimization_setting_activity_not_found)
}
} else {
context.toast(R.string.battery_optimization_disabled)
context.toast(MR.strings.battery_optimization_disabled)
}
},
),
Preference.PreferenceItem.TextPreference(
title = "Don't kill my app!",
subtitle = stringResource(R.string.about_dont_kill_my_app),
subtitle = stringResource(MR.strings.about_dont_kill_my_app),
onClick = { uriHandler.openUri("https://dontkillmyapp.com/") },
),
),
@ -211,19 +213,19 @@ object SettingsAdvancedScreen : SearchableSettings {
val navigator = LocalNavigator.currentOrThrow
return Preference.PreferenceGroup(
title = stringResource(R.string.label_data),
title = stringResource(MR.strings.label_data),
preferenceItems = listOf(
Preference.PreferenceItem.TextPreference(
title = stringResource(R.string.pref_invalidate_download_cache),
subtitle = stringResource(R.string.pref_invalidate_download_cache_summary),
title = stringResource(MR.strings.pref_invalidate_download_cache),
subtitle = stringResource(MR.strings.pref_invalidate_download_cache_summary),
onClick = {
Injekt.get<DownloadCache>().invalidateCache()
context.toast(R.string.download_cache_invalidated)
context.toast(MR.strings.download_cache_invalidated)
},
),
Preference.PreferenceItem.TextPreference(
title = stringResource(R.string.pref_clear_database),
subtitle = stringResource(R.string.pref_clear_database_summary),
title = stringResource(MR.strings.pref_clear_database),
subtitle = stringResource(MR.strings.pref_clear_database_summary),
onClick = { navigator.push(ClearDatabaseScreen()) },
),
),
@ -241,17 +243,17 @@ object SettingsAdvancedScreen : SearchableSettings {
val userAgent by userAgentPref.collectAsState()
return Preference.PreferenceGroup(
title = stringResource(R.string.label_network),
title = stringResource(MR.strings.label_network),
preferenceItems = listOf(
Preference.PreferenceItem.TextPreference(
title = stringResource(R.string.pref_clear_cookies),
title = stringResource(MR.strings.pref_clear_cookies),
onClick = {
networkHelper.cookieJar.removeAll()
context.toast(R.string.cookies_cleared)
context.toast(MR.strings.cookies_cleared)
},
),
Preference.PreferenceItem.TextPreference(
title = stringResource(R.string.pref_clear_webview_data),
title = stringResource(MR.strings.pref_clear_webview_data),
onClick = {
try {
WebView(context).run {
@ -265,18 +267,18 @@ object SettingsAdvancedScreen : SearchableSettings {
context.applicationInfo?.dataDir?.let {
File("$it/app_webview/").deleteRecursively()
}
context.toast(R.string.webview_data_deleted)
context.toast(MR.strings.webview_data_deleted)
} catch (e: Throwable) {
logcat(LogPriority.ERROR, e)
context.toast(R.string.cache_delete_error)
context.toast(MR.strings.cache_delete_error)
}
},
),
Preference.PreferenceItem.ListPreference(
pref = networkPreferences.dohProvider(),
title = stringResource(R.string.pref_dns_over_https),
title = stringResource(MR.strings.pref_dns_over_https),
entries = mapOf(
-1 to stringResource(R.string.disabled),
-1 to stringResource(MR.strings.disabled),
PREF_DOH_CLOUDFLARE to "Cloudflare",
PREF_DOH_GOOGLE to "Google",
PREF_DOH_ADGUARD to "AdGuard",
@ -291,30 +293,30 @@ object SettingsAdvancedScreen : SearchableSettings {
PREF_DOH_SHECAN to "Shecan",
),
onValueChanged = {
context.toast(R.string.requires_app_restart)
context.toast(MR.strings.requires_app_restart)
true
},
),
Preference.PreferenceItem.EditTextPreference(
pref = userAgentPref,
title = stringResource(R.string.pref_user_agent_string),
title = stringResource(MR.strings.pref_user_agent_string),
onValueChanged = {
try {
// OkHttp checks for valid values internally
Headers.Builder().add("User-Agent", it)
} catch (_: IllegalArgumentException) {
context.toast(R.string.error_user_agent_string_invalid)
context.toast(MR.strings.error_user_agent_string_invalid)
return@EditTextPreference false
}
true
},
),
Preference.PreferenceItem.TextPreference(
title = stringResource(R.string.pref_reset_user_agent_string),
title = stringResource(MR.strings.pref_reset_user_agent_string),
enabled = remember(userAgent) { userAgent != userAgentPref.defaultValue() },
onClick = {
userAgentPref.delete()
context.toast(R.string.requires_app_restart)
context.toast(MR.strings.requires_app_restart)
},
),
),
@ -327,23 +329,23 @@ object SettingsAdvancedScreen : SearchableSettings {
val context = LocalContext.current
return Preference.PreferenceGroup(
title = stringResource(R.string.label_library),
title = stringResource(MR.strings.label_library),
preferenceItems = listOf(
Preference.PreferenceItem.TextPreference(
title = stringResource(R.string.pref_refresh_library_covers),
title = stringResource(MR.strings.pref_refresh_library_covers),
onClick = { LibraryUpdateJob.startNow(context, target = LibraryUpdateJob.Target.COVERS) },
),
Preference.PreferenceItem.TextPreference(
title = stringResource(R.string.pref_reset_viewer_flags),
subtitle = stringResource(R.string.pref_reset_viewer_flags_summary),
title = stringResource(MR.strings.pref_reset_viewer_flags),
subtitle = stringResource(MR.strings.pref_reset_viewer_flags_summary),
onClick = {
scope.launchNonCancellable {
val success = Injekt.get<ResetViewerFlags>().await()
withUIContext {
val message = if (success) {
R.string.pref_reset_viewer_flags_success
MR.strings.pref_reset_viewer_flags_success
} else {
R.string.pref_reset_viewer_flags_error
MR.strings.pref_reset_viewer_flags_error
}
context.toast(message)
}
@ -367,11 +369,11 @@ object SettingsAdvancedScreen : SearchableSettings {
val dismiss = { shizukuMissing = false }
AlertDialog(
onDismissRequest = dismiss,
title = { Text(text = stringResource(R.string.ext_installer_shizuku)) },
text = { Text(text = stringResource(R.string.ext_installer_shizuku_unavailable_dialog)) },
title = { Text(text = stringResource(MR.strings.ext_installer_shizuku)) },
text = { Text(text = stringResource(MR.strings.ext_installer_shizuku_unavailable_dialog)) },
dismissButton = {
TextButton(onClick = dismiss) {
Text(text = stringResource(R.string.action_cancel))
Text(text = stringResource(MR.strings.action_cancel))
}
},
confirmButton = {
@ -381,19 +383,19 @@ object SettingsAdvancedScreen : SearchableSettings {
uriHandler.openUri("https://shizuku.rikka.app/download")
},
) {
Text(text = stringResource(R.string.action_ok))
Text(text = stringResource(MR.strings.action_ok))
}
},
)
}
return Preference.PreferenceGroup(
title = stringResource(R.string.label_extensions),
title = stringResource(MR.strings.label_extensions),
preferenceItems = listOf(
Preference.PreferenceItem.ListPreference(
pref = extensionInstallerPref,
title = stringResource(R.string.ext_installer_pref),
title = stringResource(MR.strings.ext_installer_pref),
entries = extensionInstallerPref.entries
.associateWith { stringResource(it.titleResId) },
.associateWith { stringResource(it.titleRes) },
onValueChanged = {
if (it == BasePreferences.ExtensionInstaller.SHIZUKU &&
!context.isShizukuInstalled
@ -422,7 +424,7 @@ object SettingsAdvancedScreen : SearchableSettings {
}
AlertDialog(
onDismissRequest = onDismissRequest,
title = { Text(text = stringResource(R.string.clean_up_downloaded_chapters)) },
title = { Text(text = stringResource(SYMR.strings.clean_up_downloaded_chapters)) },
text = {
LazyColumn {
options.forEachIndexed { index, option ->
@ -452,12 +454,12 @@ object SettingsAdvancedScreen : SearchableSettings {
onCleanupDownloads(removeRead, removeNonFavorite)
},
) {
Text(text = stringResource(R.string.action_ok))
Text(text = stringResource(MR.strings.action_ok))
}
},
dismissButton = {
TextButton(onClick = onDismissRequest) {
Text(text = stringResource(R.string.action_cancel))
Text(text = stringResource(MR.strings.action_cancel))
}
},
)
@ -474,7 +476,7 @@ object SettingsAdvancedScreen : SearchableSettings {
onCleanupDownloads = { removeRead, removeNonFavorite ->
dialogOpen = false
if (job?.isActive == true) return@CleanupDownloadsDialog
context.toast(R.string.starting_cleanup)
context.toast(SYMR.strings.starting_cleanup)
job = scope.launchNonCancellable {
val mangaList = Injekt.get<GetAllManga>().await()
val downloadManager: DownloadManager = Injekt.get()
@ -514,10 +516,10 @@ object SettingsAdvancedScreen : SearchableSettings {
withUIContext {
val cleanupString =
if (foldersCleared == 0) {
context.getString(R.string.no_folders_to_cleanup)
context.stringResource(SYMR.strings.no_folders_to_cleanup)
} else {
context.resources!!.getQuantityString(
R.plurals.cleanup_done,
context.pluralStringResource(
SYMR.plurals.cleanup_done,
foldersCleared,
foldersCleared,
)
@ -529,11 +531,11 @@ object SettingsAdvancedScreen : SearchableSettings {
)
}
return Preference.PreferenceGroup(
title = stringResource(R.string.download_notifier_downloader_title),
title = stringResource(MR.strings.download_notifier_downloader_title),
preferenceItems = listOf(
Preference.PreferenceItem.TextPreference(
title = stringResource(R.string.clean_up_downloaded_chapters),
subtitle = stringResource(R.string.delete_unused_chapters),
title = stringResource(SYMR.strings.clean_up_downloaded_chapters),
subtitle = stringResource(SYMR.strings.delete_unused_chapters),
onClick = { dialogOpen = true },
),
),
@ -545,43 +547,43 @@ object SettingsAdvancedScreen : SearchableSettings {
val sourcePreferences = remember { Injekt.get<SourcePreferences>() }
val dataSaver by sourcePreferences.dataSaver().collectAsState()
return Preference.PreferenceGroup(
title = stringResource(R.string.data_saver),
title = stringResource(SYMR.strings.data_saver),
preferenceItems = listOf(
Preference.PreferenceItem.ListPreference(
pref = sourcePreferences.dataSaver(),
title = stringResource(R.string.data_saver),
subtitle = stringResource(R.string.data_saver_summary),
title = stringResource(SYMR.strings.data_saver),
subtitle = stringResource(SYMR.strings.data_saver_summary),
entries = mapOf(
DataSaver.NONE to stringResource(R.string.disabled),
DataSaver.BANDWIDTH_HERO to stringResource(R.string.bandwidth_hero),
DataSaver.WSRV_NL to stringResource(R.string.wsrv),
DataSaver.NONE to stringResource(MR.strings.disabled),
DataSaver.BANDWIDTH_HERO to stringResource(SYMR.strings.bandwidth_hero),
DataSaver.WSRV_NL to stringResource(SYMR.strings.wsrv),
),
),
Preference.PreferenceItem.EditTextPreference(
pref = sourcePreferences.dataSaverServer(),
title = stringResource(R.string.bandwidth_data_saver_server),
subtitle = stringResource(R.string.data_saver_server_summary),
title = stringResource(SYMR.strings.bandwidth_data_saver_server),
subtitle = stringResource(SYMR.strings.data_saver_server_summary),
enabled = dataSaver == DataSaver.BANDWIDTH_HERO,
),
Preference.PreferenceItem.SwitchPreference(
pref = sourcePreferences.dataSaverDownloader(),
title = stringResource(R.string.data_saver_downloader),
title = stringResource(SYMR.strings.data_saver_downloader),
enabled = dataSaver != DataSaver.NONE,
),
Preference.PreferenceItem.SwitchPreference(
pref = sourcePreferences.dataSaverIgnoreJpeg(),
title = stringResource(R.string.data_saver_ignore_jpeg),
title = stringResource(SYMR.strings.data_saver_ignore_jpeg),
enabled = dataSaver != DataSaver.NONE,
),
Preference.PreferenceItem.SwitchPreference(
pref = sourcePreferences.dataSaverIgnoreGif(),
title = stringResource(R.string.data_saver_ignore_gif),
title = stringResource(SYMR.strings.data_saver_ignore_gif),
enabled = dataSaver != DataSaver.NONE,
),
Preference.PreferenceItem.ListPreference(
pref = sourcePreferences.dataSaverImageQuality(),
title = stringResource(R.string.data_saver_image_quality),
subtitle = stringResource(R.string.data_saver_image_quality_summary),
title = stringResource(SYMR.strings.data_saver_image_quality),
subtitle = stringResource(SYMR.strings.data_saver_image_quality_summary),
entries = listOf(
"10%",
"20%",
@ -599,18 +601,18 @@ object SettingsAdvancedScreen : SearchableSettings {
.collectAsState()
Preference.PreferenceItem.SwitchPreference(
pref = sourcePreferences.dataSaverImageFormatJpeg(),
title = stringResource(R.string.data_saver_image_format),
title = stringResource(SYMR.strings.data_saver_image_format),
subtitle = if (dataSaverImageFormatJpeg) {
stringResource(R.string.data_saver_image_format_summary_on)
stringResource(SYMR.strings.data_saver_image_format_summary_on)
} else {
stringResource(R.string.data_saver_image_format_summary_off)
stringResource(SYMR.strings.data_saver_image_format_summary_off)
},
enabled = dataSaver != DataSaver.NONE,
)
},
Preference.PreferenceItem.SwitchPreference(
pref = sourcePreferences.dataSaverColorBW(),
title = stringResource(R.string.data_saver_color_bw),
title = stringResource(SYMR.strings.data_saver_color_bw),
enabled = dataSaver == DataSaver.BANDWIDTH_HERO,
),
),
@ -626,12 +628,12 @@ object SettingsAdvancedScreen : SearchableSettings {
val delegateSourcePreferences = remember { Injekt.get<DelegateSourcePreferences>() }
val securityPreferences = remember { Injekt.get<SecurityPreferences>() }
return Preference.PreferenceGroup(
title = stringResource(R.string.developer_tools),
title = stringResource(SYMR.strings.developer_tools),
preferenceItems = listOf(
Preference.PreferenceItem.SwitchPreference(
pref = unsortedPreferences.isHentaiEnabled(),
title = stringResource(R.string.toggle_hentai_features),
subtitle = stringResource(R.string.toggle_hentai_features_summary),
title = stringResource(SYMR.strings.toggle_hentai_features),
subtitle = stringResource(SYMR.strings.toggle_hentai_features_summary),
onValueChanged = {
if (it) {
BlacklistedSources.HIDDEN_SOURCES += EH_SOURCE_ID
@ -645,30 +647,30 @@ object SettingsAdvancedScreen : SearchableSettings {
),
Preference.PreferenceItem.SwitchPreference(
pref = delegateSourcePreferences.delegateSources(),
title = stringResource(R.string.toggle_delegated_sources),
title = stringResource(SYMR.strings.toggle_delegated_sources),
subtitle = stringResource(
R.string.toggle_delegated_sources_summary,
stringResource(R.string.app_name),
SYMR.strings.toggle_delegated_sources_summary,
stringResource(MR.strings.app_name),
AndroidSourceManager.DELEGATED_SOURCES.values.map { it.sourceName }.distinct()
.joinToString(),
),
),
Preference.PreferenceItem.ListPreference(
pref = unsortedPreferences.logLevel(),
title = stringResource(R.string.log_level),
subtitle = stringResource(R.string.log_level_summary),
title = stringResource(SYMR.strings.log_level),
subtitle = stringResource(SYMR.strings.log_level_summary),
entries = EHLogLevel.values().mapIndexed { index, ehLogLevel ->
index to "${context.getString(ehLogLevel.nameRes)} (${
context.getString(ehLogLevel.description)
index to "${context.stringResource(ehLogLevel.nameRes)} (${
context.stringResource(ehLogLevel.description)
})"
}.toMap(),
),
Preference.PreferenceItem.SwitchPreference(
pref = sourcePreferences.enableSourceBlacklist(),
title = stringResource(R.string.enable_source_blacklist),
title = stringResource(SYMR.strings.enable_source_blacklist),
subtitle = stringResource(
R.string.enable_source_blacklist_summary,
stringResource(R.string.app_name),
SYMR.strings.enable_source_blacklist_summary,
stringResource(MR.strings.app_name),
),
),
kotlin.run {
@ -678,20 +680,20 @@ object SettingsAdvancedScreen : SearchableSettings {
val dismiss = { enableEncryptDatabase = false }
AlertDialog(
onDismissRequest = dismiss,
title = { Text(text = stringResource(R.string.encrypt_database)) },
title = { Text(text = stringResource(SYMR.strings.encrypt_database)) },
text = {
Text(
text = remember {
HtmlCompat.fromHtml(
context.getString(R.string.encrypt_database_message),
HtmlCompat.FROM_HTML_MODE_COMPACT
context.stringResource(SYMR.strings.encrypt_database_message),
HtmlCompat.FROM_HTML_MODE_COMPACT,
).toAnnotatedString()
},
)
},
dismissButton = {
TextButton(onClick = dismiss) {
Text(text = stringResource(R.string.action_cancel))
Text(text = stringResource(MR.strings.action_cancel))
}
},
confirmButton = {
@ -701,15 +703,15 @@ object SettingsAdvancedScreen : SearchableSettings {
securityPreferences.encryptDatabase().set(true)
},
) {
Text(text = stringResource(R.string.action_ok))
Text(text = stringResource(MR.strings.action_ok))
}
},
)
}
Preference.PreferenceItem.SwitchPreference(
title = stringResource(R.string.encrypt_database),
title = stringResource(SYMR.strings.encrypt_database),
pref = securityPreferences.encryptDatabase(),
subtitle = stringResource(R.string.encrypt_database_subtitle),
subtitle = stringResource(SYMR.strings.encrypt_database_subtitle),
onValueChanged = {
if (it) {
enableEncryptDatabase = true
@ -721,11 +723,11 @@ object SettingsAdvancedScreen : SearchableSettings {
)
},
Preference.PreferenceItem.TextPreference(
title = stringResource(R.string.open_debug_menu),
title = stringResource(SYMR.strings.open_debug_menu),
subtitle = remember {
HtmlCompat.fromHtml(
context.getString(R.string.open_debug_menu_summary),
HtmlCompat.FROM_HTML_MODE_COMPACT
context.stringResource(SYMR.strings.open_debug_menu_summary),
HtmlCompat.FROM_HTML_MODE_COMPACT,
).toAnnotatedString()
},
onClick = { navigator.push(SettingsDebugScreen()) },

View File

@ -29,6 +29,7 @@ import kotlinx.coroutines.flow.merge
import org.xmlpull.v1.XmlPullParser
import tachiyomi.core.i18n.stringResource
import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.collectAsState
import uy.kohesive.injekt.Injekt
@ -214,21 +215,21 @@ object SettingsAppearanceScreen : SearchableSettings {
@Composable
fun getForkGroup(uiPreferences: UiPreferences): Preference.PreferenceGroup {
return Preference.PreferenceGroup(
stringResource(R.string.pref_category_fork),
stringResource(SYMR.strings.pref_category_fork),
preferenceItems = listOf(
Preference.PreferenceItem.SwitchPreference(
pref = uiPreferences.expandFilters(),
title = stringResource(R.string.toggle_expand_search_filters),
title = stringResource(SYMR.strings.toggle_expand_search_filters),
),
Preference.PreferenceItem.SwitchPreference(
pref = uiPreferences.recommendsInOverflow(),
title = stringResource(R.string.put_recommends_in_overflow),
subtitle = stringResource(R.string.put_recommends_in_overflow_summary),
title = stringResource(SYMR.strings.put_recommends_in_overflow),
subtitle = stringResource(SYMR.strings.put_recommends_in_overflow_summary),
),
Preference.PreferenceItem.SwitchPreference(
pref = uiPreferences.mergeInOverflow(),
title = stringResource(R.string.put_merge_in_overflow),
subtitle = stringResource(R.string.put_merge_in_overflow_summary),
title = stringResource(SYMR.strings.put_merge_in_overflow),
subtitle = stringResource(SYMR.strings.put_merge_in_overflow_summary),
),
),
)
@ -237,19 +238,19 @@ object SettingsAppearanceScreen : SearchableSettings {
@Composable
fun getNavbarGroup(uiPreferences: UiPreferences): Preference.PreferenceGroup {
return Preference.PreferenceGroup(
stringResource(R.string.pref_category_navbar),
stringResource(SYMR.strings.pref_category_navbar),
preferenceItems = listOf(
Preference.PreferenceItem.SwitchPreference(
pref = uiPreferences.showNavUpdates(),
title = stringResource(R.string.pref_hide_updates_button),
title = stringResource(SYMR.strings.pref_hide_updates_button),
),
Preference.PreferenceItem.SwitchPreference(
pref = uiPreferences.showNavHistory(),
title = stringResource(R.string.pref_hide_history_button),
title = stringResource(SYMR.strings.pref_hide_history_button),
),
Preference.PreferenceItem.SwitchPreference(
pref = uiPreferences.bottomBarLabels(),
title = stringResource(R.string.pref_show_bottom_bar_labels),
title = stringResource(SYMR.strings.pref_show_bottom_bar_labels),
),
),
)

View File

@ -1,24 +1,25 @@
package eu.kanade.presentation.more.settings.screen
import androidx.annotation.StringRes
import androidx.compose.runtime.Composable
import androidx.compose.runtime.ReadOnlyComposable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.pluralStringResource
import androidx.compose.ui.res.stringResource
import androidx.fragment.app.FragmentActivity
import cafe.adriel.voyager.navigator.LocalNavigator
import cafe.adriel.voyager.navigator.currentOrThrow
import eu.kanade.domain.source.service.SourcePreferences
import eu.kanade.domain.ui.UiPreferences
import eu.kanade.presentation.more.settings.Preference
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.ui.category.repos.RepoScreen
import eu.kanade.tachiyomi.ui.category.sources.SourceCategoryScreen
import eu.kanade.tachiyomi.util.system.AuthenticatorUtil.authenticate
import tachiyomi.core.i18n.stringResource
import tachiyomi.domain.UnsortedPreferences
import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.i18n.pluralStringResource
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.collectAsState
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
@ -27,8 +28,7 @@ object SettingsBrowseScreen : SearchableSettings {
@ReadOnlyComposable
@Composable
@StringRes
override fun getTitleRes() = R.string.browse
override fun getTitleRes() = MR.strings.browse
@Composable
override fun getPreferences(): List<Preference> {
@ -41,14 +41,14 @@ object SettingsBrowseScreen : SearchableSettings {
return listOf(
// SY -->
Preference.PreferenceGroup(
title = stringResource(R.string.label_sources),
title = stringResource(MR.strings.label_sources),
preferenceItems = listOf(
kotlin.run {
val navigator = LocalNavigator.currentOrThrow
val count by sourcePreferences.sourcesTabCategories().collectAsState()
Preference.PreferenceItem.TextPreference(
title = stringResource(R.string.action_edit_categories),
subtitle = pluralStringResource(R.plurals.num_categories, count.size, count.size),
title = stringResource(MR.strings.action_edit_categories),
subtitle = pluralStringResource(MR.plurals.num_categories, count.size, count.size),
onClick = {
navigator.push(SourceCategoryScreen())
},
@ -56,40 +56,40 @@ object SettingsBrowseScreen : SearchableSettings {
},
Preference.PreferenceItem.SwitchPreference(
pref = sourcePreferences.sourcesTabCategoriesFilter(),
title = stringResource(R.string.pref_source_source_filtering),
subtitle = stringResource(R.string.pref_source_source_filtering_summery),
title = stringResource(SYMR.strings.pref_source_source_filtering),
subtitle = stringResource(SYMR.strings.pref_source_source_filtering_summery),
),
Preference.PreferenceItem.SwitchPreference(
pref = uiPreferences.useNewSourceNavigation(),
title = stringResource(R.string.pref_source_navigation),
subtitle = stringResource(R.string.pref_source_navigation_summery),
title = stringResource(SYMR.strings.pref_source_navigation),
subtitle = stringResource(SYMR.strings.pref_source_navigation_summery),
),
Preference.PreferenceItem.SwitchPreference(
pref = unsortedPreferences.allowLocalSourceHiddenFolders(),
title = stringResource(R.string.pref_local_source_hidden_folders),
subtitle = stringResource(R.string.pref_local_source_hidden_folders_summery),
title = stringResource(SYMR.strings.pref_local_source_hidden_folders),
subtitle = stringResource(SYMR.strings.pref_local_source_hidden_folders_summery),
),
),
),
Preference.PreferenceGroup(
title = stringResource(R.string.feed),
title = stringResource(SYMR.strings.feed),
preferenceItems = listOf(
Preference.PreferenceItem.SwitchPreference(
pref = uiPreferences.feedTabInFront(),
title = stringResource(R.string.pref_feed_position),
subtitle = stringResource(R.string.pref_feed_position_summery),
title = stringResource(SYMR.strings.pref_feed_position),
subtitle = stringResource(SYMR.strings.pref_feed_position_summery),
),
),
),
Preference.PreferenceGroup(
title = stringResource(R.string.label_extensions),
title = stringResource(MR.strings.label_extensions),
preferenceItems = listOf(
kotlin.run {
val navigator = LocalNavigator.currentOrThrow
val count by unsortedPreferences.extensionRepos().collectAsState()
Preference.PreferenceItem.TextPreference(
title = stringResource(R.string.action_edit_repos),
subtitle = pluralStringResource(R.plurals.num_repos, count.size, count.size),
title = stringResource(SYMR.strings.action_edit_repos),
subtitle = pluralStringResource(SYMR.plurals.num_repos, count.size, count.size),
onClick = {
navigator.push(RepoScreen())
},
@ -99,28 +99,28 @@ object SettingsBrowseScreen : SearchableSettings {
),
// SY <--
Preference.PreferenceGroup(
title = stringResource(R.string.label_sources),
title = stringResource(MR.strings.label_sources),
preferenceItems = listOf(
Preference.PreferenceItem.SwitchPreference(
pref = sourcePreferences.hideInLibraryItems(),
title = stringResource(R.string.pref_hide_in_library_items),
title = stringResource(MR.strings.pref_hide_in_library_items),
),
),
),
Preference.PreferenceGroup(
title = stringResource(R.string.pref_category_nsfw_content),
title = stringResource(MR.strings.pref_category_nsfw_content),
preferenceItems = listOf(
Preference.PreferenceItem.SwitchPreference(
pref = sourcePreferences.showNsfwSource(),
title = stringResource(R.string.pref_show_nsfw_source),
subtitle = stringResource(R.string.requires_app_restart),
title = stringResource(MR.strings.pref_show_nsfw_source),
subtitle = stringResource(MR.strings.requires_app_restart),
onValueChanged = {
(context as FragmentActivity).authenticate(
title = context.getString(R.string.pref_category_nsfw_content),
title = context.stringResource(MR.strings.pref_category_nsfw_content),
)
},
),
Preference.PreferenceItem.InfoPreference(stringResource(R.string.parental_controls_info)),
Preference.PreferenceItem.InfoPreference(stringResource(MR.strings.parental_controls_info)),
),
),
)

View File

@ -51,6 +51,7 @@ import tachiyomi.core.util.system.logcat
import tachiyomi.domain.backup.service.BackupPreferences
import tachiyomi.domain.library.service.LibraryPreferences
import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.collectAsState
import uy.kohesive.injekt.Injekt
@ -292,19 +293,19 @@ object SettingsDataScreen : SearchableSettings {
),
// SY -->
Preference.PreferenceItem.TextPreference(
title = stringResource(R.string.pref_clear_page_preview_cache),
subtitle = stringResource(R.string.used_cache, pagePreviewReadableSize),
title = stringResource(SYMR.strings.pref_clear_page_preview_cache),
subtitle = stringResource(MR.strings.used_cache, pagePreviewReadableSize),
onClick = {
scope.launchNonCancellable {
try {
val deletedFiles = pagePreviewCache.clear()
withUIContext {
context.toast(context.getString(R.string.cache_deleted, deletedFiles))
context.toast(context.stringResource(MR.strings.cache_deleted, deletedFiles))
pagePreviewReadableSizeSema++
}
} catch (e: Throwable) {
logcat(LogPriority.ERROR, e)
withUIContext { context.toast(R.string.cache_delete_error) }
withUIContext { context.toast(MR.strings.cache_delete_error) }
}
}
},

View File

@ -5,7 +5,6 @@ import android.content.Context
import android.widget.Toast
import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.result.contract.ActivityResultContracts
import androidx.annotation.StringRes
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
@ -41,14 +40,12 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Dialog
import androidx.compose.ui.window.DialogProperties
import androidx.core.content.ContextCompat.startActivity
import eu.kanade.presentation.library.components.SyncFavoritesWarningDialog
import eu.kanade.presentation.more.settings.Preference
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.ui.webview.WebViewActivity
import eu.kanade.tachiyomi.util.system.toast
import exh.eh.EHentaiUpdateWorker
@ -59,6 +56,8 @@ import exh.ui.login.EhLoginActivity
import exh.util.nullIfBlank
import kotlinx.serialization.json.Json
import logcat.LogPriority
import tachiyomi.core.i18n.pluralStringResource
import tachiyomi.core.i18n.stringResource
import tachiyomi.core.util.lang.launchNonCancellable
import tachiyomi.core.util.lang.withIOContext
import tachiyomi.core.util.lang.withUIContext
@ -69,6 +68,9 @@ import tachiyomi.domain.library.service.LibraryPreferences.Companion.DEVICE_ONLY
import tachiyomi.domain.manga.interactor.DeleteFavoriteEntries
import tachiyomi.domain.manga.interactor.GetExhFavoriteMangaWithMetadata
import tachiyomi.domain.manga.interactor.GetFlatMetadataById
import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.collectAsState
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
@ -83,8 +85,7 @@ object SettingsEhScreen : SearchableSettings {
@ReadOnlyComposable
@Composable
@StringRes
override fun getTitleRes() = R.string.pref_category_eh
override fun getTitleRes() = SYMR.strings.pref_category_eh
override fun isEnabled(): Boolean = Injekt.get<UnsortedPreferences>().isHentaiEnabled().get()
@ -136,7 +137,7 @@ object SettingsEhScreen : SearchableSettings {
return listOf(
Preference.PreferenceGroup(
stringResource(R.string.ehentai_prefs_account_settings),
stringResource(SYMR.strings.ehentai_prefs_account_settings),
preferenceItems = listOf(
getLoginPreference(unsortedPreferences, openWarnConfigureDialogController),
useHentaiAtHome(exhentaiEnabled, unsortedPreferences),
@ -153,7 +154,7 @@ object SettingsEhScreen : SearchableSettings {
),
),
Preference.PreferenceGroup(
stringResource(R.string.favorites_sync),
stringResource(SYMR.strings.favorites_sync),
preferenceItems = listOf(
readOnlySync(unsortedPreferences),
syncFavoriteNotes(),
@ -162,7 +163,7 @@ object SettingsEhScreen : SearchableSettings {
),
),
Preference.PreferenceGroup(
stringResource(R.string.gallery_update_checker),
stringResource(SYMR.strings.gallery_update_checker),
preferenceItems = listOf(
updateCheckerFrequency(unsortedPreferences),
autoUpdateRequirements(unsortedPreferences),
@ -192,9 +193,9 @@ object SettingsEhScreen : SearchableSettings {
val value by unsortedPreferences.enableExhentai().collectAsState()
return Preference.PreferenceItem.SwitchPreference(
pref = unsortedPreferences.enableExhentai(),
title = stringResource(R.string.enable_exhentai),
title = stringResource(SYMR.strings.enable_exhentai),
subtitle = if (!value) {
stringResource(R.string.requires_login)
stringResource(SYMR.strings.requires_login)
} else {
null
},
@ -217,11 +218,11 @@ object SettingsEhScreen : SearchableSettings {
): Preference.PreferenceItem.ListPreference<Int> {
return Preference.PreferenceItem.ListPreference(
pref = unsortedPreferences.useHentaiAtHome(),
title = stringResource(R.string.use_hentai_at_home),
subtitle = stringResource(R.string.use_hentai_at_home_summary),
title = stringResource(SYMR.strings.use_hentai_at_home),
subtitle = stringResource(SYMR.strings.use_hentai_at_home_summary),
entries = mapOf(
0 to stringResource(R.string.use_hentai_at_home_option_1),
1 to stringResource(R.string.use_hentai_at_home_option_2),
0 to stringResource(SYMR.strings.use_hentai_at_home_option_1),
1 to stringResource(SYMR.strings.use_hentai_at_home_option_2),
),
enabled = exhentaiEnabled,
)
@ -235,11 +236,11 @@ object SettingsEhScreen : SearchableSettings {
val value by unsortedPreferences.useJapaneseTitle().collectAsState()
return Preference.PreferenceItem.SwitchPreference(
pref = unsortedPreferences.useJapaneseTitle(),
title = stringResource(R.string.show_japanese_titles),
title = stringResource(SYMR.strings.show_japanese_titles),
subtitle = if (value) {
stringResource(R.string.show_japanese_titles_option_1)
stringResource(SYMR.strings.show_japanese_titles_option_1)
} else {
stringResource(R.string.show_japanese_titles_option_2)
stringResource(SYMR.strings.show_japanese_titles_option_2)
},
enabled = exhentaiEnabled,
)
@ -253,11 +254,11 @@ object SettingsEhScreen : SearchableSettings {
val value by unsortedPreferences.exhUseOriginalImages().collectAsState()
return Preference.PreferenceItem.SwitchPreference(
pref = unsortedPreferences.exhUseOriginalImages(),
title = stringResource(R.string.use_original_images),
title = stringResource(SYMR.strings.use_original_images),
subtitle = if (value) {
stringResource(R.string.use_original_images_on)
stringResource(SYMR.strings.use_original_images_on)
} else {
stringResource(R.string.use_original_images_off)
stringResource(SYMR.strings.use_original_images_off)
},
enabled = exhentaiEnabled,
)
@ -267,15 +268,15 @@ object SettingsEhScreen : SearchableSettings {
fun watchedTags(exhentaiEnabled: Boolean): Preference.PreferenceItem.TextPreference {
val context = LocalContext.current
return Preference.PreferenceItem.TextPreference(
title = stringResource(R.string.watched_tags),
subtitle = stringResource(R.string.watched_tags_summary),
title = stringResource(SYMR.strings.watched_tags),
subtitle = stringResource(SYMR.strings.watched_tags_summary),
onClick = {
startActivity(
context,
WebViewActivity.newIntent(
context,
url = "https://exhentai.org/mytags",
title = context.getString(R.string.watched_tags_exh),
title = context.stringResource(SYMR.strings.watched_tags_exh),
),
null,
)
@ -304,12 +305,12 @@ object SettingsEhScreen : SearchableSettings {
onClick = { onValueChange(value.toIntOrNull() ?: return@TextButton) },
enabled = isValid,
) {
Text(text = stringResource(R.string.action_ok))
Text(text = stringResource(MR.strings.action_ok))
}
},
dismissButton = {
TextButton(onClick = onDismissRequest) {
Text(text = stringResource(R.string.action_cancel))
Text(text = stringResource(MR.strings.action_cancel))
}
},
title = {
@ -357,10 +358,10 @@ object SettingsEhScreen : SearchableSettings {
if (dialogOpen) {
TagThresholdDialog(
onDismissRequest = { dialogOpen = false },
title = stringResource(R.string.tag_filtering_threshold),
title = stringResource(SYMR.strings.tag_filtering_threshold),
initialValue = value,
valueRange = -9999..0,
outsideRangeError = stringResource(R.string.tag_filtering_threshhold_error),
outsideRangeError = stringResource(SYMR.strings.tag_filtering_threshhold_error),
onValueChange = {
dialogOpen = false
unsortedPreferences.ehTagFilterValue().set(it)
@ -368,8 +369,8 @@ object SettingsEhScreen : SearchableSettings {
)
}
return Preference.PreferenceItem.TextPreference(
title = stringResource(R.string.tag_filtering_threshold),
subtitle = stringResource(R.string.tag_filtering_threshhold_summary, value),
title = stringResource(SYMR.strings.tag_filtering_threshold),
subtitle = stringResource(SYMR.strings.tag_filtering_threshhold_summary, value),
onClick = {
dialogOpen = true
},
@ -387,10 +388,10 @@ object SettingsEhScreen : SearchableSettings {
if (dialogOpen) {
TagThresholdDialog(
onDismissRequest = { dialogOpen = false },
title = stringResource(R.string.tag_watching_threshhold),
title = stringResource(SYMR.strings.tag_watching_threshhold),
initialValue = value,
valueRange = 0..9999,
outsideRangeError = stringResource(R.string.tag_watching_threshhold_error),
outsideRangeError = stringResource(SYMR.strings.tag_watching_threshhold_error),
onValueChange = {
dialogOpen = false
unsortedPreferences.ehTagWatchingValue().set(it)
@ -398,8 +399,8 @@ object SettingsEhScreen : SearchableSettings {
)
}
return Preference.PreferenceItem.TextPreference(
title = stringResource(R.string.tag_watching_threshhold),
subtitle = stringResource(R.string.tag_watching_threshhold_summary, value),
title = stringResource(SYMR.strings.tag_watching_threshhold),
subtitle = stringResource(SYMR.strings.tag_watching_threshhold_summary, value),
onClick = {
dialogOpen = true
},
@ -549,14 +550,14 @@ object SettingsEhScreen : SearchableSettings {
val state = remember(initialValue) { LanguageDialogState(initialValue) }
AlertDialog(
onDismissRequest = onDismissRequest,
title = { Text(stringResource(R.string.language_filtering)) },
title = { Text(stringResource(SYMR.strings.language_filtering)) },
text = {
Column(
Modifier
.fillMaxWidth()
.verticalScroll(rememberScrollState()),
) {
Text(stringResource(R.string.language_filtering_summary))
Text(stringResource(SYMR.strings.language_filtering_summary))
Row(
modifier = Modifier.fillMaxWidth(),
@ -589,12 +590,12 @@ object SettingsEhScreen : SearchableSettings {
},
confirmButton = {
TextButton(onClick = { onValueChange(state.toPreference()) }) {
Text(text = stringResource(R.string.action_ok))
Text(text = stringResource(MR.strings.action_ok))
}
},
dismissButton = {
TextButton(onClick = onDismissRequest) {
Text(text = stringResource(R.string.action_cancel))
Text(text = stringResource(MR.strings.action_cancel))
}
},
)
@ -618,8 +619,8 @@ object SettingsEhScreen : SearchableSettings {
)
}
return Preference.PreferenceItem.TextPreference(
title = stringResource(R.string.language_filtering),
subtitle = stringResource(R.string.language_filtering_summary),
title = stringResource(SYMR.strings.language_filtering),
subtitle = stringResource(SYMR.strings.language_filtering_summary),
onClick = {
dialogOpen = true
},
@ -684,14 +685,14 @@ object SettingsEhScreen : SearchableSettings {
val state = remember(initialValue) { FrontPageCategoriesDialogState(initialValue) }
AlertDialog(
onDismissRequest = onDismissRequest,
title = { Text(stringResource(R.string.frong_page_categories)) },
title = { Text(stringResource(SYMR.strings.frong_page_categories)) },
text = {
Column(
Modifier
.fillMaxWidth()
.verticalScroll(rememberScrollState()),
) {
Text(stringResource(R.string.fromt_page_categories_summary))
Text(stringResource(SYMR.strings.fromt_page_categories_summary))
Row(
modifier = Modifier.fillMaxWidth(),
@ -755,12 +756,12 @@ object SettingsEhScreen : SearchableSettings {
},
confirmButton = {
TextButton(onClick = { onValueChange(state.toPreference()) }) {
Text(text = stringResource(R.string.action_ok))
Text(text = stringResource(MR.strings.action_ok))
}
},
dismissButton = {
TextButton(onClick = onDismissRequest) {
Text(text = stringResource(R.string.action_cancel))
Text(text = stringResource(MR.strings.action_cancel))
}
},
)
@ -784,8 +785,8 @@ object SettingsEhScreen : SearchableSettings {
)
}
return Preference.PreferenceItem.TextPreference(
title = stringResource(R.string.frong_page_categories),
subtitle = stringResource(R.string.fromt_page_categories_summary),
title = stringResource(SYMR.strings.frong_page_categories),
subtitle = stringResource(SYMR.strings.fromt_page_categories_summary),
onClick = {
dialogOpen = true
},
@ -800,8 +801,8 @@ object SettingsEhScreen : SearchableSettings {
): Preference.PreferenceItem.SwitchPreference {
return Preference.PreferenceItem.SwitchPreference(
pref = unsortedPreferences.exhWatchedListDefaultState(),
title = stringResource(R.string.watched_list_default),
subtitle = stringResource(R.string.watched_list_state_summary),
title = stringResource(SYMR.strings.watched_list_default),
subtitle = stringResource(SYMR.strings.watched_list_state_summary),
enabled = exhentaiEnabled,
)
}
@ -813,15 +814,15 @@ object SettingsEhScreen : SearchableSettings {
): Preference.PreferenceItem.ListPreference<String> {
return Preference.PreferenceItem.ListPreference(
pref = unsortedPreferences.imageQuality(),
title = stringResource(R.string.eh_image_quality_summary),
subtitle = stringResource(R.string.eh_image_quality),
title = stringResource(SYMR.strings.eh_image_quality_summary),
subtitle = stringResource(SYMR.strings.eh_image_quality),
entries = mapOf(
"auto" to stringResource(R.string.eh_image_quality_auto),
"ovrs_2400" to stringResource(R.string.eh_image_quality_2400),
"ovrs_1600" to stringResource(R.string.eh_image_quality_1600),
"high" to stringResource(R.string.eh_image_quality_1280),
"med" to stringResource(R.string.eh_image_quality_980),
"low" to stringResource(R.string.eh_image_quality_780),
"auto" to stringResource(SYMR.strings.eh_image_quality_auto),
"ovrs_2400" to stringResource(SYMR.strings.eh_image_quality_2400),
"ovrs_1600" to stringResource(SYMR.strings.eh_image_quality_1600),
"high" to stringResource(SYMR.strings.eh_image_quality_1280),
"med" to stringResource(SYMR.strings.eh_image_quality_980),
"low" to stringResource(SYMR.strings.eh_image_quality_780),
),
enabled = exhentaiEnabled,
)
@ -831,8 +832,8 @@ object SettingsEhScreen : SearchableSettings {
fun enhancedEhentaiView(unsortedPreferences: UnsortedPreferences): Preference.PreferenceItem.SwitchPreference {
return Preference.PreferenceItem.SwitchPreference(
pref = unsortedPreferences.enhancedEHentaiView(),
title = stringResource(R.string.pref_enhanced_e_hentai_view),
subtitle = stringResource(R.string.pref_enhanced_e_hentai_view_summary),
title = stringResource(SYMR.strings.pref_enhanced_e_hentai_view),
subtitle = stringResource(SYMR.strings.pref_enhanced_e_hentai_view_summary),
)
}
@ -840,8 +841,8 @@ object SettingsEhScreen : SearchableSettings {
fun readOnlySync(unsortedPreferences: UnsortedPreferences): Preference.PreferenceItem.SwitchPreference {
return Preference.PreferenceItem.SwitchPreference(
pref = unsortedPreferences.exhReadOnlySync(),
title = stringResource(R.string.disable_favorites_uploading),
subtitle = stringResource(R.string.disable_favorites_uploading_summary),
title = stringResource(SYMR.strings.disable_favorites_uploading),
subtitle = stringResource(SYMR.strings.disable_favorites_uploading_summary),
)
}
@ -855,8 +856,8 @@ object SettingsEhScreen : SearchableSettings {
)
}
return Preference.PreferenceItem.TextPreference(
title = stringResource(R.string.show_favorite_sync_notes),
subtitle = stringResource(R.string.show_favorite_sync_notes_summary),
title = stringResource(SYMR.strings.show_favorite_sync_notes),
subtitle = stringResource(SYMR.strings.show_favorite_sync_notes_summary),
onClick = { dialogOpen = true },
)
}
@ -865,8 +866,8 @@ object SettingsEhScreen : SearchableSettings {
fun lenientSync(unsortedPreferences: UnsortedPreferences): Preference.PreferenceItem.SwitchPreference {
return Preference.PreferenceItem.SwitchPreference(
pref = unsortedPreferences.exhLenientSync(),
title = stringResource(R.string.ignore_sync_errors),
subtitle = stringResource(R.string.ignore_sync_errors_summary),
title = stringResource(SYMR.strings.ignore_sync_errors),
subtitle = stringResource(SYMR.strings.ignore_sync_errors_summary),
)
}
@ -878,19 +879,19 @@ object SettingsEhScreen : SearchableSettings {
AlertDialog(
onDismissRequest = onDismissRequest,
title = {
Text(text = stringResource(R.string.favorites_sync_reset))
Text(text = stringResource(SYMR.strings.favorites_sync_reset))
},
text = {
Text(text = stringResource(R.string.favorites_sync_reset_message))
Text(text = stringResource(SYMR.strings.favorites_sync_reset_message))
},
confirmButton = {
TextButton(onClick = onStartReset) {
Text(text = stringResource(R.string.action_ok))
Text(text = stringResource(MR.strings.action_ok))
}
},
dismissButton = {
TextButton(onClick = onDismissRequest) {
Text(text = stringResource(R.string.action_cancel))
Text(text = stringResource(MR.strings.action_cancel))
}
},
properties = DialogProperties(
@ -914,7 +915,7 @@ object SettingsEhScreen : SearchableSettings {
try {
deleteFavoriteEntries.await()
withUIContext {
context.toast(context.getString(R.string.sync_state_reset), Toast.LENGTH_LONG)
context.toast(context.stringResource(SYMR.strings.sync_state_reset), Toast.LENGTH_LONG)
}
} catch (e: Exception) {
this@SettingsEhScreen.logcat(LogPriority.ERROR, e)
@ -924,8 +925,8 @@ object SettingsEhScreen : SearchableSettings {
)
}
return Preference.PreferenceItem.TextPreference(
title = stringResource(R.string.force_sync_state_reset),
subtitle = stringResource(R.string.force_sync_state_reset_summary),
title = stringResource(SYMR.strings.force_sync_state_reset),
subtitle = stringResource(SYMR.strings.force_sync_state_reset_summary),
onClick = {
dialogOpen = true
},
@ -940,26 +941,26 @@ object SettingsEhScreen : SearchableSettings {
val context = LocalContext.current
return Preference.PreferenceItem.ListPreference(
pref = unsortedPreferences.exhAutoUpdateFrequency(),
title = stringResource(R.string.time_between_batches),
title = stringResource(SYMR.strings.time_between_batches),
subtitle = if (value == 0) {
stringResource(R.string.time_between_batches_summary_1, stringResource(R.string.app_name))
stringResource(SYMR.strings.time_between_batches_summary_1, stringResource(MR.strings.app_name))
} else {
stringResource(
R.string.time_between_batches_summary_2,
stringResource(R.string.app_name),
SYMR.strings.time_between_batches_summary_2,
stringResource(MR.strings.app_name),
value,
EHentaiUpdateWorkerConstants.UPDATES_PER_ITERATION,
)
},
entries = mapOf(
0 to stringResource(R.string.time_between_batches_never),
1 to stringResource(R.string.time_between_batches_1_hour),
2 to stringResource(R.string.time_between_batches_2_hours),
3 to stringResource(R.string.time_between_batches_3_hours),
6 to stringResource(R.string.time_between_batches_6_hours),
12 to stringResource(R.string.time_between_batches_12_hours),
24 to stringResource(R.string.time_between_batches_24_hours),
48 to stringResource(R.string.time_between_batches_48_hours),
0 to stringResource(SYMR.strings.time_between_batches_never),
1 to stringResource(SYMR.strings.time_between_batches_1_hour),
2 to stringResource(SYMR.strings.time_between_batches_2_hours),
3 to stringResource(SYMR.strings.time_between_batches_3_hours),
6 to stringResource(SYMR.strings.time_between_batches_6_hours),
12 to stringResource(SYMR.strings.time_between_batches_12_hours),
24 to stringResource(SYMR.strings.time_between_batches_24_hours),
48 to stringResource(SYMR.strings.time_between_batches_48_hours),
),
onValueChanged = { interval ->
EHentaiUpdateWorker.scheduleBackground(context, prefInterval = interval)
@ -976,27 +977,27 @@ object SettingsEhScreen : SearchableSettings {
val context = LocalContext.current
return Preference.PreferenceItem.MultiSelectListPreference(
pref = unsortedPreferences.exhAutoUpdateRequirements(),
title = stringResource(R.string.auto_update_restrictions),
title = stringResource(SYMR.strings.auto_update_restrictions),
subtitle = remember(value) {
context.getString(
R.string.restrictions,
context.stringResource(
MR.strings.restrictions,
value.sorted()
.map {
when (it) {
DEVICE_ONLY_ON_WIFI -> context.getString(R.string.connected_to_wifi)
DEVICE_CHARGING -> context.getString(R.string.charging)
DEVICE_ONLY_ON_WIFI -> context.stringResource(MR.strings.connected_to_wifi)
DEVICE_CHARGING -> context.stringResource(MR.strings.charging)
else -> it
}
}
.ifEmpty {
listOf(context.getString(R.string.none))
listOf(context.stringResource(MR.strings.none))
}
.joinToString(),
)
},
entries = mapOf(
DEVICE_ONLY_ON_WIFI to stringResource(R.string.connected_to_wifi),
DEVICE_CHARGING to stringResource(R.string.charging),
DEVICE_ONLY_ON_WIFI to stringResource(MR.strings.connected_to_wifi),
DEVICE_CHARGING to stringResource(MR.strings.charging),
),
onValueChanged = { restrictions ->
EHentaiUpdateWorker.scheduleBackground(context, prefRestrictions = restrictions)
@ -1019,7 +1020,7 @@ object SettingsEhScreen : SearchableSettings {
shape = MaterialTheme.shapes.medium,
) {
Text(
text = stringResource(R.string.gallery_updater_statistics_collection),
text = stringResource(SYMR.strings.gallery_updater_statistics_collection),
style = MaterialTheme.typography.bodyMedium,
modifier = Modifier.padding(40.dp),
)
@ -1035,14 +1036,14 @@ object SettingsEhScreen : SearchableSettings {
AlertDialog(
onDismissRequest = onDismissRequest,
title = {
Text(text = stringResource(R.string.gallery_updater_statistics))
Text(text = stringResource(SYMR.strings.gallery_updater_statistics))
},
text = {
Text(text = updateInfo)
},
confirmButton = {
TextButton(onClick = onDismissRequest) {
Text(text = stringResource(R.string.action_ok))
Text(text = stringResource(MR.strings.action_ok))
}
},
)
@ -1109,20 +1110,20 @@ object SettingsEhScreen : SearchableSettings {
}
private fun getRelativeTimeString(relativeTime: RelativeTime, context: Context): String {
return relativeTime.years?.let { context.resources.getQuantityString(R.plurals.humanize_year, it.toInt(), it) }
return relativeTime.years?.let { context.pluralStringResource(SYMR.plurals.humanize_year, it.toInt(), it) }
?: relativeTime.months?.let {
context.resources.getQuantityString(R.plurals.humanize_month, it.toInt(), it)
context.pluralStringResource(SYMR.plurals.humanize_month, it.toInt(), it)
}
?: relativeTime.weeks?.let { context.resources.getQuantityString(R.plurals.humanize_week, it.toInt(), it) }
?: relativeTime.days?.let { context.resources.getQuantityString(R.plurals.humanize_day, it.toInt(), it) }
?: relativeTime.hours?.let { context.resources.getQuantityString(R.plurals.humanize_hour, it.toInt(), it) }
?: relativeTime.weeks?.let { context.pluralStringResource(SYMR.plurals.humanize_week, it.toInt(), it) }
?: relativeTime.days?.let { context.pluralStringResource(SYMR.plurals.humanize_day, it.toInt(), it) }
?: relativeTime.hours?.let { context.pluralStringResource(SYMR.plurals.humanize_hour, it.toInt(), it) }
?: relativeTime.minutes?.let {
context.resources.getQuantityString(R.plurals.humanize_minute, it.toInt(), it)
context.pluralStringResource(SYMR.plurals.humanize_minute, it.toInt(), it)
}
?: relativeTime.seconds?.let {
context.resources.getQuantityString(R.plurals.humanize_second, it.toInt(), it)
context.pluralStringResource(SYMR.plurals.humanize_second, it.toInt(), it)
}
?: context.getString(R.string.humanize_fallback)
?: context.stringResource(SYMR.strings.humanize_fallback)
}
data class RelativeTime(
@ -1154,14 +1155,14 @@ object SettingsEhScreen : SearchableSettings {
}
val statsText = if (stats != null) {
context.getString(
R.string.gallery_updater_stats_text,
context.stringResource(
SYMR.strings.gallery_updater_stats_text,
getRelativeTimeString(getRelativeTimeFromNow(stats.startTime.milliseconds), context),
stats.updateCount,
stats.possibleUpdates,
)
} else {
context.getString(R.string.gallery_updater_not_ran_yet)
context.stringResource(SYMR.strings.gallery_updater_not_ran_yet)
}
val allMeta = getExhFavoriteMangaWithMetadata.await()
@ -1177,8 +1178,8 @@ object SettingsEhScreen : SearchableSettings {
}.count()
}
statsText + "\n\n" + context.getString(
R.string.gallery_updater_stats_time,
statsText + "\n\n" + context.stringResource(
SYMR.strings.gallery_updater_stats_time,
metaInRelativeDuration(1.hours),
metaInRelativeDuration(6.hours),
metaInRelativeDuration(12.hours),
@ -1204,7 +1205,7 @@ object SettingsEhScreen : SearchableSettings {
}
}
return Preference.PreferenceItem.TextPreference(
title = stringResource(R.string.show_updater_statistics),
title = stringResource(SYMR.strings.show_updater_statistics),
onClick = {
dialogOpen = true
},

View File

@ -1,6 +1,5 @@
package eu.kanade.presentation.more.settings.screen
import androidx.annotation.StringRes
import androidx.compose.runtime.Composable
import androidx.compose.runtime.ReadOnlyComposable
import androidx.compose.runtime.collectAsState
@ -11,8 +10,6 @@ import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.pluralStringResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.util.fastMap
import androidx.core.content.ContextCompat
import cafe.adriel.voyager.navigator.LocalNavigator
@ -21,7 +18,6 @@ import cafe.adriel.voyager.navigator.currentOrThrow
import eu.kanade.presentation.category.visualName
import eu.kanade.presentation.more.settings.Preference
import eu.kanade.presentation.more.settings.widget.TriStateListDialog
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.library.LibraryUpdateJob
import eu.kanade.tachiyomi.ui.category.CategoryScreen
import eu.kanade.tachiyomi.ui.category.genre.SortTagScreen
@ -40,6 +36,10 @@ import tachiyomi.domain.library.service.LibraryPreferences.Companion.MANGA_HAS_U
import tachiyomi.domain.library.service.LibraryPreferences.Companion.MANGA_NON_COMPLETED
import tachiyomi.domain.library.service.LibraryPreferences.Companion.MANGA_NON_READ
import tachiyomi.domain.library.service.LibraryPreferences.Companion.MANGA_OUTSIDE_RELEASE_PERIOD
import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.i18n.pluralStringResource
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.collectAsState
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
@ -48,15 +48,14 @@ object SettingsLibraryScreen : SearchableSettings {
@Composable
@ReadOnlyComposable
@StringRes
override fun getTitleRes() = R.string.pref_category_library
override fun getTitleRes() = MR.strings.pref_category_library
@Composable
override fun getPreferences(): List<Preference> {
val getCategories = remember { Injekt.get<GetCategories>() }
val libraryPreferences = remember { Injekt.get<LibraryPreferences>() }
val allCategories by getCategories.subscribe().collectAsState(
initial = runBlocking { getCategories.await() }
initial = runBlocking { getCategories.await() },
)
// SY -->
val unsortedPreferences = remember { Injekt.get<UnsortedPreferences>() }
@ -89,16 +88,16 @@ object SettingsLibraryScreen : SearchableSettings {
// For default category
val ids = listOf(libraryPreferences.defaultCategory().defaultValue()) +
allCategories.fastMap { it.id.toInt() }
val labels = listOf(stringResource(R.string.default_category_summary)) +
val labels = listOf(stringResource(MR.strings.default_category_summary)) +
allCategories.fastMap { it.visualName(context) }
return Preference.PreferenceGroup(
title = stringResource(R.string.categories),
title = stringResource(MR.strings.categories),
preferenceItems = listOf(
Preference.PreferenceItem.TextPreference(
title = stringResource(R.string.action_edit_categories),
title = stringResource(MR.strings.action_edit_categories),
subtitle = pluralStringResource(
id = R.plurals.num_categories,
MR.plurals.num_categories,
count = userCategoriesCount,
userCategoriesCount,
),
@ -106,13 +105,13 @@ object SettingsLibraryScreen : SearchableSettings {
),
Preference.PreferenceItem.ListPreference(
pref = libraryPreferences.defaultCategory(),
title = stringResource(R.string.default_category),
subtitle = selectedCategory?.visualName ?: stringResource(R.string.default_category_summary),
title = stringResource(MR.strings.default_category),
subtitle = selectedCategory?.visualName ?: stringResource(MR.strings.default_category_summary),
entries = ids.zip(labels).toMap(),
),
Preference.PreferenceItem.SwitchPreference(
pref = libraryPreferences.categorizedDisplaySettings(),
title = stringResource(R.string.categorized_display_settings),
title = stringResource(MR.strings.categorized_display_settings),
onValueChanged = {
if (!it) {
scope.launch {
@ -144,8 +143,8 @@ object SettingsLibraryScreen : SearchableSettings {
var showCategoriesDialog by rememberSaveable { mutableStateOf(false) }
if (showCategoriesDialog) {
TriStateListDialog(
title = stringResource(R.string.categories),
message = stringResource(R.string.pref_library_update_categories_details),
title = stringResource(MR.strings.categories),
message = stringResource(MR.strings.pref_library_update_categories_details),
items = allCategories,
initialChecked = included.mapNotNull { id -> allCategories.find { it.id.toString() == id } },
initialInversed = excluded.mapNotNull { id -> allCategories.find { it.id.toString() == id } },
@ -160,18 +159,18 @@ object SettingsLibraryScreen : SearchableSettings {
}
return Preference.PreferenceGroup(
title = stringResource(R.string.pref_category_library_update),
title = stringResource(MR.strings.pref_category_library_update),
preferenceItems = listOf(
Preference.PreferenceItem.ListPreference(
pref = autoUpdateIntervalPref,
title = stringResource(R.string.pref_library_update_interval),
title = stringResource(MR.strings.pref_library_update_interval),
entries = mapOf(
0 to stringResource(R.string.update_never),
12 to stringResource(R.string.update_12hour),
24 to stringResource(R.string.update_24hour),
48 to stringResource(R.string.update_48hour),
72 to stringResource(R.string.update_72hour),
168 to stringResource(R.string.update_weekly),
0 to stringResource(MR.strings.update_never),
12 to stringResource(MR.strings.update_12hour),
24 to stringResource(MR.strings.update_24hour),
48 to stringResource(MR.strings.update_48hour),
72 to stringResource(MR.strings.update_72hour),
168 to stringResource(MR.strings.update_weekly),
),
onValueChanged = {
LibraryUpdateJob.setupTask(context, it)
@ -181,12 +180,12 @@ object SettingsLibraryScreen : SearchableSettings {
Preference.PreferenceItem.MultiSelectListPreference(
pref = libraryPreferences.autoUpdateDeviceRestrictions(),
enabled = autoUpdateInterval > 0,
title = stringResource(R.string.pref_library_update_restriction),
subtitle = stringResource(R.string.restrictions),
title = stringResource(MR.strings.pref_library_update_restriction),
subtitle = stringResource(MR.strings.restrictions),
entries = mapOf(
DEVICE_ONLY_ON_WIFI to stringResource(R.string.connected_to_wifi),
DEVICE_NETWORK_NOT_METERED to stringResource(R.string.network_not_metered),
DEVICE_CHARGING to stringResource(R.string.charging),
DEVICE_ONLY_ON_WIFI to stringResource(MR.strings.connected_to_wifi),
DEVICE_NETWORK_NOT_METERED to stringResource(MR.strings.network_not_metered),
DEVICE_CHARGING to stringResource(MR.strings.charging),
),
onValueChanged = {
// Post to event looper to allow the preference to be updated.
@ -195,7 +194,7 @@ object SettingsLibraryScreen : SearchableSettings {
},
),
Preference.PreferenceItem.TextPreference(
title = stringResource(R.string.categories),
title = stringResource(MR.strings.categories),
subtitle = getCategoriesLabel(
allCategories = allCategories,
included = included,
@ -206,33 +205,33 @@ object SettingsLibraryScreen : SearchableSettings {
// SY -->
Preference.PreferenceItem.ListPreference(
pref = libraryPreferences.groupLibraryUpdateType(),
title = stringResource(R.string.library_group_updates),
title = stringResource(SYMR.strings.library_group_updates),
entries = mapOf(
GroupLibraryMode.GLOBAL to stringResource(R.string.library_group_updates_global),
GroupLibraryMode.GLOBAL to stringResource(SYMR.strings.library_group_updates_global),
GroupLibraryMode.ALL_BUT_UNGROUPED to
stringResource(R.string.library_group_updates_all_but_ungrouped),
GroupLibraryMode.ALL to stringResource(R.string.library_group_updates_all),
stringResource(SYMR.strings.library_group_updates_all_but_ungrouped),
GroupLibraryMode.ALL to stringResource(SYMR.strings.library_group_updates_all),
),
),
// SY <--
Preference.PreferenceItem.SwitchPreference(
pref = libraryPreferences.autoUpdateMetadata(),
title = stringResource(R.string.pref_library_update_refresh_metadata),
subtitle = stringResource(R.string.pref_library_update_refresh_metadata_summary),
title = stringResource(MR.strings.pref_library_update_refresh_metadata),
subtitle = stringResource(MR.strings.pref_library_update_refresh_metadata_summary),
),
Preference.PreferenceItem.MultiSelectListPreference(
pref = libraryPreferences.autoUpdateMangaRestrictions(),
title = stringResource(R.string.pref_library_update_manga_restriction),
title = stringResource(MR.strings.pref_library_update_manga_restriction),
entries = mapOf(
MANGA_HAS_UNREAD to stringResource(R.string.pref_update_only_completely_read),
MANGA_NON_READ to stringResource(R.string.pref_update_only_started),
MANGA_NON_COMPLETED to stringResource(R.string.pref_update_only_non_completed),
MANGA_OUTSIDE_RELEASE_PERIOD to stringResource(R.string.pref_update_only_in_release_period),
MANGA_HAS_UNREAD to stringResource(MR.strings.pref_update_only_completely_read),
MANGA_NON_READ to stringResource(MR.strings.pref_update_only_started),
MANGA_NON_COMPLETED to stringResource(MR.strings.pref_update_only_non_completed),
MANGA_OUTSIDE_RELEASE_PERIOD to stringResource(MR.strings.pref_update_only_in_release_period),
),
),
Preference.PreferenceItem.SwitchPreference(
pref = libraryPreferences.newShowUpdatesCount(),
title = stringResource(R.string.pref_library_update_show_tab_badge),
title = stringResource(MR.strings.pref_library_update_show_tab_badge),
),
),
)
@ -243,26 +242,26 @@ object SettingsLibraryScreen : SearchableSettings {
libraryPreferences: LibraryPreferences,
): Preference.PreferenceGroup {
return Preference.PreferenceGroup(
title = stringResource(R.string.pref_chapter_swipe),
title = stringResource(MR.strings.pref_chapter_swipe),
preferenceItems = listOf(
Preference.PreferenceItem.ListPreference(
pref = libraryPreferences.swipeToStartAction(),
title = stringResource(R.string.pref_chapter_swipe_start),
title = stringResource(MR.strings.pref_chapter_swipe_start),
entries = mapOf(
LibraryPreferences.ChapterSwipeAction.Disabled to stringResource(R.string.disabled),
LibraryPreferences.ChapterSwipeAction.ToggleBookmark to stringResource(R.string.action_bookmark),
LibraryPreferences.ChapterSwipeAction.ToggleRead to stringResource(R.string.action_mark_as_read),
LibraryPreferences.ChapterSwipeAction.Download to stringResource(R.string.action_download),
LibraryPreferences.ChapterSwipeAction.Disabled to stringResource(MR.strings.disabled),
LibraryPreferences.ChapterSwipeAction.ToggleBookmark to stringResource(MR.strings.action_bookmark),
LibraryPreferences.ChapterSwipeAction.ToggleRead to stringResource(MR.strings.action_mark_as_read),
LibraryPreferences.ChapterSwipeAction.Download to stringResource(MR.strings.action_download),
),
),
Preference.PreferenceItem.ListPreference(
pref = libraryPreferences.swipeToEndAction(),
title = stringResource(R.string.pref_chapter_swipe_end),
title = stringResource(MR.strings.pref_chapter_swipe_end),
entries = mapOf(
LibraryPreferences.ChapterSwipeAction.Disabled to stringResource(R.string.disabled),
LibraryPreferences.ChapterSwipeAction.ToggleBookmark to stringResource(R.string.action_bookmark),
LibraryPreferences.ChapterSwipeAction.ToggleRead to stringResource(R.string.action_mark_as_read),
LibraryPreferences.ChapterSwipeAction.Download to stringResource(R.string.action_download),
LibraryPreferences.ChapterSwipeAction.Disabled to stringResource(MR.strings.disabled),
LibraryPreferences.ChapterSwipeAction.ToggleBookmark to stringResource(MR.strings.action_bookmark),
LibraryPreferences.ChapterSwipeAction.ToggleRead to stringResource(MR.strings.action_mark_as_read),
LibraryPreferences.ChapterSwipeAction.Download to stringResource(MR.strings.action_download),
),
),
),
@ -274,11 +273,11 @@ object SettingsLibraryScreen : SearchableSettings {
fun getSortingCategory(navigator: Navigator, libraryPreferences: LibraryPreferences): Preference.PreferenceGroup {
val tagCount by libraryPreferences.sortTagsForLibrary().collectAsState()
return Preference.PreferenceGroup(
stringResource(R.string.pref_sorting_settings),
stringResource(SYMR.strings.pref_sorting_settings),
preferenceItems = listOf(
Preference.PreferenceItem.TextPreference(
title = stringResource(R.string.pref_tag_sorting),
subtitle = pluralStringResource(R.plurals.pref_tag_sorting_desc, tagCount.size, tagCount.size),
title = stringResource(SYMR.strings.pref_tag_sorting),
subtitle = pluralStringResource(SYMR.plurals.pref_tag_sorting_desc, tagCount.size, tagCount.size),
onClick = {
navigator.push(SortTagScreen())
},
@ -292,13 +291,13 @@ object SettingsLibraryScreen : SearchableSettings {
val skipPreMigration by unsortedPreferences.skipPreMigration().collectAsState()
val migrationSources by unsortedPreferences.migrationSources().collectAsState()
return Preference.PreferenceGroup(
stringResource(R.string.migration),
stringResource(SYMR.strings.migration),
enabled = skipPreMigration || migrationSources.isNotEmpty(),
preferenceItems = listOf(
Preference.PreferenceItem.SwitchPreference(
pref = unsortedPreferences.skipPreMigration(),
title = stringResource(R.string.skip_pre_migration),
subtitle = stringResource(R.string.pref_skip_pre_migration_summary),
title = stringResource(SYMR.strings.skip_pre_migration),
subtitle = stringResource(SYMR.strings.pref_skip_pre_migration_summary),
),
),
)

View File

@ -1,6 +1,5 @@
package eu.kanade.presentation.more.settings.screen
import androidx.annotation.StringRes
import androidx.compose.foundation.background
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.foundation.layout.padding
@ -34,24 +33,26 @@ import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.core.graphics.ColorUtils
import cafe.adriel.voyager.navigator.LocalNavigator
import cafe.adriel.voyager.navigator.Navigator
import cafe.adriel.voyager.navigator.currentOrThrow
import dev.icerock.moko.resources.StringResource
import eu.kanade.presentation.components.AppBar
import eu.kanade.presentation.components.AppBarActions
import eu.kanade.presentation.more.settings.screen.about.AboutScreen
import eu.kanade.presentation.more.settings.widget.TextPreferenceWidget
import eu.kanade.presentation.util.LocalBackPress
import eu.kanade.presentation.util.Screen
import eu.kanade.tachiyomi.R
import exh.assets.EhAssets
import exh.assets.ehassets.EhLogo
import exh.assets.ehassets.MangadexLogo
import kotlinx.collections.immutable.persistentListOf
import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.i18n.stringResource
import cafe.adriel.voyager.core.screen.Screen as VoyagerScreen
object SettingsMainScreen : Screen() {
@ -88,13 +89,13 @@ object SettingsMainScreen : Screen() {
topBarScrollBehavior = TopAppBarDefaults.pinnedScrollBehavior(topBarState),
topBar = { scrollBehavior ->
AppBar(
title = stringResource(R.string.label_settings),
title = stringResource(MR.strings.label_settings),
navigateUp = backPress::invoke,
actions = {
AppBarActions(
persistentListOf(
AppBar.Action(
title = stringResource(R.string.action_search),
title = stringResource(MR.strings.action_search),
icon = Icons.Outlined.Search,
onClick = { navigator.navigate(SettingsSearchScreen(), twoPane) },
),
@ -171,8 +172,8 @@ object SettingsMainScreen : Screen() {
}
private data class Item(
@StringRes val titleRes: Int,
@StringRes val subtitleRes: Int,
val titleRes: StringResource,
val subtitleRes: StringResource,
val formatSubtitle: @Composable () -> String = { stringResource(subtitleRes) },
val icon: ImageVector,
val screen: VoyagerScreen,
@ -180,78 +181,78 @@ object SettingsMainScreen : Screen() {
private val items = listOf(
Item(
titleRes = R.string.pref_category_appearance,
subtitleRes = R.string.pref_appearance_summary,
titleRes = MR.strings.pref_category_appearance,
subtitleRes = MR.strings.pref_appearance_summary,
icon = Icons.Outlined.Palette,
screen = SettingsAppearanceScreen,
),
Item(
titleRes = R.string.pref_category_library,
subtitleRes = R.string.pref_library_summary,
titleRes = MR.strings.pref_category_library,
subtitleRes = MR.strings.pref_library_summary,
icon = Icons.Outlined.CollectionsBookmark,
screen = SettingsLibraryScreen,
),
Item(
titleRes = R.string.pref_category_reader,
subtitleRes = R.string.pref_reader_summary,
titleRes = MR.strings.pref_category_reader,
subtitleRes = MR.strings.pref_reader_summary,
icon = Icons.AutoMirrored.Outlined.ChromeReaderMode,
screen = SettingsReaderScreen,
),
Item(
titleRes = R.string.pref_category_downloads,
subtitleRes = R.string.pref_downloads_summary,
titleRes = MR.strings.pref_category_downloads,
subtitleRes = MR.strings.pref_downloads_summary,
icon = Icons.Outlined.GetApp,
screen = SettingsDownloadScreen,
),
Item(
titleRes = R.string.pref_category_tracking,
subtitleRes = R.string.pref_tracking_summary,
titleRes = MR.strings.pref_category_tracking,
subtitleRes = MR.strings.pref_tracking_summary,
icon = Icons.Outlined.Sync,
screen = SettingsTrackingScreen,
),
Item(
titleRes = R.string.browse,
subtitleRes = R.string.pref_browse_summary,
titleRes = MR.strings.browse,
subtitleRes = MR.strings.pref_browse_summary,
icon = Icons.Outlined.Explore,
screen = SettingsBrowseScreen,
),
Item(
titleRes = R.string.label_data_storage,
subtitleRes = R.string.pref_backup_summary,
titleRes = MR.strings.label_data_storage,
subtitleRes = MR.strings.pref_backup_summary,
icon = Icons.Outlined.Storage,
screen = SettingsDataScreen,
),
Item(
titleRes = R.string.pref_category_security,
subtitleRes = R.string.pref_security_summary,
titleRes = MR.strings.pref_category_security,
subtitleRes = MR.strings.pref_security_summary,
icon = Icons.Outlined.Security,
screen = SettingsSecurityScreen,
),
// SY -->
Item(
titleRes = R.string.pref_category_eh,
subtitleRes = R.string.pref_ehentai_summary,
titleRes = SYMR.strings.pref_category_eh,
subtitleRes = SYMR.strings.pref_ehentai_summary,
icon = EhAssets.EhLogo,
screen = SettingsEhScreen,
),
Item(
titleRes = R.string.pref_category_mangadex,
subtitleRes = R.string.pref_mangadex_summary,
titleRes = SYMR.strings.pref_category_mangadex,
subtitleRes = SYMR.strings.pref_mangadex_summary,
icon = EhAssets.MangadexLogo,
screen = SettingsMangadexScreen,
),
// SY <--
Item(
titleRes = R.string.pref_category_advanced,
subtitleRes = R.string.pref_advanced_summary,
titleRes = MR.strings.pref_category_advanced,
subtitleRes = MR.strings.pref_advanced_summary,
icon = Icons.Outlined.Code,
screen = SettingsAdvancedScreen,
),
Item(
titleRes = R.string.pref_category_about,
subtitleRes = 0,
titleRes = MR.strings.pref_category_about,
subtitleRes = StringResource(0),
formatSubtitle = {
"${stringResource(R.string.app_name)} ${AboutScreen.getVersionName(withBuildDate = false)}"
"${stringResource(MR.strings.app_name)} ${AboutScreen.getVersionName(withBuildDate = false)}"
},
icon = Icons.Outlined.Info,
screen = AboutScreen,

View File

@ -1,6 +1,5 @@
package eu.kanade.presentation.more.settings.screen
import androidx.annotation.StringRes
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
@ -27,7 +26,6 @@ import androidx.compose.runtime.toMutableStateList
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import eu.kanade.domain.source.service.SourcePreferences
import eu.kanade.domain.track.service.TrackPreferences
@ -46,7 +44,10 @@ import tachiyomi.core.util.lang.launchIO
import tachiyomi.core.util.lang.withUIContext
import tachiyomi.core.util.system.logcat
import tachiyomi.domain.UnsortedPreferences
import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.collectAsState
import tachiyomi.presentation.core.util.secondaryItemAlpha
import uy.kohesive.injekt.Injekt
@ -56,8 +57,7 @@ object SettingsMangadexScreen : SearchableSettings {
@ReadOnlyComposable
@Composable
@StringRes
override fun getTitleRes() = R.string.pref_category_mangadex
override fun getTitleRes() = SYMR.strings.pref_category_mangadex
override fun isEnabled(): Boolean = MdUtil.getEnabledMangaDexs(Injekt.get()).isNotEmpty()
@ -84,16 +84,16 @@ object SettingsMangadexScreen : SearchableSettings {
AlertDialog(
onDismissRequest = onDismissRequest,
title = {
Text(text = stringResource(R.string.logout))
Text(text = stringResource(MR.strings.logout))
},
confirmButton = {
TextButton(onClick = onLogoutRequest) {
Text(text = stringResource(R.string.logout))
Text(text = stringResource(MR.strings.logout))
}
},
dismissButton = {
TextButton(onClick = onDismissRequest) {
Text(text = stringResource(R.string.action_cancel))
Text(text = stringResource(MR.strings.action_cancel))
}
},
)
@ -117,17 +117,17 @@ object SettingsMangadexScreen : SearchableSettings {
try {
if (mdex.logout()) {
withUIContext {
context.toast(R.string.logout_success)
context.toast(MR.strings.logout_success)
}
} else {
withUIContext {
context.toast(R.string.unknown_error)
context.toast(MR.strings.unknown_error)
}
}
} catch (e: Exception) {
logcat(LogPriority.ERROR, e) { "Logout error" }
withUIContext {
context.toast(R.string.unknown_error)
context.toast(MR.strings.unknown_error)
}
}
}
@ -178,8 +178,8 @@ object SettingsMangadexScreen : SearchableSettings {
): Preference.PreferenceItem.ListPreference<String> {
return Preference.PreferenceItem.ListPreference(
pref = unsortedPreferences.preferredMangaDexId(),
title = stringResource(R.string.mangadex_preffered_source),
subtitle = stringResource(R.string.mangadex_preffered_source_summary),
title = stringResource(SYMR.strings.mangadex_preffered_source),
subtitle = stringResource(SYMR.strings.mangadex_preffered_source_summary),
entries = MdUtil.getEnabledMangaDexs(sourcePreferences)
.associate { it.id.toString() to it.toString() },
)
@ -203,7 +203,7 @@ object SettingsMangadexScreen : SearchableSettings {
AlertDialog(
onDismissRequest = onDismissRequest,
title = {
Text(text = stringResource(R.string.mangadex_sync_follows_to_library))
Text(text = stringResource(SYMR.strings.mangadex_sync_follows_to_library))
},
text = {
Column(
@ -236,12 +236,12 @@ object SettingsMangadexScreen : SearchableSettings {
},
confirmButton = {
TextButton(onClick = { onSelectionConfirmed(items.filterIndexed { index, _ -> selection[index] }) }) {
Text(text = stringResource(R.string.action_ok))
Text(text = stringResource(MR.strings.action_ok))
}
},
dismissButton = {
TextButton(onClick = onDismissRequest) {
Text(text = stringResource(R.string.action_cancel))
Text(text = stringResource(MR.strings.action_cancel))
}
},
)
@ -267,8 +267,8 @@ object SettingsMangadexScreen : SearchableSettings {
)
}
return Preference.PreferenceItem.TextPreference(
title = stringResource(R.string.mangadex_sync_follows_to_library),
subtitle = stringResource(R.string.mangadex_sync_follows_to_library_summary),
title = stringResource(SYMR.strings.mangadex_sync_follows_to_library),
subtitle = stringResource(SYMR.strings.mangadex_sync_follows_to_library_summary),
onClick = { dialogOpen = true },
)
}
@ -277,8 +277,8 @@ object SettingsMangadexScreen : SearchableSettings {
fun syncLibraryToMangaDex(): Preference.PreferenceItem.TextPreference {
val context = LocalContext.current
return Preference.PreferenceItem.TextPreference(
title = stringResource(R.string.mangadex_push_favorites_to_mangadex),
subtitle = stringResource(R.string.mangadex_push_favorites_to_mangadex_summary),
title = stringResource(SYMR.strings.mangadex_push_favorites_to_mangadex),
subtitle = stringResource(SYMR.strings.mangadex_push_favorites_to_mangadex_summary),
onClick = {
LibraryUpdateJob.startNow(
context,

View File

@ -1,20 +1,20 @@
package eu.kanade.presentation.more.settings.screen
import android.os.Build
import androidx.annotation.StringRes
import androidx.compose.runtime.Composable
import androidx.compose.runtime.ReadOnlyComposable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.platform.LocalView
import androidx.compose.ui.res.stringResource
import eu.kanade.presentation.more.settings.Preference
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.ui.reader.setting.ReaderBottomButton
import eu.kanade.tachiyomi.ui.reader.setting.ReaderOrientation
import eu.kanade.tachiyomi.ui.reader.setting.ReaderPreferences
import eu.kanade.tachiyomi.ui.reader.setting.ReadingMode
import eu.kanade.tachiyomi.ui.reader.viewer.pager.PagerConfig
import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.collectAsState
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
@ -24,8 +24,7 @@ object SettingsReaderScreen : SearchableSettings {
@ReadOnlyComposable
@Composable
@StringRes
override fun getTitleRes() = R.string.pref_category_reader
override fun getTitleRes() = MR.strings.pref_category_reader
@Composable
override fun getPreferences(): List<Preference> {
@ -36,64 +35,64 @@ object SettingsReaderScreen : SearchableSettings {
return listOf(
Preference.PreferenceItem.ListPreference(
pref = readerPref.defaultReadingMode(),
title = stringResource(R.string.pref_viewer_type),
title = stringResource(MR.strings.pref_viewer_type),
entries = ReadingMode.entries.drop(1)
.associate { it.flagValue to stringResource(it.stringRes) },
),
Preference.PreferenceItem.ListPreference(
pref = readerPref.doubleTapAnimSpeed(),
title = stringResource(R.string.pref_double_tap_anim_speed),
title = stringResource(MR.strings.pref_double_tap_anim_speed),
entries = mapOf(
1 to stringResource(R.string.double_tap_anim_speed_0),
500 to stringResource(R.string.double_tap_anim_speed_normal),
250 to stringResource(R.string.double_tap_anim_speed_fast),
1 to stringResource(MR.strings.double_tap_anim_speed_0),
500 to stringResource(MR.strings.double_tap_anim_speed_normal),
250 to stringResource(MR.strings.double_tap_anim_speed_fast),
),
),
Preference.PreferenceItem.SwitchPreference(
pref = readerPref.showReadingMode(),
title = stringResource(R.string.pref_show_reading_mode),
subtitle = stringResource(R.string.pref_show_reading_mode_summary),
title = stringResource(MR.strings.pref_show_reading_mode),
subtitle = stringResource(MR.strings.pref_show_reading_mode_summary),
),
Preference.PreferenceItem.SwitchPreference(
pref = readerPref.showNavigationOverlayOnStart(),
title = stringResource(R.string.pref_show_navigation_mode),
subtitle = stringResource(R.string.pref_show_navigation_mode_summary),
title = stringResource(MR.strings.pref_show_navigation_mode),
subtitle = stringResource(MR.strings.pref_show_navigation_mode_summary),
),
// SY -->
Preference.PreferenceItem.SwitchPreference(
pref = readerPref.forceHorizontalSeekbar(),
title = stringResource(R.string.pref_force_horz_seekbar),
subtitle = stringResource(R.string.pref_force_horz_seekbar_summary),
title = stringResource(SYMR.strings.pref_force_horz_seekbar),
subtitle = stringResource(SYMR.strings.pref_force_horz_seekbar_summary),
),
Preference.PreferenceItem.SwitchPreference(
pref = readerPref.landscapeVerticalSeekbar(),
title = stringResource(R.string.pref_show_vert_seekbar_landscape),
subtitle = stringResource(R.string.pref_show_vert_seekbar_landscape_summary),
title = stringResource(SYMR.strings.pref_show_vert_seekbar_landscape),
subtitle = stringResource(SYMR.strings.pref_show_vert_seekbar_landscape_summary),
enabled = !forceHorizontalSeekbar,
),
Preference.PreferenceItem.SwitchPreference(
pref = readerPref.leftVerticalSeekbar(),
title = stringResource(R.string.pref_left_handed_vertical_seekbar),
subtitle = stringResource(R.string.pref_left_handed_vertical_seekbar_summary),
title = stringResource(SYMR.strings.pref_left_handed_vertical_seekbar),
subtitle = stringResource(SYMR.strings.pref_left_handed_vertical_seekbar_summary),
enabled = !forceHorizontalSeekbar,
),
// SY <--
Preference.PreferenceItem.SwitchPreference(
pref = readerPref.trueColor(),
title = stringResource(R.string.pref_true_color),
subtitle = stringResource(R.string.pref_true_color_summary),
title = stringResource(MR.strings.pref_true_color),
subtitle = stringResource(MR.strings.pref_true_color_summary),
enabled = Build.VERSION.SDK_INT >= Build.VERSION_CODES.O,
),
/* SY -->
Preference.PreferenceItem.SwitchPreference(
pref = readerPref.pageTransitions(),
title = stringResource(R.string.pref_page_transitions),
title = stringResource(MR.strings.pref_page_transitions),
),
SY <-- */
Preference.PreferenceItem.SwitchPreference(
pref = readerPref.flashOnPageChange(),
title = stringResource(R.string.pref_flash_page),
subtitle = stringResource(R.string.pref_flash_page_summ),
title = stringResource(MR.strings.pref_flash_page),
subtitle = stringResource(MR.strings.pref_flash_page_summ),
),
getDisplayGroup(readerPreferences = readerPref),
getReadingGroup(readerPreferences = readerPref),
@ -116,42 +115,42 @@ object SettingsReaderScreen : SearchableSettings {
val fullscreenPref = readerPreferences.fullscreen()
val fullscreen by fullscreenPref.collectAsState()
return Preference.PreferenceGroup(
title = stringResource(R.string.pref_category_display),
title = stringResource(MR.strings.pref_category_display),
preferenceItems = listOf(
Preference.PreferenceItem.ListPreference(
pref = readerPreferences.defaultOrientationType(),
title = stringResource(R.string.pref_rotation_type),
title = stringResource(MR.strings.pref_rotation_type),
entries = ReaderOrientation.entries.drop(1)
.associate { it.flagValue to stringResource(it.stringRes) },
),
Preference.PreferenceItem.ListPreference(
pref = readerPreferences.readerTheme(),
title = stringResource(R.string.pref_reader_theme),
title = stringResource(MR.strings.pref_reader_theme),
entries = mapOf(
1 to stringResource(R.string.black_background),
2 to stringResource(R.string.gray_background),
0 to stringResource(R.string.white_background),
3 to stringResource(R.string.automatic_background),
1 to stringResource(MR.strings.black_background),
2 to stringResource(MR.strings.gray_background),
0 to stringResource(MR.strings.white_background),
3 to stringResource(MR.strings.automatic_background),
),
),
Preference.PreferenceItem.SwitchPreference(
pref = fullscreenPref,
title = stringResource(R.string.pref_fullscreen),
title = stringResource(MR.strings.pref_fullscreen),
),
Preference.PreferenceItem.SwitchPreference(
pref = readerPreferences.cutoutShort(),
title = stringResource(R.string.pref_cutout_short),
title = stringResource(MR.strings.pref_cutout_short),
enabled = fullscreen &&
Build.VERSION.SDK_INT >= Build.VERSION_CODES.P &&
LocalView.current.rootWindowInsets?.displayCutout != null, // has cutout
),
Preference.PreferenceItem.SwitchPreference(
pref = readerPreferences.keepScreenOn(),
title = stringResource(R.string.pref_keep_screen_on),
title = stringResource(MR.strings.pref_keep_screen_on),
),
Preference.PreferenceItem.SwitchPreference(
pref = readerPreferences.showPageNumber(),
title = stringResource(R.string.pref_show_page_number),
title = stringResource(MR.strings.pref_show_page_number),
),
),
)
@ -160,23 +159,23 @@ object SettingsReaderScreen : SearchableSettings {
@Composable
private fun getReadingGroup(readerPreferences: ReaderPreferences): Preference.PreferenceGroup {
return Preference.PreferenceGroup(
title = stringResource(R.string.pref_category_reading),
title = stringResource(MR.strings.pref_category_reading),
preferenceItems = listOf(
Preference.PreferenceItem.SwitchPreference(
pref = readerPreferences.skipRead(),
title = stringResource(R.string.pref_skip_read_chapters),
title = stringResource(MR.strings.pref_skip_read_chapters),
),
Preference.PreferenceItem.SwitchPreference(
pref = readerPreferences.skipFiltered(),
title = stringResource(R.string.pref_skip_filtered_chapters),
title = stringResource(MR.strings.pref_skip_filtered_chapters),
),
Preference.PreferenceItem.SwitchPreference(
pref = readerPreferences.skipDupe(),
title = stringResource(R.string.pref_skip_dupe_chapters),
title = stringResource(MR.strings.pref_skip_dupe_chapters),
),
Preference.PreferenceItem.SwitchPreference(
pref = readerPreferences.alwaysShowChapterTransition(),
title = stringResource(R.string.pref_always_show_chapter_transition),
title = stringResource(MR.strings.pref_always_show_chapter_transition),
),
),
)
@ -195,63 +194,63 @@ object SettingsReaderScreen : SearchableSettings {
val rotateToFit by rotateToFitPref.collectAsState()
return Preference.PreferenceGroup(
title = stringResource(R.string.pager_viewer),
title = stringResource(MR.strings.pager_viewer),
preferenceItems = listOf(
Preference.PreferenceItem.ListPreference(
pref = navModePref,
title = stringResource(R.string.pref_viewer_nav),
title = stringResource(MR.strings.pref_viewer_nav),
entries = ReaderPreferences.TapZones
.mapIndexed { index, it -> index to stringResource(it) }
.toMap(),
),
Preference.PreferenceItem.ListPreference(
pref = readerPreferences.pagerNavInverted(),
title = stringResource(R.string.pref_read_with_tapping_inverted),
title = stringResource(MR.strings.pref_read_with_tapping_inverted),
entries = mapOf(
ReaderPreferences.TappingInvertMode.NONE to stringResource(R.string.none),
ReaderPreferences.TappingInvertMode.HORIZONTAL to stringResource(R.string.tapping_inverted_horizontal),
ReaderPreferences.TappingInvertMode.VERTICAL to stringResource(R.string.tapping_inverted_vertical),
ReaderPreferences.TappingInvertMode.BOTH to stringResource(R.string.tapping_inverted_both),
ReaderPreferences.TappingInvertMode.NONE to stringResource(MR.strings.none),
ReaderPreferences.TappingInvertMode.HORIZONTAL to stringResource(MR.strings.tapping_inverted_horizontal),
ReaderPreferences.TappingInvertMode.VERTICAL to stringResource(MR.strings.tapping_inverted_vertical),
ReaderPreferences.TappingInvertMode.BOTH to stringResource(MR.strings.tapping_inverted_both),
),
enabled = navMode != 5,
),
Preference.PreferenceItem.ListPreference(
pref = imageScaleTypePref,
title = stringResource(R.string.pref_image_scale_type),
title = stringResource(MR.strings.pref_image_scale_type),
entries = ReaderPreferences.ImageScaleType
.mapIndexed { index, it -> index + 1 to stringResource(it) }
.toMap(),
),
Preference.PreferenceItem.ListPreference(
pref = readerPreferences.zoomStart(),
title = stringResource(R.string.pref_zoom_start),
title = stringResource(MR.strings.pref_zoom_start),
entries = ReaderPreferences.ZoomStart
.mapIndexed { index, it -> index + 1 to stringResource(it) }
.toMap(),
),
Preference.PreferenceItem.SwitchPreference(
pref = readerPreferences.cropBorders(),
title = stringResource(R.string.pref_crop_borders),
title = stringResource(MR.strings.pref_crop_borders),
),
// SY -->
Preference.PreferenceItem.SwitchPreference(
pref = readerPreferences.pageTransitionsPager(),
title = stringResource(R.string.pref_page_transitions),
title = stringResource(MR.strings.pref_page_transitions),
),
// SY <--
Preference.PreferenceItem.SwitchPreference(
pref = readerPreferences.landscapeZoom(),
title = stringResource(R.string.pref_landscape_zoom),
title = stringResource(MR.strings.pref_landscape_zoom),
enabled = imageScaleType == 1,
),
Preference.PreferenceItem.SwitchPreference(
pref = readerPreferences.navigateToPan(),
title = stringResource(R.string.pref_navigate_pan),
title = stringResource(MR.strings.pref_navigate_pan),
enabled = navMode != 5,
),
Preference.PreferenceItem.SwitchPreference(
pref = dualPageSplitPref,
title = stringResource(R.string.pref_dual_page_split),
title = stringResource(MR.strings.pref_dual_page_split),
onValueChanged = {
rotateToFitPref.set(false)
true
@ -259,13 +258,13 @@ object SettingsReaderScreen : SearchableSettings {
),
Preference.PreferenceItem.SwitchPreference(
pref = readerPreferences.dualPageInvertPaged(),
title = stringResource(R.string.pref_dual_page_invert),
subtitle = stringResource(R.string.pref_dual_page_invert_summary),
title = stringResource(MR.strings.pref_dual_page_invert),
subtitle = stringResource(MR.strings.pref_dual_page_invert_summary),
enabled = dualPageSplit,
),
Preference.PreferenceItem.SwitchPreference(
pref = rotateToFitPref,
title = stringResource(R.string.pref_page_rotate),
title = stringResource(MR.strings.pref_page_rotate),
onValueChanged = {
dualPageSplitPref.set(false)
true
@ -273,7 +272,7 @@ object SettingsReaderScreen : SearchableSettings {
),
Preference.PreferenceItem.SwitchPreference(
pref = readerPreferences.dualPageRotateToFitInvert(),
title = stringResource(R.string.pref_page_rotate_invert),
title = stringResource(MR.strings.pref_page_rotate_invert),
enabled = rotateToFit,
),
),
@ -293,29 +292,29 @@ object SettingsReaderScreen : SearchableSettings {
val webtoonSidePadding by webtoonSidePaddingPref.collectAsState()
return Preference.PreferenceGroup(
title = stringResource(R.string.webtoon_viewer),
title = stringResource(MR.strings.webtoon_viewer),
preferenceItems = listOf(
Preference.PreferenceItem.ListPreference(
pref = navModePref,
title = stringResource(R.string.pref_viewer_nav),
title = stringResource(MR.strings.pref_viewer_nav),
entries = ReaderPreferences.TapZones
.mapIndexed { index, it -> index to stringResource(it) }
.toMap(),
),
Preference.PreferenceItem.ListPreference(
pref = readerPreferences.webtoonNavInverted(),
title = stringResource(R.string.pref_read_with_tapping_inverted),
title = stringResource(MR.strings.pref_read_with_tapping_inverted),
entries = mapOf(
ReaderPreferences.TappingInvertMode.NONE to stringResource(R.string.none),
ReaderPreferences.TappingInvertMode.HORIZONTAL to stringResource(R.string.tapping_inverted_horizontal),
ReaderPreferences.TappingInvertMode.VERTICAL to stringResource(R.string.tapping_inverted_vertical),
ReaderPreferences.TappingInvertMode.BOTH to stringResource(R.string.tapping_inverted_both),
ReaderPreferences.TappingInvertMode.NONE to stringResource(MR.strings.none),
ReaderPreferences.TappingInvertMode.HORIZONTAL to stringResource(MR.strings.tapping_inverted_horizontal),
ReaderPreferences.TappingInvertMode.VERTICAL to stringResource(MR.strings.tapping_inverted_vertical),
ReaderPreferences.TappingInvertMode.BOTH to stringResource(MR.strings.tapping_inverted_both),
),
enabled = navMode != 5,
),
Preference.PreferenceItem.SliderPreference(
value = webtoonSidePadding,
title = stringResource(R.string.pref_webtoon_side_padding),
title = stringResource(MR.strings.pref_webtoon_side_padding),
subtitle = numberFormat.format(webtoonSidePadding / 100f),
min = ReaderPreferences.WEBTOON_PADDING_MIN,
max = ReaderPreferences.WEBTOON_PADDING_MAX,
@ -326,41 +325,41 @@ object SettingsReaderScreen : SearchableSettings {
),
Preference.PreferenceItem.ListPreference(
pref = readerPreferences.readerHideThreshold(),
title = stringResource(R.string.pref_hide_threshold),
title = stringResource(MR.strings.pref_hide_threshold),
entries = mapOf(
ReaderPreferences.ReaderHideThreshold.HIGHEST to stringResource(R.string.pref_highest),
ReaderPreferences.ReaderHideThreshold.HIGH to stringResource(R.string.pref_high),
ReaderPreferences.ReaderHideThreshold.LOW to stringResource(R.string.pref_low),
ReaderPreferences.ReaderHideThreshold.LOWEST to stringResource(R.string.pref_lowest),
ReaderPreferences.ReaderHideThreshold.HIGHEST to stringResource(MR.strings.pref_highest),
ReaderPreferences.ReaderHideThreshold.HIGH to stringResource(MR.strings.pref_high),
ReaderPreferences.ReaderHideThreshold.LOW to stringResource(MR.strings.pref_low),
ReaderPreferences.ReaderHideThreshold.LOWEST to stringResource(MR.strings.pref_lowest),
),
),
Preference.PreferenceItem.SwitchPreference(
pref = readerPreferences.cropBordersWebtoon(),
title = stringResource(R.string.pref_crop_borders),
title = stringResource(MR.strings.pref_crop_borders),
),
Preference.PreferenceItem.SwitchPreference(
pref = dualPageSplitPref,
title = stringResource(R.string.pref_dual_page_split),
title = stringResource(MR.strings.pref_dual_page_split),
),
Preference.PreferenceItem.SwitchPreference(
pref = readerPreferences.dualPageInvertWebtoon(),
title = stringResource(R.string.pref_dual_page_invert),
subtitle = stringResource(R.string.pref_dual_page_invert_summary),
title = stringResource(MR.strings.pref_dual_page_invert),
subtitle = stringResource(MR.strings.pref_dual_page_invert_summary),
enabled = dualPageSplit,
),
Preference.PreferenceItem.SwitchPreference(
pref = readerPreferences.webtoonDoubleTapZoomEnabled(),
title = stringResource(R.string.pref_double_tap_zoom),
title = stringResource(MR.strings.pref_double_tap_zoom),
enabled = true,
),
// SY -->
Preference.PreferenceItem.SwitchPreference(
pref = readerPreferences.pageTransitionsWebtoon(),
title = stringResource(R.string.pref_page_transitions),
title = stringResource(MR.strings.pref_page_transitions),
),
Preference.PreferenceItem.SwitchPreference(
pref = readerPreferences.webtoonEnableZoomOut(),
title = stringResource(R.string.enable_zoom_out),
title = stringResource(SYMR.strings.enable_zoom_out),
),
// SY <--
),
@ -371,16 +370,16 @@ object SettingsReaderScreen : SearchableSettings {
@Composable
private fun getContinuousVerticalGroup(readerPreferences: ReaderPreferences): Preference.PreferenceGroup {
return Preference.PreferenceGroup(
title = stringResource(R.string.vertical_plus_viewer),
title = stringResource(MR.strings.vertical_plus_viewer),
preferenceItems = listOf(
Preference.PreferenceItem.SwitchPreference(
pref = readerPreferences.continuousVerticalTappingByPage(),
title = stringResource(R.string.tap_scroll_page),
subtitle = stringResource(R.string.tap_scroll_page_summary),
title = stringResource(SYMR.strings.tap_scroll_page),
subtitle = stringResource(SYMR.strings.tap_scroll_page_summary),
),
Preference.PreferenceItem.SwitchPreference(
pref = readerPreferences.cropBordersContinuousVertical(),
title = stringResource(R.string.pref_crop_borders),
title = stringResource(MR.strings.pref_crop_borders),
),
),
)
@ -392,15 +391,15 @@ object SettingsReaderScreen : SearchableSettings {
val readWithVolumeKeysPref = readerPreferences.readWithVolumeKeys()
val readWithVolumeKeys by readWithVolumeKeysPref.collectAsState()
return Preference.PreferenceGroup(
title = stringResource(R.string.pref_reader_navigation),
title = stringResource(MR.strings.pref_reader_navigation),
preferenceItems = listOf(
Preference.PreferenceItem.SwitchPreference(
pref = readWithVolumeKeysPref,
title = stringResource(R.string.pref_read_with_volume_keys),
title = stringResource(MR.strings.pref_read_with_volume_keys),
),
Preference.PreferenceItem.SwitchPreference(
pref = readerPreferences.readWithVolumeKeysInverted(),
title = stringResource(R.string.pref_read_with_volume_keys_inverted),
title = stringResource(MR.strings.pref_read_with_volume_keys_inverted),
enabled = readWithVolumeKeys,
),
),
@ -410,16 +409,16 @@ object SettingsReaderScreen : SearchableSettings {
@Composable
private fun getActionsGroup(readerPreferences: ReaderPreferences): Preference.PreferenceGroup {
return Preference.PreferenceGroup(
title = stringResource(R.string.pref_reader_actions),
title = stringResource(MR.strings.pref_reader_actions),
preferenceItems = listOf(
Preference.PreferenceItem.SwitchPreference(
pref = readerPreferences.readWithLongTap(),
title = stringResource(R.string.pref_read_with_long_tap),
title = stringResource(MR.strings.pref_read_with_long_tap),
),
Preference.PreferenceItem.SwitchPreference(
pref = readerPreferences.folderPerManga(),
title = stringResource(R.string.pref_create_folder_per_manga),
subtitle = stringResource(R.string.pref_create_folder_per_manga_summary),
title = stringResource(MR.strings.pref_create_folder_per_manga),
subtitle = stringResource(MR.strings.pref_create_folder_per_manga_summary),
),
),
)
@ -429,33 +428,33 @@ object SettingsReaderScreen : SearchableSettings {
@Composable
private fun getPageDownloadingGroup(readerPreferences: ReaderPreferences): Preference.PreferenceGroup {
return Preference.PreferenceGroup(
title = stringResource(R.string.page_downloading),
title = stringResource(SYMR.strings.page_downloading),
preferenceItems = listOf(
Preference.PreferenceItem.ListPreference(
pref = readerPreferences.preloadSize(),
title = stringResource(R.string.reader_preload_amount),
subtitle = stringResource(R.string.reader_preload_amount_summary),
title = stringResource(SYMR.strings.reader_preload_amount),
subtitle = stringResource(SYMR.strings.reader_preload_amount_summary),
entries = mapOf(
4 to stringResource(R.string.reader_preload_amount_4_pages),
6 to stringResource(R.string.reader_preload_amount_6_pages),
8 to stringResource(R.string.reader_preload_amount_8_pages),
10 to stringResource(R.string.reader_preload_amount_10_pages),
12 to stringResource(R.string.reader_preload_amount_12_pages),
14 to stringResource(R.string.reader_preload_amount_14_pages),
16 to stringResource(R.string.reader_preload_amount_16_pages),
20 to stringResource(R.string.reader_preload_amount_20_pages),
4 to stringResource(SYMR.strings.reader_preload_amount_4_pages),
6 to stringResource(SYMR.strings.reader_preload_amount_6_pages),
8 to stringResource(SYMR.strings.reader_preload_amount_8_pages),
10 to stringResource(SYMR.strings.reader_preload_amount_10_pages),
12 to stringResource(SYMR.strings.reader_preload_amount_12_pages),
14 to stringResource(SYMR.strings.reader_preload_amount_14_pages),
16 to stringResource(SYMR.strings.reader_preload_amount_16_pages),
20 to stringResource(SYMR.strings.reader_preload_amount_20_pages),
),
),
Preference.PreferenceItem.ListPreference(
pref = readerPreferences.readerThreads(),
title = stringResource(R.string.download_threads),
subtitle = stringResource(R.string.download_threads_summary),
title = stringResource(SYMR.strings.download_threads),
subtitle = stringResource(SYMR.strings.download_threads_summary),
entries = List(5) { it }.associateWith { it.toString() },
),
Preference.PreferenceItem.ListPreference(
pref = readerPreferences.cacheSize(),
title = stringResource(R.string.reader_cache_size),
subtitle = stringResource(R.string.reader_cache_size_summary),
title = stringResource(SYMR.strings.reader_cache_size),
subtitle = stringResource(SYMR.strings.reader_cache_size_summary),
entries = mapOf(
"50" to "50 MB",
"75" to "75 MB",
@ -477,8 +476,8 @@ object SettingsReaderScreen : SearchableSettings {
),
Preference.PreferenceItem.SwitchPreference(
pref = readerPreferences.aggressivePageLoading(),
title = stringResource(R.string.aggressively_load_pages),
subtitle = stringResource(R.string.aggressively_load_pages_summary),
title = stringResource(SYMR.strings.aggressively_load_pages),
subtitle = stringResource(SYMR.strings.aggressively_load_pages_summary),
),
),
)
@ -488,54 +487,54 @@ object SettingsReaderScreen : SearchableSettings {
private fun getForkSettingsGroup(readerPreferences: ReaderPreferences): Preference.PreferenceGroup {
val pageLayout by readerPreferences.pageLayout().collectAsState()
return Preference.PreferenceGroup(
title = stringResource(R.string.pref_category_fork),
title = stringResource(SYMR.strings.pref_category_fork),
preferenceItems = listOf(
Preference.PreferenceItem.SwitchPreference(
pref = readerPreferences.readerInstantRetry(),
title = stringResource(R.string.skip_queue_on_retry),
subtitle = stringResource(R.string.skip_queue_on_retry_summary),
title = stringResource(SYMR.strings.skip_queue_on_retry),
subtitle = stringResource(SYMR.strings.skip_queue_on_retry_summary),
),
Preference.PreferenceItem.SwitchPreference(
pref = readerPreferences.preserveReadingPosition(),
title = stringResource(R.string.preserve_reading_position),
title = stringResource(SYMR.strings.preserve_reading_position),
),
Preference.PreferenceItem.SwitchPreference(
pref = readerPreferences.useAutoWebtoon(),
title = stringResource(R.string.auto_webtoon_mode),
subtitle = stringResource(R.string.auto_webtoon_mode_summary),
title = stringResource(SYMR.strings.auto_webtoon_mode),
subtitle = stringResource(SYMR.strings.auto_webtoon_mode_summary),
),
Preference.PreferenceItem.MultiSelectListPreference(
pref = readerPreferences.readerBottomButtons(),
title = stringResource(R.string.reader_bottom_buttons),
subtitle = stringResource(R.string.reader_bottom_buttons_summary),
title = stringResource(SYMR.strings.reader_bottom_buttons),
subtitle = stringResource(SYMR.strings.reader_bottom_buttons_summary),
entries = ReaderBottomButton.values()
.associate { it.value to stringResource(it.stringRes) },
),
Preference.PreferenceItem.ListPreference(
pref = readerPreferences.pageLayout(),
title = stringResource(R.string.page_layout),
subtitle = stringResource(R.string.automatic_can_still_switch),
title = stringResource(SYMR.strings.page_layout),
subtitle = stringResource(SYMR.strings.automatic_can_still_switch),
entries = ReaderPreferences.PageLayouts
.mapIndexed { index, it -> index + 1 to stringResource(it) }
.toMap(),
),
Preference.PreferenceItem.SwitchPreference(
pref = readerPreferences.invertDoublePages(),
title = stringResource(R.string.invert_double_pages),
title = stringResource(SYMR.strings.invert_double_pages),
enabled = pageLayout != PagerConfig.PageLayout.SINGLE_PAGE,
),
Preference.PreferenceItem.ListPreference(
pref = readerPreferences.centerMarginType(),
title = stringResource(R.string.center_margin),
subtitle = stringResource(R.string.pref_center_margin_summary),
title = stringResource(SYMR.strings.center_margin),
subtitle = stringResource(SYMR.strings.pref_center_margin_summary),
entries = ReaderPreferences.CenterMarginTypes
.mapIndexed { index, it -> index + 1 to stringResource(it) }
.toMap(),
),
Preference.PreferenceItem.SwitchPreference(
pref = readerPreferences.cacheArchiveMangaOnDisk(),
title = stringResource(R.string.cache_archived_manga_to_disk),
subtitle = stringResource(R.string.cache_archived_manga_to_disk_subtitle),
title = stringResource(SYMR.strings.cache_archived_manga_to_disk),
subtitle = stringResource(SYMR.strings.cache_archived_manga_to_disk_subtitle),
),
),
)

View File

@ -1,6 +1,5 @@
package eu.kanade.presentation.more.settings.screen
import androidx.annotation.StringRes
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
@ -35,8 +34,6 @@ import androidx.compose.ui.input.key.Key
import androidx.compose.ui.input.key.key
import androidx.compose.ui.input.key.onKeyEvent
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.pluralStringResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.text.input.PasswordVisualTransformation
@ -46,14 +43,19 @@ import androidx.compose.ui.window.DialogProperties
import androidx.fragment.app.FragmentActivity
import cafe.adriel.voyager.navigator.LocalNavigator
import cafe.adriel.voyager.navigator.currentOrThrow
import dev.icerock.moko.resources.StringResource
import eu.kanade.presentation.more.settings.Preference
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.core.security.SecurityPreferences
import eu.kanade.tachiyomi.ui.base.delegate.SecureActivityDelegate
import eu.kanade.tachiyomi.ui.category.biometric.BiometricTimesScreen
import eu.kanade.tachiyomi.util.storage.CbzCrypto
import eu.kanade.tachiyomi.util.system.AuthenticatorUtil.authenticate
import eu.kanade.tachiyomi.util.system.AuthenticatorUtil.isAuthenticationSupported
import tachiyomi.core.i18n.stringResource
import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.i18n.pluralStringResource
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.collectAsState
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
@ -62,8 +64,7 @@ object SettingsSecurityScreen : SearchableSettings {
@ReadOnlyComposable
@Composable
@StringRes
override fun getTitleRes() = R.string.pref_category_security
override fun getTitleRes() = MR.strings.pref_category_security
@Composable
override fun getPreferences(): List<Preference> {
@ -81,54 +82,54 @@ object SettingsSecurityScreen : SearchableSettings {
return listOf(
Preference.PreferenceItem.SwitchPreference(
pref = useAuthPref,
title = stringResource(R.string.lock_with_biometrics),
title = stringResource(MR.strings.lock_with_biometrics),
enabled = authSupported,
onValueChanged = {
(context as FragmentActivity).authenticate(
title = context.getString(R.string.lock_with_biometrics),
title = context.stringResource(MR.strings.lock_with_biometrics),
)
},
),
Preference.PreferenceItem.ListPreference(
pref = securityPreferences.lockAppAfter(),
title = stringResource(R.string.lock_when_idle),
title = stringResource(MR.strings.lock_when_idle),
enabled = authSupported && useAuth,
entries = LockAfterValues
.associateWith {
when (it) {
-1 -> stringResource(R.string.lock_never)
0 -> stringResource(R.string.lock_always)
else -> pluralStringResource(id = R.plurals.lock_after_mins, count = it, it)
-1 -> stringResource(MR.strings.lock_never)
0 -> stringResource(MR.strings.lock_always)
else -> pluralStringResource(MR.plurals.lock_after_mins, count = it, it)
}
},
onValueChanged = {
(context as FragmentActivity).authenticate(
title = context.getString(R.string.lock_when_idle),
title = context.stringResource(MR.strings.lock_when_idle),
)
},
),
Preference.PreferenceItem.SwitchPreference(
pref = securityPreferences.hideNotificationContent(),
title = stringResource(R.string.hide_notification_content),
title = stringResource(MR.strings.hide_notification_content),
),
Preference.PreferenceItem.ListPreference(
pref = securityPreferences.secureScreen(),
title = stringResource(R.string.secure_screen),
title = stringResource(MR.strings.secure_screen),
entries = SecurityPreferences.SecureScreenMode.entries
.associateWith { stringResource(it.titleResId) },
.associateWith { stringResource(it.titleRes) },
),
// SY -->
Preference.PreferenceItem.SwitchPreference(
pref = securityPreferences.passwordProtectDownloads(),
title = stringResource(R.string.password_protect_downloads),
subtitle = stringResource(R.string.password_protect_downloads_summary),
title = stringResource(SYMR.strings.password_protect_downloads),
subtitle = stringResource(SYMR.strings.password_protect_downloads_summary),
enabled = isCbzPasswordSet,
),
Preference.PreferenceItem.ListPreference(
pref = securityPreferences.encryptionType(),
title = stringResource(R.string.encryption_type),
entries = SecurityPreferences.EncryptionType.values()
.associateWith { stringResource(it.titleResId) },
title = stringResource(SYMR.strings.encryption_type),
entries = SecurityPreferences.EncryptionType.entries
.associateWith { stringResource(it.titleRes) },
enabled = passwordProtectDownloads,
),
@ -146,14 +147,14 @@ object SettingsSecurityScreen : SearchableSettings {
)
}
Preference.PreferenceItem.TextPreference(
title = stringResource(R.string.set_cbz_zip_password),
title = stringResource(SYMR.strings.set_cbz_zip_password),
onClick = {
dialogOpen = true
},
)
},
Preference.PreferenceItem.TextPreference(
title = stringResource(R.string.delete_cbz_archive_password),
title = stringResource(SYMR.strings.delete_cbz_archive_password),
onClick = {
CbzCrypto.deleteKeyCbz()
securityPreferences.cbzPassword().set("")
@ -164,9 +165,9 @@ object SettingsSecurityScreen : SearchableSettings {
val navigator = LocalNavigator.currentOrThrow
val count by securityPreferences.authenticatorTimeRanges().collectAsState()
Preference.PreferenceItem.TextPreference(
title = stringResource(R.string.action_edit_biometric_lock_times),
title = stringResource(SYMR.strings.action_edit_biometric_lock_times),
subtitle = pluralStringResource(
R.plurals.num_lock_times,
SYMR.plurals.num_lock_times,
count.size,
count.size,
),
@ -190,26 +191,26 @@ object SettingsSecurityScreen : SearchableSettings {
)
}
Preference.PreferenceItem.TextPreference(
title = stringResource(R.string.biometric_lock_days),
subtitle = stringResource(R.string.biometric_lock_days_summary),
title = stringResource(SYMR.strings.biometric_lock_days),
subtitle = stringResource(SYMR.strings.biometric_lock_days_summary),
onClick = { dialogOpen = true },
enabled = useAuth,
)
},
// SY <--
Preference.PreferenceItem.InfoPreference(stringResource(R.string.secure_screen_summary)),
Preference.PreferenceItem.InfoPreference(stringResource(MR.strings.secure_screen_summary)),
)
}
// SY -->
enum class DayOption(val day: Int, val stringRes: Int) {
Sunday(SecureActivityDelegate.LOCK_SUNDAY, R.string.sunday),
Monday(SecureActivityDelegate.LOCK_MONDAY, R.string.monday),
Tuesday(SecureActivityDelegate.LOCK_TUESDAY, R.string.tuesday),
Wednesday(SecureActivityDelegate.LOCK_WEDNESDAY, R.string.wednesday),
Thursday(SecureActivityDelegate.LOCK_THURSDAY, R.string.thursday),
Friday(SecureActivityDelegate.LOCK_FRIDAY, R.string.friday),
Saturday(SecureActivityDelegate.LOCK_SATURDAY, R.string.saturday),
enum class DayOption(val day: Int, val stringRes: StringResource) {
Sunday(SecureActivityDelegate.LOCK_SUNDAY, SYMR.strings.sunday),
Monday(SecureActivityDelegate.LOCK_MONDAY, SYMR.strings.monday),
Tuesday(SecureActivityDelegate.LOCK_TUESDAY, SYMR.strings.tuesday),
Wednesday(SecureActivityDelegate.LOCK_WEDNESDAY, SYMR.strings.wednesday),
Thursday(SecureActivityDelegate.LOCK_THURSDAY, SYMR.strings.thursday),
Friday(SecureActivityDelegate.LOCK_FRIDAY, SYMR.strings.friday),
Saturday(SecureActivityDelegate.LOCK_SATURDAY, SYMR.strings.saturday),
}
@Composable
@ -224,7 +225,7 @@ object SettingsSecurityScreen : SearchableSettings {
}
AlertDialog(
onDismissRequest = onDismissRequest,
title = { Text(text = stringResource(R.string.biometric_lock_days)) },
title = { Text(text = stringResource(SYMR.strings.biometric_lock_days)) },
text = {
LazyColumn {
DayOption.values().forEach { day ->
@ -269,12 +270,12 @@ object SettingsSecurityScreen : SearchableSettings {
)
},
) {
Text(text = stringResource(R.string.action_ok))
Text(text = stringResource(MR.strings.action_ok))
}
},
dismissButton = {
TextButton(onClick = onDismissRequest) {
Text(text = stringResource(R.string.action_cancel))
Text(text = stringResource(MR.strings.action_cancel))
}
},
)
@ -290,15 +291,15 @@ object SettingsSecurityScreen : SearchableSettings {
AlertDialog(
onDismissRequest = onDismissRequest,
title = { Text(text = stringResource(R.string.cbz_archive_password)) },
title = { Text(text = stringResource(SYMR.strings.cbz_archive_password)) },
text = {
TextField(
value = password,
onValueChange = { password = it },
maxLines = 1,
placeholder = { Text(text = stringResource(R.string.password)) },
label = { Text(text = stringResource(R.string.password)) },
placeholder = { Text(text = stringResource(MR.strings.password)) },
label = { Text(text = stringResource(MR.strings.password)) },
trailingIcon = {
IconButton(
onClick = {
@ -344,12 +345,12 @@ object SettingsSecurityScreen : SearchableSettings {
onReturnPassword(password)
},
) {
Text(text = stringResource(R.string.action_ok))
Text(text = stringResource(MR.strings.action_ok))
}
},
dismissButton = {
TextButton(onClick = onDismissRequest) {
Text(text = stringResource(R.string.action_cancel))
Text(text = stringResource(MR.strings.action_cancel))
}
},
)

View File

@ -47,7 +47,7 @@ import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.LinkIcon
import tachiyomi.presentation.core.components.ScrollbarLazyColumn
import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.i18n.localize
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.icons.CustomIcons
import tachiyomi.presentation.core.icons.Discord
import tachiyomi.presentation.core.icons.Facebook
@ -79,7 +79,7 @@ object AboutScreen : Screen() {
Scaffold(
topBar = { scrollBehavior ->
AppBar(
title = localize(MR.strings.pref_category_about),
title = stringResource(MR.strings.pref_category_about),
navigateUp = if (handleBack != null) handleBack::invoke else null,
scrollBehavior = scrollBehavior,
)
@ -94,7 +94,7 @@ object AboutScreen : Screen() {
item {
TextPreferenceWidget(
title = localize(MR.strings.version),
title = stringResource(MR.strings.version),
subtitle = getVersionName(withBuildDate = true),
onPreferenceClick = {
val deviceInfo = CrashLogUtil(context).getDebugInfo()
@ -106,7 +106,7 @@ object AboutScreen : Screen() {
if (BuildConfig.INCLUDE_UPDATER) {
item {
TextPreferenceWidget(
title = localize(MR.strings.check_for_updates),
title = stringResource(MR.strings.check_for_updates),
widget = {
AnimatedVisibility(visible = isCheckingUpdates) {
CircularProgressIndicator(
@ -145,7 +145,7 @@ object AboutScreen : Screen() {
if (!BuildConfig.DEBUG) {
item {
TextPreferenceWidget(
title = localize(MR.string.whats_new),
title = stringResource(MR.strings.whats_new),
// SY -->
onPreferenceClick = { showWhatsNewDialog = true },
// SY <--
@ -155,21 +155,21 @@ object AboutScreen : Screen() {
item {
TextPreferenceWidget(
title = localize(MR.strings.help_translate),
title = stringResource(MR.strings.help_translate),
onPreferenceClick = { uriHandler.openUri("https://tachiyomi.org/docs/contribute#translation") },
)
}
item {
TextPreferenceWidget(
title = localize(MR.strings.licenses),
title = stringResource(MR.strings.licenses),
onPreferenceClick = { navigator.push(OpenSourceLicensesScreen()) },
)
}
item {
TextPreferenceWidget(
title = localize(MR.strings.privacy_policy),
title = stringResource(MR.strings.privacy_policy),
onPreferenceClick = { uriHandler.openUri("https://tachiyomi.org/privacy/") },
)
}
@ -182,7 +182,7 @@ object AboutScreen : Screen() {
horizontalArrangement = Arrangement.Center,
) {
LinkIcon(
label = localize(MR.strings.website),
label = stringResource(MR.strings.website),
icon = Icons.Outlined.Public,
url = "https://tachiyomi.org",
)

View File

@ -17,7 +17,6 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.produceState
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.buildAnnotatedString
@ -31,7 +30,10 @@ import nl.adaptivity.xmlutil.serialization.XML
import nl.adaptivity.xmlutil.serialization.XmlSerialName
import nl.adaptivity.xmlutil.serialization.XmlValue
import tachiyomi.core.util.lang.withIOContext
import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun WhatsNewDialog(onDismissRequest: () -> Unit) {
@ -39,11 +41,11 @@ fun WhatsNewDialog(onDismissRequest: () -> Unit) {
onDismissRequest = onDismissRequest,
confirmButton = {
TextButton(onClick = onDismissRequest) {
Text(text = stringResource(R.string.action_cancel))
Text(text = stringResource(MR.strings.action_cancel))
}
},
title = {
Text(text = stringResource(R.string.whats_new))
Text(text = stringResource(MR.strings.whats_new))
},
text = {
Column {
@ -67,7 +69,7 @@ fun WhatsNewDialog(onDismissRequest: () -> Unit) {
items(changelog.orEmpty()) { changelog ->
Column(Modifier.fillMaxWidth()) {
Text(
text = stringResource(R.string.changelog_version, changelog.version),
text = stringResource(SYMR.strings.changelog_version, changelog.version),
color = MaterialTheme.colorScheme.primary,
fontWeight = FontWeight.Bold,
style = MaterialTheme.typography.titleSmall,

View File

@ -30,7 +30,6 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.compose.ui.util.fastMap
import cafe.adriel.voyager.core.model.StateScreenModel
@ -42,7 +41,6 @@ import eu.kanade.presentation.browse.components.SourceIcon
import eu.kanade.presentation.components.AppBar
import eu.kanade.presentation.components.AppBarActions
import eu.kanade.presentation.util.Screen
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.util.system.toast
import kotlinx.collections.immutable.persistentListOf
import kotlinx.coroutines.flow.collectLatest
@ -54,8 +52,11 @@ import tachiyomi.data.Database
import tachiyomi.domain.source.interactor.GetSourcesWithNonLibraryManga
import tachiyomi.domain.source.model.Source
import tachiyomi.domain.source.model.SourceWithCount
import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.components.LabeledCheckbox
import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.screens.EmptyScreen
import tachiyomi.presentation.core.screens.LoadingScreen
import tachiyomi.presentation.core.util.selectedBackground
@ -90,26 +91,26 @@ class ClearDatabaseScreen : Screen() {
// SY <--
model.clearSelection()
model.hideConfirmation()
context.toast(R.string.clear_database_completed)
context.toast(MR.strings.clear_database_completed)
}
},
) {
Text(text = stringResource(R.string.action_ok))
Text(text = stringResource(MR.strings.action_ok))
}
},
dismissButton = {
TextButton(onClick = model::hideConfirmation) {
Text(text = stringResource(R.string.action_cancel))
Text(text = stringResource(MR.strings.action_cancel))
}
},
text = {
// SY -->
Column {
// SY <--
Text(text = stringResource(R.string.clear_database_confirmation))
Text(text = stringResource(MR.strings.clear_database_confirmation))
// SY -->
LabeledCheckbox(
label = stringResource(R.string.clear_db_exclude_read),
label = stringResource(SYMR.strings.clear_db_exclude_read),
checked = keepReadManga,
onCheckedChange = { keepReadManga = it },
)
@ -122,19 +123,19 @@ class ClearDatabaseScreen : Screen() {
Scaffold(
topBar = { scrollBehavior ->
AppBar(
title = stringResource(R.string.pref_clear_database),
title = stringResource(MR.strings.pref_clear_database),
navigateUp = navigator::pop,
actions = {
if (s.items.isNotEmpty()) {
AppBarActions(
actions = persistentListOf(
AppBar.Action(
title = stringResource(R.string.action_select_all),
title = stringResource(MR.strings.action_select_all),
icon = Icons.Outlined.SelectAll,
onClick = model::selectAll,
),
AppBar.Action(
title = stringResource(R.string.action_select_all),
title = stringResource(MR.strings.action_select_all),
icon = Icons.Outlined.FlipToBack,
onClick = model::invertSelection,
),
@ -148,7 +149,7 @@ class ClearDatabaseScreen : Screen() {
) { contentPadding ->
if (s.items.isEmpty()) {
EmptyScreen(
message = stringResource(R.string.database_clean),
message = stringResource(MR.strings.database_clean),
modifier = Modifier.padding(contentPadding),
)
} else {
@ -180,7 +181,7 @@ class ClearDatabaseScreen : Screen() {
enabled = s.selection.isNotEmpty(),
) {
Text(
text = stringResource(R.string.action_delete),
text = stringResource(MR.strings.action_delete),
color = MaterialTheme.colorScheme.onPrimary,
)
}
@ -216,7 +217,7 @@ class ClearDatabaseScreen : Screen() {
text = source.visualName,
style = MaterialTheme.typography.bodyMedium,
)
Text(text = stringResource(R.string.clear_database_source_item_count, count))
Text(text = stringResource(MR.strings.clear_database_source_item_count, count))
}
Checkbox(
checked = isSelected,

View File

@ -22,7 +22,6 @@ import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import cafe.adriel.voyager.core.model.StateScreenModel
import cafe.adriel.voyager.core.model.rememberScreenModel
@ -30,7 +29,6 @@ import cafe.adriel.voyager.navigator.LocalNavigator
import cafe.adriel.voyager.navigator.currentOrThrow
import eu.kanade.presentation.components.AppBar
import eu.kanade.presentation.util.Screen
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.backup.BackupCreateFlags
import eu.kanade.tachiyomi.data.backup.BackupCreateJob
import eu.kanade.tachiyomi.data.backup.models.Backup
@ -41,9 +39,12 @@ import kotlinx.collections.immutable.minus
import kotlinx.collections.immutable.plus
import kotlinx.collections.immutable.toPersistentSet
import kotlinx.coroutines.flow.update
import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.components.LabeledCheckbox
import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.i18n.stringResource
class CreateBackupScreen : Screen() {
@ -71,7 +72,7 @@ class CreateBackupScreen : Screen() {
Scaffold(
topBar = {
AppBar(
title = stringResource(R.string.pref_create_backup),
title = stringResource(MR.strings.pref_create_backup),
navigateUp = navigator::pop,
scrollBehavior = it,
)
@ -89,7 +90,7 @@ class CreateBackupScreen : Screen() {
) {
item {
LabeledCheckbox(
label = stringResource(R.string.manga),
label = stringResource(MR.strings.manga),
checked = true,
onCheckedChange = {},
enabled = false,
@ -117,20 +118,20 @@ class CreateBackupScreen : Screen() {
onClick = {
if (!BackupCreateJob.isManualJobRunning(context)) {
if (DeviceUtil.isMiui && DeviceUtil.isMiuiOptimizationDisabled()) {
context.toast(R.string.restore_miui_warning, Toast.LENGTH_LONG)
context.toast(MR.strings.restore_miui_warning, Toast.LENGTH_LONG)
}
try {
chooseBackupDir.launch(Backup.getFilename())
} catch (e: ActivityNotFoundException) {
context.toast(R.string.file_picker_error)
context.toast(MR.strings.file_picker_error)
}
} else {
context.toast(R.string.backup_in_progress)
context.toast(MR.strings.backup_in_progress)
}
},
) {
Text(
text = stringResource(R.string.action_create),
text = stringResource(MR.strings.action_create),
color = MaterialTheme.colorScheme.onPrimary,
)
}
@ -163,14 +164,14 @@ private class CreateBackupScreenModel : StateScreenModel<CreateBackupScreenModel
}
private val BackupChoices = mapOf(
BackupCreateFlags.BACKUP_CATEGORY to R.string.categories,
BackupCreateFlags.BACKUP_CHAPTER to R.string.chapters,
BackupCreateFlags.BACKUP_TRACK to R.string.track,
BackupCreateFlags.BACKUP_HISTORY to R.string.history,
BackupCreateFlags.BACKUP_APP_PREFS to R.string.app_settings,
BackupCreateFlags.BACKUP_SOURCE_PREFS to R.string.source_settings,
BackupCreateFlags.BACKUP_CATEGORY to MR.strings.categories,
BackupCreateFlags.BACKUP_CHAPTER to MR.strings.chapters,
BackupCreateFlags.BACKUP_TRACK to MR.strings.track,
BackupCreateFlags.BACKUP_HISTORY to MR.strings.history,
BackupCreateFlags.BACKUP_APP_PREFS to MR.strings.app_settings,
BackupCreateFlags.BACKUP_SOURCE_PREFS to MR.strings.source_settings,
// SY -->
BackupCreateFlags.BACKUP_CUSTOM_INFO to R.string.custom_entry_info,
BackupCreateFlags.BACKUP_READ_MANGA to R.string.all_read_entries,
BackupCreateFlags.BACKUP_CUSTOM_INFO to SYMR.strings.custom_entry_info,
BackupCreateFlags.BACKUP_READ_MANGA to SYMR.strings.all_read_entries,
// SY <--
)

View File

@ -19,6 +19,7 @@ import eu.kanade.tachiyomi.ui.reader.setting.ReaderSettingsScreenModel
import eu.kanade.tachiyomi.util.lang.toRelativeString
import exh.metadata.MetadataUtil
import exh.source.isEhBasedManga
import kotlinx.collections.immutable.ImmutableList
import tachiyomi.domain.chapter.model.Chapter
import tachiyomi.domain.library.service.LibraryPreferences
import java.util.Date
@ -27,7 +28,7 @@ import java.util.Date
fun ChapterListDialog(
onDismissRequest: () -> Unit,
screenModel: ReaderSettingsScreenModel,
chapters: List<ReaderChapterItem>,
chapters: ImmutableList<ReaderChapterItem>,
onClickChapter: (Chapter) -> Unit,
onBookmark: (Chapter) -> Unit,
dateRelativeTime: Boolean,

View File

@ -18,12 +18,13 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import eu.kanade.presentation.components.AdaptiveSheet
import eu.kanade.tachiyomi.R
import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.components.ActionButton
import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun ReaderPageActionsDialog(
@ -54,9 +55,9 @@ fun ReaderPageActionsDialog(
title = stringResource(
// SY -->
if (hasExtraPage) {
R.string.action_set_first_page_cover
SYMR.strings.action_set_first_page_cover
} else {
R.string.set_as_cover
MR.strings.set_as_cover
},
// SY <--
),
@ -68,9 +69,9 @@ fun ReaderPageActionsDialog(
title = stringResource(
// SY -->
if (hasExtraPage) {
R.string.action_share_first_page
SYMR.strings.action_share_first_page
} else {
R.string.action_share
MR.strings.action_share
},
// SY <--
),
@ -88,9 +89,9 @@ fun ReaderPageActionsDialog(
title = stringResource(
// SY -->
if (hasExtraPage) {
R.string.action_save_first_page
SYMR.strings.action_save_first_page
} else {
R.string.action_save
MR.strings.action_save
},
// SY <--
),
@ -109,7 +110,7 @@ fun ReaderPageActionsDialog(
) {
ActionButton(
modifier = Modifier.weight(1f),
title = stringResource(R.string.action_set_second_page_cover),
title = stringResource(SYMR.strings.action_set_second_page_cover),
icon = Icons.Outlined.Photo,
onClick = {
showSetCoverDialog = true
@ -117,7 +118,7 @@ fun ReaderPageActionsDialog(
)
ActionButton(
modifier = Modifier.weight(1f),
title = stringResource(R.string.action_share_second_page),
title = stringResource(SYMR.strings.action_share_second_page),
icon = Icons.Outlined.Share,
onClick = {
onShare(true)
@ -126,7 +127,7 @@ fun ReaderPageActionsDialog(
)
ActionButton(
modifier = Modifier.weight(1f),
title = stringResource(R.string.action_save_second_page),
title = stringResource(SYMR.strings.action_save_second_page),
icon = Icons.Outlined.Save,
onClick = {
onSave(true)
@ -139,7 +140,7 @@ fun ReaderPageActionsDialog(
) {
ActionButton(
modifier = Modifier.weight(1f),
title = stringResource(R.string.action_share_combined_page),
title = stringResource(SYMR.strings.action_share_combined_page),
icon = Icons.Outlined.Share,
onClick = {
onShareCombined()
@ -148,7 +149,7 @@ fun ReaderPageActionsDialog(
)
ActionButton(
modifier = Modifier.weight(1f),
title = stringResource(R.string.action_save_combined_page),
title = stringResource(SYMR.strings.action_save_combined_page),
icon = Icons.Outlined.Save,
onClick = {
onSaveCombined()
@ -181,16 +182,16 @@ private fun SetCoverDialog(
) {
AlertDialog(
text = {
Text(stringResource(R.string.confirm_set_image_as_cover))
Text(stringResource(MR.strings.confirm_set_image_as_cover))
},
confirmButton = {
TextButton(onClick = onConfirm) {
Text(stringResource(R.string.action_ok))
Text(stringResource(MR.strings.action_ok))
}
},
dismissButton = {
TextButton(onClick = onDismiss) {
Text(stringResource(R.string.action_cancel))
Text(stringResource(MR.strings.action_cancel))
}
},
onDismissRequest = onDismiss,

View File

@ -22,13 +22,15 @@ import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.ui.reader.setting.ReaderBottomButton
import eu.kanade.tachiyomi.ui.reader.setting.ReaderOrientation
import eu.kanade.tachiyomi.ui.reader.setting.ReadingMode
import kotlinx.collections.immutable.ImmutableSet
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.localize
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun BottomReaderBar(
// SY -->
enabledButtons: Set<String>,
enabledButtons: ImmutableSet<String>,
// SY <--
backgroundColor: Color,
readingMode: ReadingMode,
@ -61,7 +63,7 @@ fun BottomReaderBar(
IconButton(onClick = onClickChapterList) {
Icon(
imageVector = Icons.Outlined.FormatListNumbered,
contentDescription = localize(MR.strings.chapters),
contentDescription = stringResource(MR.strings.chapters),
)
}
}
@ -70,7 +72,7 @@ fun BottomReaderBar(
IconButton(onClick = onClickWebView) {
Icon(
imageVector = Icons.Outlined.Public,
contentDescription = localize(MR.strings.action_open_in_web_view),
contentDescription = stringResource(MR.strings.action_open_in_web_view),
)
}
}
@ -79,7 +81,7 @@ fun BottomReaderBar(
IconButton(onClick = onClickShare) {
Icon(
imageVector = Icons.Outlined.Share,
contentDescription = localize(MR.strings.action_share),
contentDescription = stringResource(MR.strings.action_share),
)
}
}
@ -88,7 +90,7 @@ fun BottomReaderBar(
IconButton(onClick = onClickReadingMode) {
Icon(
painter = painterResource(readingMode.iconRes),
contentDescription = localize(MR.strings.viewer),
contentDescription = stringResource(MR.strings.viewer),
)
}
}
@ -97,7 +99,7 @@ fun BottomReaderBar(
IconButton(onClick = onClickOrientation) {
Icon(
painter = painterResource(orientation.iconRes),
contentDescription = localize(MR.strings.pref_rotation_type),
contentDescription = stringResource(MR.strings.pref_rotation_type),
)
}
}
@ -111,7 +113,7 @@ fun BottomReaderBar(
IconButton(onClick = onClickCropBorder) {
Icon(
painter = painterResource(if (cropEnabled) R.drawable.ic_crop_24dp else R.drawable.ic_crop_off_24dp),
contentDescription = localize(MR.strings.pref_crop_borders),
contentDescription = stringResource(MR.strings.pref_crop_borders),
)
}
}
@ -124,7 +126,7 @@ fun BottomReaderBar(
IconButton(onClick = onClickPageLayout) {
Icon(
painter = painterResource(R.drawable.ic_book_open_variant_24dp),
contentDescription = localize(MR.strings.page_layout),
contentDescription = stringResource(SYMR.strings.page_layout),
)
}
}
@ -133,7 +135,7 @@ fun BottomReaderBar(
IconButton(onClick = onClickShiftPage) {
Icon(
painter = painterResource(R.drawable.ic_page_next_outline_24dp),
contentDescription = localize(MR.strings.shift_double_pages),
contentDescription = stringResource(SYMR.strings.shift_double_pages),
)
}
}
@ -141,7 +143,7 @@ fun BottomReaderBar(
IconButton(onClick = onClickSettings) {
Icon(
imageVector = Icons.Outlined.Settings,
contentDescription = localize(MR.stringss.action_settings),
contentDescription = stringResource(MR.strings.action_settings),
)
}
// SY <--

View File

@ -32,18 +32,17 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.tooling.preview.PreviewLightDark
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import eu.kanade.tachiyomi.R
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun ExhUtils(
modifier: Modifier = Modifier,
isVisible: Boolean,
onSetExhUtilsVisibility: (Boolean) -> Unit,
backgroundColor: Color,
@ -57,6 +56,7 @@ fun ExhUtils(
onClickRetryAllHelp: () -> Unit,
onClickBoostPage: () -> Unit,
onClickBoostPageHelp: () -> Unit,
modifier: Modifier = Modifier,
) {
Column(
modifier
@ -80,7 +80,7 @@ fun ExhUtils(
verticalAlignment = Alignment.CenterVertically,
) {
Text(
text = stringResource(R.string.eh_autoscroll),
text = stringResource(SYMR.strings.eh_autoscroll),
color = MaterialTheme.colorScheme.onSurface,
fontSize = 13.sp,
fontFamily = FontFamily.SansSerif,
@ -123,7 +123,7 @@ fun ExhUtils(
)
AnimatedVisibility(!isAutoScrollEnabled) {
Text(
text = stringResource(R.string.eh_autoscroll_freq_invalid),
text = stringResource(SYMR.strings.eh_autoscroll_freq_invalid),
color = MaterialTheme.colorScheme.error,
style = MaterialTheme.typography.labelSmall,
)
@ -156,7 +156,7 @@ fun ExhUtils(
modifier = Modifier.weight(3f),
) {
Text(
text = stringResource(R.string.eh_retry_all),
text = stringResource(SYMR.strings.eh_retry_all),
color = MaterialTheme.colorScheme.onSurface,
fontSize = 13.sp,
fontFamily = FontFamily.SansSerif,
@ -184,7 +184,7 @@ fun ExhUtils(
modifier = Modifier.weight(3f),
) {
Text(
text = stringResource(R.string.eh_boost_page),
text = stringResource(SYMR.strings.eh_boost_page),
color = MaterialTheme.colorScheme.onSurface,
fontSize = 13.sp,
fontFamily = FontFamily.SansSerif,

View File

@ -33,7 +33,7 @@ import eu.kanade.tachiyomi.ui.reader.setting.ReaderOrientation
import eu.kanade.tachiyomi.ui.reader.setting.ReadingMode
import eu.kanade.tachiyomi.ui.reader.viewer.Viewer
import eu.kanade.tachiyomi.ui.reader.viewer.pager.R2LPagerViewer
import kotlinx.collections.immutable.persistentListOf
import kotlinx.collections.immutable.ImmutableSet
private val animationSpec = tween<IntOffset>(200)
@ -106,7 +106,7 @@ fun ReaderAppBars(
onClickBoostPageHelp: () -> Unit,
navBarType: NavBarType,
currentPageText: String,
enabledButtons: Set<String>,
enabledButtons: ImmutableSet<String>,
dualPageSplitEnabled: Boolean,
doublePages: Boolean,
onClickChapterList: () -> Unit,
@ -215,20 +215,20 @@ fun ReaderAppBars(
listOfNotNull(
AppBar.Action(
title = stringResource(
if (bookmarked) R.string.action_remove_bookmark else R.string.action_bookmark
if (bookmarked) MR.strings.action_remove_bookmark else MR.strings.action_bookmark
),
icon = if (bookmarked) Icons.Outlined.Bookmark else Icons.Outlined.BookmarkBorder,
onClick = onToggleBookmarked,
),
onOpenInWebView?.let {
AppBar.OverflowAction(
title = stringResource(R.string.action_open_in_web_view),
title = stringResource(MR.strings.action_open_in_web_view),
onClick = it,
)
},
onShare?.let {
AppBar.OverflowAction(
title = stringResource(R.string.action_share),
title = stringResource(MR.strings.action_share),
onClick = it,
)
},

View File

@ -36,12 +36,12 @@ import androidx.compose.ui.hapticfeedback.HapticFeedbackType
import androidx.compose.ui.layout.layout
import androidx.compose.ui.platform.LocalHapticFeedback
import androidx.compose.ui.platform.LocalLayoutDirection
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.Constraints
import androidx.compose.ui.unit.LayoutDirection
import androidx.compose.ui.unit.dp
import eu.kanade.presentation.util.isTabletUi
import eu.kanade.tachiyomi.R
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.stringResource
import kotlin.math.roundToInt
@Composable
@ -104,7 +104,7 @@ fun ChapterNavigator(
Icon(
imageVector = Icons.Outlined.SkipPrevious,
contentDescription = stringResource(
if (isRtl) R.string.action_next_chapter else R.string.action_previous_chapter,
if (isRtl) MR.strings.action_next_chapter else MR.strings.action_previous_chapter,
),
)
}
@ -158,7 +158,7 @@ fun ChapterNavigator(
Icon(
imageVector = Icons.Outlined.SkipNext,
contentDescription = stringResource(
if (isRtl) R.string.action_previous_chapter else R.string.action_next_chapter,
if (isRtl) MR.strings.action_previous_chapter else MR.strings.action_next_chapter,
),
)
}
@ -206,7 +206,7 @@ fun ChapterNavigatorVert(
) {
Icon(
imageVector = Icons.Outlined.SkipPrevious,
contentDescription = stringResource(R.string.action_previous_chapter),
contentDescription = stringResource(MR.strings.action_previous_chapter),
modifier = Modifier.rotate(90f),
)
}
@ -274,7 +274,7 @@ fun ChapterNavigatorVert(
) {
Icon(
imageVector = Icons.Outlined.SkipNext,
contentDescription = stringResource(R.string.action_next_chapter),
contentDescription = stringResource(MR.strings.action_next_chapter),
modifier = Modifier.rotate(90f),
)
}

View File

@ -5,24 +5,25 @@ import androidx.compose.material3.FilterChip
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.res.stringResource
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.ui.reader.setting.ReaderSettingsScreenModel
import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.components.CheckboxItem
import tachiyomi.presentation.core.components.SettingsChipRow
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.collectAsState
private val themes = listOf(
R.string.black_background to 1,
R.string.gray_background to 2,
R.string.white_background to 0,
R.string.automatic_background to 3,
MR.strings.black_background to 1,
MR.strings.gray_background to 2,
MR.strings.white_background to 0,
MR.strings.automatic_background to 3,
)
@Composable
internal fun ColumnScope.GeneralPage(screenModel: ReaderSettingsScreenModel) {
val readerTheme by screenModel.preferences.readerTheme().collectAsState()
SettingsChipRow(R.string.pref_reader_theme) {
SettingsChipRow(MR.strings.pref_reader_theme) {
themes.map { (labelRes, value) ->
FilterChip(
selected = readerTheme == value,
@ -33,71 +34,71 @@ internal fun ColumnScope.GeneralPage(screenModel: ReaderSettingsScreenModel) {
}
CheckboxItem(
label = stringResource(R.string.pref_show_page_number),
label = stringResource(MR.strings.pref_show_page_number),
pref = screenModel.preferences.showPageNumber(),
)
// SY -->
val forceHorizontalSeekbar by screenModel.preferences.forceHorizontalSeekbar().collectAsState()
CheckboxItem(
label = stringResource(R.string.pref_force_horz_seekbar),
label = stringResource(SYMR.strings.pref_force_horz_seekbar),
pref = screenModel.preferences.forceHorizontalSeekbar(),
)
if (!forceHorizontalSeekbar) {
CheckboxItem(
label = stringResource(R.string.pref_show_vert_seekbar_landscape),
label = stringResource(SYMR.strings.pref_show_vert_seekbar_landscape),
pref = screenModel.preferences.landscapeVerticalSeekbar(),
)
CheckboxItem(
label = stringResource(R.string.pref_left_handed_vertical_seekbar),
label = stringResource(SYMR.strings.pref_left_handed_vertical_seekbar),
pref = screenModel.preferences.leftVerticalSeekbar(),
)
}
// SY <--
CheckboxItem(
label = stringResource(R.string.pref_fullscreen),
label = stringResource(MR.strings.pref_fullscreen),
pref = screenModel.preferences.fullscreen(),
)
if (screenModel.hasDisplayCutout) {
CheckboxItem(
label = stringResource(R.string.pref_cutout_short),
label = stringResource(MR.strings.pref_cutout_short),
pref = screenModel.preferences.cutoutShort(),
)
}
CheckboxItem(
label = stringResource(R.string.pref_keep_screen_on),
label = stringResource(MR.strings.pref_keep_screen_on),
pref = screenModel.preferences.keepScreenOn(),
)
CheckboxItem(
label = stringResource(R.string.pref_read_with_long_tap),
label = stringResource(MR.strings.pref_read_with_long_tap),
pref = screenModel.preferences.readWithLongTap(),
)
CheckboxItem(
label = stringResource(R.string.pref_always_show_chapter_transition),
label = stringResource(MR.strings.pref_always_show_chapter_transition),
pref = screenModel.preferences.alwaysShowChapterTransition(),
)
// SY -->
/*CheckboxItem(
label = stringResource(R.string.pref_page_transitions),
label = stringResource(MR.strings.pref_page_transitions),
pref = screenModel.preferences.pageTransitions(),
) SY <-- */
CheckboxItem(
label = stringResource(R.string.pref_flash_page),
label = stringResource(MR.strings.pref_flash_page),
pref = screenModel.preferences.flashOnPageChange(),
)
// SY -->
CheckboxItem(
label = stringResource(R.string.auto_webtoon_mode),
label = stringResource(SYMR.strings.auto_webtoon_mode),
pref = screenModel.preferences.useAutoWebtoon(),
)
// SY <--

View File

@ -15,6 +15,7 @@ import eu.kanade.tachiyomi.ui.reader.setting.ReaderSettingsScreenModel
import eu.kanade.tachiyomi.ui.reader.setting.ReadingMode
import eu.kanade.tachiyomi.ui.reader.viewer.webtoon.WebtoonViewer
import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.components.CheckboxItem
import tachiyomi.presentation.core.components.HeadingItem
import tachiyomi.presentation.core.components.SettingsChipRow
@ -98,7 +99,7 @@ private fun ColumnScope.PagerViewerSettings(screenModel: ReaderSettingsScreenMod
// SY -->
val pageLayout by screenModel.preferences.pageLayout().collectAsState()
SettingsChipRow(R.string.page_layout) {
SettingsChipRow(SYMR.strings.page_layout) {
ReaderPreferences.PageLayouts.mapIndexed { index, it ->
FilterChip(
selected = pageLayout == index,
@ -152,17 +153,17 @@ private fun ColumnScope.PagerViewerSettings(screenModel: ReaderSettingsScreenMod
// SY -->
CheckboxItem(
label = stringResource(R.string.pref_page_transitions),
label = stringResource(MR.strings.pref_page_transitions),
pref = screenModel.preferences.pageTransitionsPager(),
)
CheckboxItem(
label = stringResource(R.string.invert_double_pages),
label = stringResource(SYMR.strings.invert_double_pages),
pref = screenModel.preferences.invertDoublePages(),
)
val centerMarginType by screenModel.preferences.centerMarginType().collectAsState()
SettingsChipRow(R.string.pref_center_margin) {
SettingsChipRow(SYMR.strings.pref_center_margin) {
ReaderPreferences.CenterMarginTypes.mapIndexed { index, it ->
FilterChip(
selected = centerMarginType == index,
@ -208,17 +209,17 @@ private fun ColumnScope.WebtoonViewerSettings(screenModel: ReaderSettingsScreenM
// SY -->
CheckboxItem(
label = stringResource(R.string.pref_smooth_scroll),
label = stringResource(SYMR.strings.pref_smooth_scroll),
pref = screenModel.preferences.smoothAutoScroll(),
)
CheckboxItem(
label = stringResource(R.string.pref_page_transitions),
label = stringResource(MR.strings.pref_page_transitions),
pref = screenModel.preferences.pageTransitionsWebtoon(),
)
CheckboxItem(
label = stringResource(R.string.enable_zoom_out),
label = stringResource(SYMR.strings.enable_zoom_out),
pref = screenModel.preferences.webtoonEnableZoomOut(),
)
// SY <--
@ -245,10 +246,10 @@ private fun ColumnScope.WebtoonViewerSettings(screenModel: ReaderSettingsScreenM
// SY -->
@Composable
private fun ColumnScope.WebtoonWithGapsViewerSettings(screenModel: ReaderSettingsScreenModel) {
HeadingItem(R.string.vertical_plus_viewer)
HeadingItem(MR.strings.vertical_plus_viewer)
CheckboxItem(
label = stringResource(R.string.pref_crop_borders),
label = stringResource(MR.strings.pref_crop_borders),
pref = screenModel.preferences.cropBordersContinuousVertical(),
)
}

View File

@ -28,7 +28,6 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Dialog
import com.google.accompanist.web.AccompanistWebViewClient
@ -39,10 +38,12 @@ import com.google.accompanist.web.rememberWebViewNavigator
import com.google.accompanist.web.rememberWebViewState
import eu.kanade.presentation.components.AppBar
import eu.kanade.tachiyomi.BuildConfig
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.util.system.setDefaultSettings
import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.components.material.Button
import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun EhLoginWebViewScreen(
@ -81,9 +82,10 @@ fun EhLoginWebViewScreen(
val animatedProgress by animateFloatAsState(
(loadingState as? LoadingState.Loading)?.progress ?: 1f,
animationSpec = ProgressIndicatorDefaults.ProgressAnimationSpec,
label = "webview_loading",
)
LinearProgressIndicator(
progress = animatedProgress,
progress = { animatedProgress },
modifier = Modifier
.fillMaxWidth()
.align(Alignment.BottomCenter),
@ -139,10 +141,10 @@ fun EhLoginWebViewScreen(
horizontalArrangement = Arrangement.SpaceBetween,
) {
Button(onClick = onUp, Modifier.weight(0.5F)) {
Text(text = stringResource(R.string.action_cancel))
Text(text = stringResource(MR.strings.action_cancel))
}
Button(onClick = { showAdvancedOptions = true }, Modifier.weight(0.5F)) {
Text(text = stringResource(R.string.pref_category_advanced))
Text(text = stringResource(MR.strings.pref_category_advanced))
}
}
}
@ -164,7 +166,7 @@ fun EhLoginWebViewScreen(
},
modifier = Modifier.fillMaxWidth(),
) {
Text(text = stringResource(R.string.recheck_login_status))
Text(text = stringResource(SYMR.strings.recheck_login_status))
}
Button(
onClick = {
@ -173,7 +175,7 @@ fun EhLoginWebViewScreen(
},
modifier = Modifier.fillMaxWidth(),
) {
Text(text = stringResource(R.string.alternative_login_page))
Text(text = stringResource(SYMR.strings.alternative_login_page))
}
Button(
onClick = {
@ -182,7 +184,7 @@ fun EhLoginWebViewScreen(
},
modifier = Modifier.fillMaxWidth(),
) {
Text(text = stringResource(R.string.skip_page_restyling))
Text(text = stringResource(SYMR.strings.skip_page_restyling))
}
Button(
onClick = {
@ -191,10 +193,10 @@ fun EhLoginWebViewScreen(
},
modifier = Modifier.fillMaxWidth(),
) {
Text(text = stringResource(R.string.custom_igneous_cookie))
Text(text = stringResource(SYMR.strings.custom_igneous_cookie))
}
Button(onClick = { showAdvancedOptions = false }, Modifier.fillMaxWidth()) {
Text(text = stringResource(R.string.action_cancel))
Text(text = stringResource(MR.strings.action_cancel))
}
}
}

View File

@ -12,10 +12,11 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.input.TextFieldValue
import androidx.compose.ui.window.DialogProperties
import eu.kanade.tachiyomi.R
import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun IgneousDialog(
@ -27,10 +28,10 @@ fun IgneousDialog(
}
AlertDialog(
onDismissRequest = onDismissRequest,
title = { Text(text = stringResource(R.string.custom_igneous_cookie)) },
title = { Text(text = stringResource(SYMR.strings.custom_igneous_cookie)) },
text = {
Column {
Text(text = stringResource(R.string.custom_igneous_cookie_message))
Text(text = stringResource(SYMR.strings.custom_igneous_cookie_message))
OutlinedTextField(
value = textFieldValue,
onValueChange = { textFieldValue = it },
@ -49,12 +50,12 @@ fun IgneousDialog(
onDismissRequest()
},
) {
Text(text = stringResource(R.string.action_ok))
Text(text = stringResource(MR.strings.action_ok))
}
},
dismissButton = {
TextButton(onClick = onDismissRequest) {
Text(text = stringResource(R.string.action_cancel))
Text(text = stringResource(MR.strings.action_cancel))
}
},
)

View File

@ -251,7 +251,7 @@ class App : Application(), DefaultLifecycleObserver, ImageLoaderFactory {
val logFolder = File(
Environment.getExternalStorageDirectory().absolutePath + File.separator +
getString(R.string.app_name),
stringResource(MR.strings.app_name),
"logs",
)

View File

@ -50,6 +50,7 @@ import tachiyomi.domain.manga.model.CustomMangaInfo
import tachiyomi.domain.manga.model.Manga
import tachiyomi.domain.track.model.Track
import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
import java.io.File
@ -247,8 +248,8 @@ class BackupRestorer(
showRestoreProgress(
restoreProgress,
restoreAmount,
context.getString(R.string.saved_searches),
context.getString(R.string.restoring_backup),
context.stringResource(SYMR.strings.saved_searches),
context.stringResource(MR.strings.restoring_backup),
)
}
// SY <--

View File

@ -2,7 +2,6 @@ package eu.kanade.tachiyomi.data.download
import android.content.Context
import com.hippo.unifile.UniFile
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.download.model.Download
import eu.kanade.tachiyomi.source.Source
import eu.kanade.tachiyomi.source.model.Page
@ -18,6 +17,7 @@ import kotlinx.coroutines.flow.merge
import kotlinx.coroutines.flow.onStart
import kotlinx.coroutines.runBlocking
import logcat.LogPriority
import tachiyomi.core.i18n.stringResource
import tachiyomi.core.util.lang.launchIO
import tachiyomi.core.util.system.logcat
import tachiyomi.domain.category.interactor.GetCategories
@ -25,6 +25,7 @@ import tachiyomi.domain.chapter.model.Chapter
import tachiyomi.domain.download.service.DownloadPreferences
import tachiyomi.domain.manga.model.Manga
import tachiyomi.domain.source.service.SourceManager
import tachiyomi.i18n.MR
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
@ -166,7 +167,7 @@ class DownloadManager(
.filter { "image" in it.type.orEmpty() }
if (files.isEmpty()) {
throw Exception(context.getString(R.string.page_list_empty_error))
throw Exception(context.stringResource(MR.strings.page_list_empty_error))
}
return files.sortedBy { it.name }

View File

@ -6,7 +6,6 @@ import com.hippo.unifile.UniFile
import eu.kanade.domain.chapter.model.toSChapter
import eu.kanade.domain.manga.model.getComicInfo
import eu.kanade.domain.source.service.SourcePreferences
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.cache.ChapterCache
import eu.kanade.tachiyomi.data.download.model.Download
import eu.kanade.tachiyomi.data.library.LibraryUpdateNotifier
@ -48,6 +47,7 @@ import net.lingala.zip4j.ZipFile
import net.lingala.zip4j.model.ZipParameters
import nl.adaptivity.xmlutil.serialization.XML
import okhttp3.Response
import tachiyomi.core.i18n.stringResource
import tachiyomi.core.metadata.comicinfo.COMIC_INFO_FILE
import tachiyomi.core.metadata.comicinfo.ComicInfo
import tachiyomi.core.util.lang.launchIO
@ -61,6 +61,7 @@ import tachiyomi.domain.chapter.model.Chapter
import tachiyomi.domain.download.service.DownloadPreferences
import tachiyomi.domain.manga.model.Manga
import tachiyomi.domain.source.service.SourceManager
import tachiyomi.i18n.MR
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
import java.io.BufferedOutputStream
@ -315,7 +316,7 @@ class Downloader(
) {
withUIContext {
notifier.onWarning(
context.getString(R.string.download_queue_size_warning),
context.stringResource(MR.strings.download_queue_size_warning),
WARNING_NOTIF_TIMEOUT_MS,
NotificationHandler.openUrl(context, LibraryUpdateNotifier.HELP_WARNING_URL),
)
@ -338,7 +339,7 @@ class Downloader(
if (availSpace != -1L && availSpace < MIN_DISK_SPACE) {
download.status = Download.State.ERROR
notifier.onError(
context.getString(R.string.download_insufficient_space),
context.stringResource(MR.strings.download_insufficient_space),
download.chapter.name,
download.manga.title,
)
@ -355,7 +356,7 @@ class Downloader(
val pages = download.source.getPageList(download.chapter.toSChapter())
if (pages.isEmpty()) {
throw Exception(context.getString(R.string.page_list_empty_error))
throw Exception(context.stringResource(MR.strings.page_list_empty_error))
}
// Don't trust index from source
val reIndexedPages = pages.mapIndexed { index, page -> Page(index, page.url, page.imageUrl, page.uri) }
@ -570,7 +571,7 @@ class Downloader(
try {
val filenamePrefix = String.format("%03d", page.number)
val imageFile = tmpDir.listFiles()?.firstOrNull { it.name.orEmpty().startsWith(filenamePrefix) }
?: error(context.getString(R.string.download_notifier_split_page_not_found, page.number))
?: error(context.stringResource(MR.strings.download_notifier_split_page_not_found, page.number))
// If the original page was previously split, then skip
if (imageFile.name.orEmpty().startsWith("${filenamePrefix}__")) return

View File

@ -20,7 +20,6 @@ import eu.kanade.domain.manga.model.copyFrom
import eu.kanade.domain.manga.model.toSManga
import eu.kanade.domain.track.model.toDbTrack
import eu.kanade.domain.track.model.toDomainTrack
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.cache.CoverCache
import eu.kanade.tachiyomi.data.download.DownloadManager
import eu.kanade.tachiyomi.data.notification.Notifications
@ -54,6 +53,7 @@ import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.sync.Semaphore
import kotlinx.coroutines.sync.withPermit
import logcat.LogPriority
import tachiyomi.core.i18n.stringResource
import tachiyomi.core.preference.getAndSet
import tachiyomi.core.util.lang.withIOContext
import tachiyomi.core.util.system.logcat
@ -87,6 +87,7 @@ import tachiyomi.domain.source.model.SourceNotInstalledException
import tachiyomi.domain.source.service.SourceManager
import tachiyomi.domain.track.interactor.GetTracks
import tachiyomi.domain.track.interactor.InsertTrack
import tachiyomi.i18n.MR
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
import java.io.File
@ -273,27 +274,27 @@ class LibraryUpdateJob(private val context: Context, workerParams: WorkerParamet
.filter {
when {
it.manga.updateStrategy != UpdateStrategy.ALWAYS_UPDATE -> {
skippedUpdates.add(it.manga to context.getString(R.string.skipped_reason_not_always_update))
skippedUpdates.add(it.manga to context.stringResource(MR.strings.skipped_reason_not_always_update))
false
}
MANGA_NON_COMPLETED in restrictions && it.manga.status.toInt() == SManga.COMPLETED -> {
skippedUpdates.add(it.manga to context.getString(R.string.skipped_reason_completed))
skippedUpdates.add(it.manga to context.stringResource(MR.strings.skipped_reason_completed))
false
}
MANGA_HAS_UNREAD in restrictions && it.unreadCount != 0L -> {
skippedUpdates.add(it.manga to context.getString(R.string.skipped_reason_not_caught_up))
skippedUpdates.add(it.manga to context.stringResource(MR.strings.skipped_reason_not_caught_up))
false
}
MANGA_NON_READ in restrictions && it.totalChapters > 0L && !it.hasStarted -> {
skippedUpdates.add(it.manga to context.getString(R.string.skipped_reason_not_started))
skippedUpdates.add(it.manga to context.stringResource(MR.strings.skipped_reason_not_started))
false
}
MANGA_OUTSIDE_RELEASE_PERIOD in restrictions && it.manga.nextUpdate > fetchWindow.second -> {
skippedUpdates.add(it.manga to context.getString(R.string.skipped_reason_not_in_release_period))
skippedUpdates.add(it.manga to context.stringResource(MR.strings.skipped_reason_not_in_release_period))
false
}
else -> true
@ -400,10 +401,10 @@ class LibraryUpdateJob(private val context: Context, workerParams: WorkerParamet
}
} catch (e: Throwable) {
val errorMessage = when (e) {
is NoChaptersException -> context.getString(R.string.no_chapters_error)
is NoChaptersException -> context.stringResource(MR.strings.no_chapters_error)
// failedUpdates will already have the source, don't need to copy it into the message
is SourceNotInstalledException -> context.getString(
R.string.loader_not_implemented_error,
is SourceNotInstalledException -> context.stringResource(
MR.strings.loader_not_implemented_error,
)
else -> e.message
}
@ -648,7 +649,7 @@ class LibraryUpdateJob(private val context: Context, workerParams: WorkerParamet
if (errors.isNotEmpty()) {
val file = context.createFileInCacheDir("tachiyomi_update_errors.txt")
file.bufferedWriter().use { out ->
out.write(context.getString(R.string.library_errors_help, ERROR_LOG_HELP_URL) + "\n\n")
out.write(context.stringResource(MR.strings.library_errors_help, ERROR_LOG_HELP_URL) + "\n\n")
// Error file format:
// ! Error
// # Source

View File

@ -26,9 +26,12 @@ import eu.kanade.tachiyomi.util.system.getBitmapOrNull
import eu.kanade.tachiyomi.util.system.notificationBuilder
import eu.kanade.tachiyomi.util.system.notify
import tachiyomi.core.Constants
import tachiyomi.core.i18n.pluralStringResource
import tachiyomi.core.i18n.stringResource
import tachiyomi.core.util.lang.launchUI
import tachiyomi.domain.chapter.model.Chapter
import tachiyomi.domain.manga.model.Manga
import tachiyomi.i18n.MR
import uy.kohesive.injekt.injectLazy
import java.text.NumberFormat
@ -58,12 +61,12 @@ class LibraryUpdateNotifier(private val context: Context) {
*/
val progressNotificationBuilder by lazy {
context.notificationBuilder(Notifications.CHANNEL_LIBRARY_PROGRESS) {
setContentTitle(context.getString(R.string.app_name))
setContentTitle(context.stringResource(MR.strings.app_name))
setSmallIcon(R.drawable.ic_refresh_24dp)
setLargeIcon(notificationBitmap)
setOngoing(true)
setOnlyAlertOnce(true)
addAction(R.drawable.ic_close_24dp, context.getString(R.string.action_cancel), cancelIntent)
addAction(R.drawable.ic_close_24dp, context.stringResource(MR.strings.action_cancel), cancelIntent)
}
}
@ -77,14 +80,14 @@ class LibraryUpdateNotifier(private val context: Context) {
fun showProgressNotification(manga: List<Manga>, current: Int, total: Int) {
if (preferences.hideNotificationContent().get()) {
progressNotificationBuilder
.setContentTitle(context.getString(R.string.notification_check_updates))
.setContentTitle(context.stringResource(MR.strings.notification_check_updates))
.setContentText("($current/$total)")
} else {
val updatingText = manga.joinToString("\n") { it.title.chop(40) }
progressNotificationBuilder
.setContentTitle(
context.getString(
R.string.notification_updating_progress,
context.stringResource(
MR.strings.notification_updating_progress,
percentFormatter.format(current.toFloat() / total),
),
)
@ -104,8 +107,8 @@ class LibraryUpdateNotifier(private val context: Context) {
Notifications.ID_LIBRARY_SIZE_WARNING,
Notifications.CHANNEL_LIBRARY_PROGRESS,
) {
setContentTitle(context.getString(R.string.label_warning))
setStyle(NotificationCompat.BigTextStyle().bigText(context.getString(R.string.notification_size_warning)))
setContentTitle(context.stringResource(MR.strings.label_warning))
setStyle(NotificationCompat.BigTextStyle().bigText(context.stringResource(MR.strings.notification_size_warning)))
setSmallIcon(R.drawable.ic_warning_white_24dp)
setTimeoutAfter(Downloader.WARNING_NOTIF_TIMEOUT_MS)
setContentIntent(NotificationHandler.openUrl(context, HELP_WARNING_URL))
@ -127,8 +130,8 @@ class LibraryUpdateNotifier(private val context: Context) {
Notifications.ID_LIBRARY_ERROR,
Notifications.CHANNEL_LIBRARY_ERROR,
) {
setContentTitle(context.resources.getString(R.string.notification_update_error, failed))
setContentText(context.getString(R.string.action_show_errors))
setContentTitle(context.stringResource(MR.strings.notification_update_error, failed))
setContentText(context.stringResource(MR.strings.action_show_errors))
setSmallIcon(R.drawable.ic_tachi)
setContentIntent(NotificationReceiver.openErrorLogPendingActivity(context, uri))
@ -149,8 +152,8 @@ class LibraryUpdateNotifier(private val context: Context) {
Notifications.ID_LIBRARY_SKIPPED,
Notifications.CHANNEL_LIBRARY_SKIPPED,
) {
setContentTitle(context.resources.getString(R.string.notification_update_skipped, skipped))
setContentText(context.getString(R.string.learn_more))
setContentTitle(context.stringResource(MR.strings.notification_update_skipped, skipped))
setContentText(context.stringResource(MR.strings.learn_more))
setSmallIcon(R.drawable.ic_tachi)
setContentIntent(NotificationHandler.openUrl(context, HELP_SKIPPED_URL))
}
@ -167,13 +170,13 @@ class LibraryUpdateNotifier(private val context: Context) {
Notifications.ID_NEW_CHAPTERS,
Notifications.CHANNEL_NEW_CHAPTERS,
) {
setContentTitle(context.getString(R.string.notification_new_chapters))
setContentTitle(context.stringResource(MR.strings.notification_new_chapters))
if (updates.size == 1 && !preferences.hideNotificationContent().get()) {
setContentText(updates.first().first.title.chop(NOTIF_TITLE_MAX_LEN))
} else {
setContentText(
context.resources.getQuantityString(
R.plurals.notification_new_chapters_summary,
context.pluralStringResource(
MR.plurals.notification_new_chapters_summary,
updates.size,
updates.size,
),
@ -243,7 +246,7 @@ class LibraryUpdateNotifier(private val context: Context) {
// Mark chapters as read action
addAction(
R.drawable.ic_glasses_24dp,
context.getString(R.string.action_mark_as_read),
context.stringResource(MR.strings.action_mark_as_read),
NotificationReceiver.markAsReadPendingBroadcast(
context,
manga,
@ -254,7 +257,7 @@ class LibraryUpdateNotifier(private val context: Context) {
// View chapters action
addAction(
R.drawable.ic_book_24dp,
context.getString(R.string.action_view_chapters),
context.stringResource(MR.strings.action_view_chapters),
NotificationReceiver.openChapterPendingActivity(
context,
manga,
@ -266,7 +269,7 @@ class LibraryUpdateNotifier(private val context: Context) {
if (chapters.size <= Downloader.CHAPTERS_PER_SOURCE_QUEUE_WARNING_THRESHOLD) {
addAction(
android.R.drawable.stat_sys_download_done,
context.getString(R.string.action_download),
context.stringResource(MR.strings.action_download),
NotificationReceiver.downloadChaptersPendingBroadcast(
context,
manga,
@ -306,8 +309,8 @@ class LibraryUpdateNotifier(private val context: Context) {
// No sensible chapter numbers to show (i.e. no chapters have parsed chapter number)
0 -> {
// "1 new chapter" or "5 new chapters"
context.resources.getQuantityString(
R.plurals.notification_chapters_generic,
context.pluralStringResource(
MR.plurals.notification_chapters_generic,
chapters.size,
chapters.size,
)
@ -317,14 +320,14 @@ class LibraryUpdateNotifier(private val context: Context) {
val remaining = chapters.size - displayableChapterNumbers.size
if (remaining == 0) {
// "Chapter 2.5"
context.resources.getString(
R.string.notification_chapters_single,
context.stringResource(
MR.strings.notification_chapters_single,
displayableChapterNumbers.first(),
)
} else {
// "Chapter 2.5 and 10 more"
context.resources.getString(
R.string.notification_chapters_single_and_more,
context.stringResource(
MR.strings.notification_chapters_single_and_more,
displayableChapterNumbers.first(),
remaining,
)
@ -337,16 +340,16 @@ class LibraryUpdateNotifier(private val context: Context) {
// "Chapters 1, 2.5, 3, 4, 5 and 10 more"
val remaining = displayableChapterNumbers.size - NOTIF_MAX_CHAPTERS
val joinedChapterNumbers = displayableChapterNumbers.take(NOTIF_MAX_CHAPTERS).joinToString(", ")
context.resources.getQuantityString(
R.plurals.notification_chapters_multiple_and_more,
context.pluralStringResource(
MR.plurals.notification_chapters_multiple_and_more,
remaining,
joinedChapterNumbers,
remaining,
)
} else {
// "Chapters 1, 2.5, 3"
context.resources.getString(
R.string.notification_chapters_multiple,
context.stringResource(
MR.strings.notification_chapters_multiple,
displayableChapterNumbers.joinToString(", "),
)
}

View File

@ -1,7 +1,6 @@
package eu.kanade.tachiyomi.data.track
import androidx.annotation.StringRes
import eu.kanade.tachiyomi.R
import dev.icerock.moko.resources.StringResource
import eu.kanade.tachiyomi.data.track.anilist.Anilist
import eu.kanade.tachiyomi.data.track.bangumi.Bangumi
import eu.kanade.tachiyomi.data.track.kitsu.Kitsu
@ -10,15 +9,17 @@ import eu.kanade.tachiyomi.data.track.mangaupdates.MangaUpdates
import eu.kanade.tachiyomi.data.track.myanimelist.MyAnimeList
import eu.kanade.tachiyomi.data.track.shikimori.Shikimori
import exh.md.utils.FollowStatus
import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR
enum class TrackStatus(val int: Int, @StringRes val res: Int) {
READING(1, R.string.reading),
REPEATING(2, R.string.repeating),
PLAN_TO_READ(3, R.string.plan_to_read),
PAUSED(4, R.string.on_hold),
COMPLETED(5, R.string.completed),
DROPPED(6, R.string.dropped),
OTHER(7, R.string.not_tracked),
enum class TrackStatus(val int: Int, val res: StringResource) {
READING(1, MR.strings.reading),
REPEATING(2, MR.strings.repeating),
PLAN_TO_READ(3, MR.strings.plan_to_read),
PAUSED(4, MR.strings.on_hold),
COMPLETED(5, MR.strings.completed),
DROPPED(6, MR.strings.dropped),
OTHER(7, SYMR.strings.not_tracked),
;
companion object {

View File

@ -1,7 +1,7 @@
package eu.kanade.tachiyomi.data.track.mdlist
import android.graphics.Color
import androidx.annotation.StringRes
import dev.icerock.moko.resources.StringResource
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.database.models.Track
import eu.kanade.tachiyomi.data.track.BaseTracker
@ -16,6 +16,8 @@ import tachiyomi.core.util.lang.awaitSingle
import tachiyomi.core.util.lang.runAsObservable
import tachiyomi.core.util.lang.withIOContext
import tachiyomi.domain.manga.model.Manga
import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
@ -43,15 +45,14 @@ class MdList(id: Long) : BaseTracker(id, "MDList") {
return FollowStatus.values().map { it.int }
}
@StringRes
override fun getStatus(status: Int): Int? = when (status) {
0 -> R.string.md_follows_unfollowed
1 -> R.string.reading
2 -> R.string.completed
3 -> R.string.on_hold
4 -> R.string.plan_to_read
5 -> R.string.dropped
6 -> R.string.repeating
override fun getStatus(status: Int): StringResource? = when (status) {
0 -> SYMR.strings.md_follows_unfollowed
1 -> MR.strings.reading
2 -> MR.strings.completed
3 -> MR.strings.on_hold
4 -> MR.strings.plan_to_read
5 -> MR.strings.dropped
6 -> MR.strings.repeating
else -> null
}

View File

@ -24,7 +24,6 @@ import eu.kanade.tachiyomi.network.NetworkHelper
import eu.kanade.tachiyomi.source.AndroidSourceManager
import eu.kanade.tachiyomi.util.storage.CbzCrypto
import exh.eh.EHentaiUpdateHelper
import exh.pref.DelegateSourcePreferences
import io.requery.android.database.sqlite.RequerySQLiteOpenHelperFactory
import kotlinx.serialization.json.Json
import net.zetetic.database.sqlcipher.SupportOpenHelperFactory
@ -39,7 +38,6 @@ import tachiyomi.data.History
import tachiyomi.data.Mangas
import tachiyomi.data.StringListColumnAdapter
import tachiyomi.data.UpdateStrategyColumnAdapter
import tachiyomi.domain.UnsortedPreferences
import tachiyomi.domain.manga.interactor.GetCustomMangaInfo
import tachiyomi.domain.source.service.SourceManager
import tachiyomi.source.local.image.LocalCoverManager
@ -178,4 +176,3 @@ class AppModule(val app: Application) : InjektModule {
}
}
}

View File

@ -4,6 +4,7 @@ import android.content.Context
import android.graphics.drawable.Drawable
import androidx.core.content.ContextCompat
import eu.kanade.domain.source.service.SourcePreferences
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.extension.api.ExtensionGithubApi
import eu.kanade.tachiyomi.extension.api.ExtensionUpdateNotifier
import eu.kanade.tachiyomi.extension.model.Extension

View File

@ -10,7 +10,6 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import cafe.adriel.voyager.core.model.rememberScreenModel
import cafe.adriel.voyager.navigator.Navigator
import cafe.adriel.voyager.navigator.tab.LocalTabNavigator
@ -29,6 +28,8 @@ import eu.kanade.tachiyomi.ui.browse.source.globalsearch.GlobalSearchScreen
import eu.kanade.tachiyomi.ui.browse.source.sourcesTab
import eu.kanade.tachiyomi.ui.main.MainActivity
import kotlinx.collections.immutable.persistentListOf
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.stringResource
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
@ -43,7 +44,7 @@ data class BrowseTab(
val image = AnimatedImageVector.animatedVectorResource(R.drawable.anim_browse_enter)
return TabOptions(
index = 3u,
title = stringResource(R.string.browse),
title = stringResource(MR.strings.browse),
icon = rememberAnimatedVectorPainter(image, isSelected),
)
}
@ -67,7 +68,7 @@ data class BrowseTab(
val extensionsState by extensionsScreenModel.state.collectAsState()
TabbedScreen(
titleRes = R.string.browse,
titleRes = MR.strings.browse,
// SY -->
tabs = if (feedTabInFront) {
persistentListOf(

View File

@ -13,6 +13,9 @@ import eu.kanade.presentation.browse.FeedItemUI
import eu.kanade.tachiyomi.source.CatalogueSource
import eu.kanade.tachiyomi.source.model.FilterList
import eu.kanade.tachiyomi.util.system.LocaleHelper
import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.persistentListOf
import kotlinx.collections.immutable.toImmutableList
import kotlinx.coroutines.asCoroutineDispatcher
import kotlinx.coroutines.async
import kotlinx.coroutines.awaitAll
@ -124,7 +127,13 @@ open class FeedScreenModel(
screenModelScope.launchIO {
mutableState.update { state ->
state.copy(
dialog = Dialog.AddFeedSearch(source, (if (source.supportsLatest) listOf(null) else emptyList()) + getSourceSavedSearches(source.id)),
dialog = Dialog.AddFeedSearch(
source,
(
(if (source.supportsLatest) persistentListOf(null) else persistentListOf()) +
getSourceSavedSearches(source.id)
).toImmutableList(),
),
)
}
}
@ -144,7 +153,7 @@ open class FeedScreenModel(
return countFeedSavedSearchGlobal.await() > 10
}
fun getEnabledSources(): List<CatalogueSource> {
fun getEnabledSources(): ImmutableList<CatalogueSource> {
val languages = sourcePreferences.enabledLanguages().get()
val pinnedSources = sourcePreferences.pinnedSources().get()
val disabledSources = sourcePreferences.disabledSources().get()
@ -155,11 +164,11 @@ open class FeedScreenModel(
.filterNot { it.id in disabledSources }
.sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER) { "(${it.lang}) ${it.name}" })
return list.sortedBy { it.id.toString() !in pinnedSources }
return list.sortedBy { it.id.toString() !in pinnedSources }.toImmutableList()
}
suspend fun getSourceSavedSearches(sourceId: Long): List<SavedSearch> {
return getSavedSearchBySourceId.await(sourceId)
suspend fun getSourceSavedSearches(sourceId: Long): ImmutableList<SavedSearch> {
return getSavedSearchBySourceId.await(sourceId).toImmutableList()
}
fun createFeed(source: CatalogueSource, savedSearch: SavedSearch?) {
@ -290,8 +299,8 @@ open class FeedScreenModel(
}
sealed class Dialog {
data class AddFeed(val options: List<CatalogueSource>) : Dialog()
data class AddFeedSearch(val source: CatalogueSource, val options: List<SavedSearch?>) : Dialog()
data class AddFeed(val options: ImmutableList<CatalogueSource>) : Dialog()
data class AddFeedSearch(val source: CatalogueSource, val options: ImmutableList<SavedSearch?>) : Dialog()
data class DeleteFeed(val feed: FeedSavedSearch) : Dialog()
}

View File

@ -7,7 +7,6 @@ import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.ui.res.stringResource
import cafe.adriel.voyager.core.model.rememberScreenModel
import cafe.adriel.voyager.core.screen.Screen
import cafe.adriel.voyager.core.stack.StackEvent
@ -19,13 +18,15 @@ import eu.kanade.presentation.browse.FeedDeleteConfirmDialog
import eu.kanade.presentation.browse.FeedScreen
import eu.kanade.presentation.components.AppBar
import eu.kanade.presentation.components.TabContent
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.ui.browse.source.browse.BrowseSourceScreen
import eu.kanade.tachiyomi.ui.manga.MangaScreen
import kotlinx.collections.immutable.persistentListOf
import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.launch
import tachiyomi.domain.source.interactor.GetRemoteManga
import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun Screen.feedTab(): TabContent {
@ -48,10 +49,10 @@ fun Screen.feedTab(): TabContent {
}
return TabContent(
titleRes = R.string.feed,
titleRes = SYMR.strings.feed,
actions = persistentListOf(
AppBar.Action(
title = stringResource(R.string.action_add),
title = stringResource(MR.strings.action_add),
icon = Icons.Outlined.Add,
onClick = {
screenModel.openAddDialog()
@ -127,8 +128,8 @@ fun Screen.feedTab(): TabContent {
}
}
val internalErrString = stringResource(R.string.internal_error)
val tooManyFeedsString = stringResource(R.string.too_many_in_feed)
val internalErrString = stringResource(MR.strings.internal_error)
val tooManyFeedsString = stringResource(SYMR.strings.too_many_in_feed)
LaunchedEffect(Unit) {
screenModel.events.collectLatest { event ->
when (event) {

View File

@ -14,13 +14,13 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.viewinterop.AndroidView
import androidx.core.view.isVisible
import eu.kanade.presentation.components.AdaptiveSheet
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.databinding.MigrationBottomSheetBinding
import eu.kanade.tachiyomi.ui.browse.migration.MigrationFlags
import eu.kanade.tachiyomi.util.system.toast
import tachiyomi.core.preference.Preference
import tachiyomi.core.util.lang.toLong
import tachiyomi.domain.UnsortedPreferences
import tachiyomi.i18n.sy.SYMR
import uy.kohesive.injekt.injectLazy
@Composable
@ -77,7 +77,7 @@ class MigrationBottomSheetDialogState(private val onStartMigration: State<(extra
binding.skipStep.setOnCheckedChangeListener { _, isChecked ->
if (isChecked) {
binding.root.context.toast(
R.string.pre_migration_skip_toast,
SYMR.strings.pre_migration_skip_toast,
Toast.LENGTH_LONG,
)
}

View File

@ -24,7 +24,6 @@ import androidx.compose.ui.input.nestedscroll.NestedScrollSource
import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.platform.LocalLayoutDirection
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.Velocity
import androidx.compose.ui.viewinterop.AndroidView
import androidx.core.view.ViewCompat
@ -37,13 +36,15 @@ import cafe.adriel.voyager.navigator.currentOrThrow
import eu.kanade.presentation.components.AppBar
import eu.kanade.presentation.components.AppBarActions
import eu.kanade.presentation.util.Screen
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.databinding.PreMigrationListBinding
import eu.kanade.tachiyomi.ui.browse.migration.advanced.process.MigrationListScreen
import eu.kanade.tachiyomi.ui.browse.migration.advanced.process.MigrationProcedureConfig
import kotlinx.collections.immutable.persistentListOf
import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.components.material.ExtendedFloatingActionButton
import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.i18n.stringResource
import kotlin.math.roundToInt
class PreMigrationScreen(val mangaIds: List<Long>) : Screen() {
@ -79,28 +80,28 @@ class PreMigrationScreen(val mangaIds: List<Long>) : Screen() {
Scaffold(
topBar = {
AppBar(
title = stringResource(R.string.select_sources),
title = stringResource(SYMR.strings.select_sources),
navigateUp = navigator::pop,
scrollBehavior = scrollBehavior,
actions = {
AppBarActions(
persistentListOf(
AppBar.Action(
title = stringResource(R.string.select_none),
title = stringResource(SYMR.strings.select_none),
icon = Icons.Outlined.Deselect,
onClick = { screenModel.massSelect(false) },
),
AppBar.Action(
title = stringResource(R.string.action_select_all),
title = stringResource(MR.strings.action_select_all),
icon = Icons.Outlined.SelectAll,
onClick = { screenModel.massSelect(true) },
),
AppBar.OverflowAction(
title = stringResource(R.string.match_enabled_sources),
title = stringResource(SYMR.strings.match_enabled_sources),
onClick = { screenModel.matchSelection(true) },
),
AppBar.OverflowAction(
title = stringResource(R.string.match_pinned_sources),
title = stringResource(SYMR.strings.match_pinned_sources),
onClick = { screenModel.matchSelection(false) },
),
),
@ -110,11 +111,11 @@ class PreMigrationScreen(val mangaIds: List<Long>) : Screen() {
},
floatingActionButton = {
ExtendedFloatingActionButton(
text = { Text(text = stringResource(R.string.action_migrate)) },
text = { Text(text = stringResource(MR.strings.action_migrate)) },
icon = {
Icon(
imageVector = Icons.Outlined.ArrowForward,
contentDescription = stringResource(R.string.action_migrate),
contentDescription = stringResource(MR.strings.action_migrate),
)
},
onClick = {

Some files were not shown because too many files have changed in this diff Show More