fix: upstream conflict.

Signed-off-by: KaiserBh <kaiserbh@proton.me>
This commit is contained in:
KaiserBh 2023-11-19 19:34:37 +11:00
commit be363807e6
No known key found for this signature in database
GPG Key ID: 14D73B142042BBA9
340 changed files with 5963 additions and 6352 deletions

View File

@ -1,12 +1,12 @@
package eu.kanade.domain.base
import android.content.Context
import androidx.annotation.StringRes
import eu.kanade.tachiyomi.R
import dev.icerock.moko.resources.StringResource
import eu.kanade.tachiyomi.util.system.isPreviewBuildType
import eu.kanade.tachiyomi.util.system.isReleaseBuildType
import tachiyomi.core.preference.Preference
import tachiyomi.core.preference.PreferenceStore
import tachiyomi.i18n.MR
class BasePreferences(
val context: Context,
@ -24,10 +24,10 @@ class BasePreferences(
fun acraEnabled() = preferenceStore.getBoolean("acra.enable", isPreviewBuildType || isReleaseBuildType)
enum class ExtensionInstaller(@StringRes val titleResId: Int) {
LEGACY(R.string.ext_installer_legacy),
PACKAGEINSTALLER(R.string.ext_installer_packageinstaller),
SHIZUKU(R.string.ext_installer_shizuku),
PRIVATE(R.string.ext_installer_private),
enum class ExtensionInstaller(val titleRes: StringResource) {
LEGACY(MR.strings.ext_installer_legacy),
PACKAGEINSTALLER(MR.strings.ext_installer_packageinstaller),
SHIZUKU(MR.strings.ext_installer_shizuku),
PRIVATE(MR.strings.ext_installer_private),
}
}

View File

@ -1,19 +1,20 @@
package eu.kanade.domain.ui.model
import eu.kanade.tachiyomi.R
import dev.icerock.moko.resources.StringResource
import tachiyomi.i18n.MR
enum class AppTheme(val titleResId: Int?) {
DEFAULT(R.string.label_default),
MONET(R.string.theme_monet),
GREEN_APPLE(R.string.theme_greenapple),
LAVENDER(R.string.theme_lavender),
MIDNIGHT_DUSK(R.string.theme_midnightdusk),
STRAWBERRY_DAIQUIRI(R.string.theme_strawberrydaiquiri),
TAKO(R.string.theme_tako),
TEALTURQUOISE(R.string.theme_tealturquoise),
TIDAL_WAVE(R.string.theme_tidalwave),
YINYANG(R.string.theme_yinyang),
YOTSUBA(R.string.theme_yotsuba),
enum class AppTheme(val titleRes: StringResource?) {
DEFAULT(MR.strings.label_default),
MONET(MR.strings.theme_monet),
GREEN_APPLE(MR.strings.theme_greenapple),
LAVENDER(MR.strings.theme_lavender),
MIDNIGHT_DUSK(MR.strings.theme_midnightdusk),
STRAWBERRY_DAIQUIRI(MR.strings.theme_strawberrydaiquiri),
TAKO(MR.strings.theme_tako),
TEALTURQUOISE(MR.strings.theme_tealturquoise),
TIDAL_WAVE(MR.strings.theme_tidalwave),
YINYANG(MR.strings.theme_yinyang),
YOTSUBA(MR.strings.theme_yotsuba),
// Deprecated
DARK_BLUE(null),

View File

@ -1,10 +1,11 @@
package eu.kanade.domain.ui.model
import eu.kanade.tachiyomi.R
import dev.icerock.moko.resources.StringResource
import tachiyomi.i18n.MR
enum class TabletUiMode(val titleResId: Int) {
AUTOMATIC(R.string.automatic_background),
ALWAYS(R.string.lock_always),
LANDSCAPE(R.string.landscape),
NEVER(R.string.lock_never),
enum class TabletUiMode(val titleRes: StringResource) {
AUTOMATIC(MR.strings.automatic_background),
ALWAYS(MR.strings.lock_always),
LANDSCAPE(MR.strings.landscape),
NEVER(MR.strings.lock_never),
}

View File

@ -14,7 +14,6 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.paging.LoadState
import androidx.paging.compose.LazyPagingItems
import eu.kanade.presentation.browse.components.BrowseSourceComfortableGrid
@ -22,14 +21,16 @@ import eu.kanade.presentation.browse.components.BrowseSourceCompactGrid
import eu.kanade.presentation.browse.components.BrowseSourceList
import eu.kanade.presentation.components.AppBar
import eu.kanade.presentation.util.formattedMessage
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.source.Source
import kotlinx.collections.immutable.persistentListOf
import kotlinx.coroutines.flow.StateFlow
import tachiyomi.core.i18n.stringResource
import tachiyomi.domain.library.model.LibraryDisplayMode
import tachiyomi.domain.manga.model.Manga
import tachiyomi.domain.source.model.StubSource
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.screens.EmptyScreen
import tachiyomi.presentation.core.screens.EmptyScreenAction
import tachiyomi.presentation.core.screens.LoadingScreen
@ -62,7 +63,7 @@ fun BrowseSourceContent(
if (mangaList.itemCount > 0 && errorState != null && errorState is LoadState.Error) {
val result = snackbarHostState.showSnackbar(
message = getErrorMessage(errorState),
actionLabel = context.getString(R.string.action_retry),
actionLabel = context.stringResource(MR.strings.action_retry),
duration = SnackbarDuration.Indefinite,
)
when (result) {
@ -79,7 +80,7 @@ fun BrowseSourceContent(
actions = if (source is LocalSource) {
persistentListOf(
EmptyScreenAction(
stringResId = R.string.local_source_help_guide,
stringRes = MR.strings.local_source_help_guide,
icon = Icons.AutoMirrored.Outlined.HelpOutline,
onClick = onLocalSourceHelpClick,
),
@ -87,17 +88,17 @@ fun BrowseSourceContent(
} else {
persistentListOf(
EmptyScreenAction(
stringResId = R.string.action_retry,
stringRes = MR.strings.action_retry,
icon = Icons.Outlined.Refresh,
onClick = mangaList::refresh,
),
EmptyScreenAction(
stringResId = R.string.action_open_in_web_view,
stringRes = MR.strings.action_open_in_web_view,
icon = Icons.Outlined.Public,
onClick = onWebViewClick,
),
EmptyScreenAction(
stringResId = R.string.label_help,
stringRes = MR.strings.label_help,
icon = Icons.AutoMirrored.Outlined.HelpOutline,
onClick = onHelpClick,
),
@ -160,7 +161,7 @@ internal fun MissingSourceScreen(
},
) { paddingValues ->
EmptyScreen(
message = stringResource(R.string.source_not_installed, source.toString()),
message = stringResource(MR.strings.source_not_installed, source.toString()),
modifier = Modifier.padding(paddingValues),
)
}

View File

@ -38,7 +38,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.text.TextStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
@ -50,15 +49,16 @@ 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.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
@ -77,7 +77,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(
@ -86,14 +86,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,
),
@ -102,15 +102,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,
),
),
@ -125,7 +125,7 @@ fun ExtensionDetailsScreen(
) { paddingValues ->
if (state.extension == null) {
EmptyScreen(
textResource = R.string.empty_screen,
stringRes = MR.strings.empty_screen,
modifier = Modifier.padding(paddingValues),
)
return@Scaffold
@ -160,11 +160,11 @@ private fun ExtensionDetails(
when {
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)
}
}
@ -190,7 +190,6 @@ private fun ExtensionDetails(
key = { it.source.id },
) { source ->
SourceSwitchPreference(
modifier = Modifier.animateItemPlacement(),
source = source,
onClickSourcePreferences = onClickSourcePreferences,
onClickSource = onClickSource,
@ -261,7 +260,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()
@ -269,7 +268,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) {
@ -277,12 +276,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,
)
}
@ -301,7 +300,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) {
@ -310,7 +309,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,
)
}
@ -388,7 +387,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,
)
}
@ -411,11 +410,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

@ -7,13 +7,13 @@ import androidx.compose.foundation.lazy.items
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import eu.kanade.presentation.components.AppBar
import eu.kanade.presentation.more.settings.widget.SwitchPreferenceWidget
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.ui.browse.extension.ExtensionFilterState
import eu.kanade.tachiyomi.util.system.LocaleHelper
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.screens.EmptyScreen
@Composable
@ -25,7 +25,7 @@ fun ExtensionFilterScreen(
Scaffold(
topBar = { scrollBehavior ->
AppBar(
title = stringResource(R.string.label_extensions),
title = stringResource(MR.strings.label_extensions),
navigateUp = navigateUp,
scrollBehavior = scrollBehavior,
)
@ -33,7 +33,7 @@ fun ExtensionFilterScreen(
) { contentPadding ->
if (state.isEmpty) {
EmptyScreen(
textResource = R.string.empty_screen,
stringRes = MR.strings.empty_screen,
modifier = Modifier.padding(contentPadding),
)
return@Scaffold
@ -58,7 +58,6 @@ private fun ExtensionFilterContent(
) {
items(state.languages) { language ->
SwitchPreferenceWidget(
modifier = Modifier.animateItemPlacement(),
title = LocaleHelper.getSourceDisplayName(language, context),
checked = language in state.enabledLanguages,
onCheckedChanged = { onClickLang(language) },

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
@ -33,22 +32,23 @@ 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.ui.browse.extension.ExtensionUiModel
import eu.kanade.tachiyomi.ui.browse.extension.ExtensionsScreenModel
import eu.kanade.tachiyomi.util.system.LocaleHelper
import tachiyomi.i18n.MR
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
@ -79,12 +79,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,
stringRes = msg,
modifier = Modifier.padding(contentPadding),
)
}
@ -132,11 +132,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,
),
@ -148,14 +148,12 @@ private fun ExtensionContent(
}
ExtensionHeader(
textRes = header.textRes,
modifier = Modifier.animateItemPlacement(),
action = action,
)
}
is ExtensionUiModel.Header.Text -> {
ExtensionHeader(
text = header.text,
modifier = Modifier.animateItemPlacement(),
)
}
}
@ -167,7 +165,6 @@ private fun ExtensionContent(
key = { "extension-${it.hashCode()}" },
) { item ->
ExtensionItem(
modifier = Modifier.animateItemPlacement(),
item = item,
onClickItem = {
when (it) {
@ -307,10 +304,10 @@ private fun ExtensionItemContent(
}
val warning = when {
extension is Extension.Untrusted -> R.string.ext_untrusted
extension is Extension.Installed && extension.isUnofficial -> R.string.ext_unofficial
extension is Extension.Installed && extension.isObsolete -> R.string.ext_obsolete
extension.isNsfw -> R.string.ext_nsfw_short
extension is Extension.Untrusted -> MR.strings.ext_untrusted
extension is Extension.Installed && extension.isUnofficial -> MR.strings.ext_unofficial
extension is Extension.Installed && extension.isObsolete -> MR.strings.ext_obsolete
extension.isNsfw -> MR.strings.ext_nsfw_short
else -> null
}
if (warning != null) {
@ -326,9 +323,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")
},
)
@ -354,19 +351,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")
@ -377,7 +374,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),
)
}
}
@ -386,7 +383,7 @@ private fun ExtensionItemActions(
@Composable
private fun ExtensionHeader(
@StringRes textRes: Int,
textRes: StringResource,
modifier: Modifier = Modifier,
action: @Composable RowScope.() -> Unit = {},
) {
@ -426,19 +423,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

@ -7,9 +7,9 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import eu.kanade.presentation.components.AppBar
import eu.kanade.presentation.manga.components.BaseMangaListItem
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.ui.browse.migration.manga.MigrateMangaScreenModel
import tachiyomi.domain.manga.model.Manga
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.FastScrollLazyColumn
import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.screens.EmptyScreen
@ -33,7 +33,7 @@ fun MigrateMangaScreen(
) { contentPadding ->
if (state.isEmpty) {
EmptyScreen(
textResource = R.string.empty_screen,
stringRes = MR.strings.empty_screen,
modifier = Modifier.padding(contentPadding),
)
return@Scaffold

View File

@ -20,21 +20,21 @@ import androidx.compose.runtime.Composable
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 eu.kanade.domain.source.interactor.SetMigrateSorting
import eu.kanade.presentation.browse.components.BaseSourceItem
import eu.kanade.presentation.browse.components.SourceIcon
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.ui.browse.migration.sources.MigrateSourceScreenModel
import eu.kanade.tachiyomi.util.system.copyToClipboard
import tachiyomi.domain.source.model.Source
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.Badge
import tachiyomi.presentation.core.components.BadgeGroup
import tachiyomi.presentation.core.components.ScrollbarLazyColumn
import tachiyomi.presentation.core.components.Scroller.STICKY_HEADER_KEY_PREFIX
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
@ -53,7 +53,7 @@ fun MigrateSourceScreen(
when {
state.isLoading -> LoadingScreen(Modifier.padding(contentPadding))
state.isEmpty -> EmptyScreen(
textResource = R.string.information_empty_library,
stringRes = MR.strings.information_empty_library,
modifier = Modifier.padding(contentPadding),
)
else ->
@ -95,7 +95,7 @@ private fun MigrateSourceList(
verticalAlignment = Alignment.CenterVertically,
) {
Text(
text = stringResource(R.string.migration_selection_prompt),
text = stringResource(MR.strings.migration_selection_prompt),
modifier = Modifier.weight(1f),
style = MaterialTheme.typography.header,
)
@ -104,11 +104,11 @@ private fun MigrateSourceList(
when (sortingMode) {
SetMigrateSorting.Mode.ALPHABETICAL -> Icon(
Icons.Outlined.SortByAlpha,
contentDescription = stringResource(R.string.action_sort_alpha),
contentDescription = stringResource(MR.strings.action_sort_alpha),
)
SetMigrateSorting.Mode.TOTAL -> Icon(
Icons.Outlined.Numbers,
contentDescription = stringResource(R.string.action_sort_count),
contentDescription = stringResource(MR.strings.action_sort_count),
)
}
}
@ -116,11 +116,11 @@ private fun MigrateSourceList(
when (sortingDirection) {
SetMigrateSorting.Direction.ASCENDING -> Icon(
Icons.Outlined.ArrowUpward,
contentDescription = stringResource(R.string.action_asc),
contentDescription = stringResource(MR.strings.action_asc),
)
SetMigrateSorting.Direction.DESCENDING -> Icon(
Icons.Outlined.ArrowDownward,
contentDescription = stringResource(R.string.action_desc),
contentDescription = stringResource(MR.strings.action_desc),
)
}
}
@ -132,7 +132,6 @@ private fun MigrateSourceList(
key = { (source, _) -> "migrate-${source.id}" },
) { (source, count) ->
MigrateSourceItem(
modifier = Modifier.animateItemPlacement(),
source = source,
count = count,
onClickItem = { onClickItem(source) },
@ -190,7 +189,7 @@ private fun MigrateSourceItem(
if (source.isStub) {
Text(
modifier = Modifier.secondaryItemAlpha(),
text = stringResource(R.string.not_installed),
text = stringResource(MR.strings.not_installed),
maxLines = 1,
overflow = TextOverflow.Ellipsis,
style = MaterialTheme.typography.bodySmall,

View File

@ -7,16 +7,16 @@ import androidx.compose.material3.Checkbox
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import eu.kanade.presentation.browse.components.BaseSourceItem
import eu.kanade.presentation.components.AppBar
import eu.kanade.presentation.more.settings.widget.SwitchPreferenceWidget
import eu.kanade.tachiyomi.R
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.presentation.core.components.FastScrollLazyColumn
import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.screens.EmptyScreen
@Composable
@ -29,7 +29,7 @@ fun SourcesFilterScreen(
Scaffold(
topBar = { scrollBehavior ->
AppBar(
title = stringResource(R.string.label_sources),
title = stringResource(MR.strings.label_sources),
navigateUp = navigateUp,
scrollBehavior = scrollBehavior,
)
@ -37,7 +37,7 @@ fun SourcesFilterScreen(
) { contentPadding ->
if (state.isEmpty) {
EmptyScreen(
textResource = R.string.source_filter_empty_screen,
stringRes = MR.strings.source_filter_empty_screen,
modifier = Modifier.padding(contentPadding),
)
return@Scaffold
@ -68,7 +68,6 @@ private fun SourcesFilterContent(
contentType = "source-filter-header",
) {
SourcesFilterHeader(
modifier = Modifier.animateItemPlacement(),
language = language,
enabled = enabled,
onClickItem = onClickLanguage,
@ -81,7 +80,6 @@ private fun SourcesFilterContent(
contentType = { "source-filter-item" },
) { source ->
SourcesFilterItem(
modifier = Modifier.animateItemPlacement(),
source = source,
enabled = "${source.id}" !in state.disabledSources,
onClickItem = onClickSource,

View File

@ -19,19 +19,19 @@ import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
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 tachiyomi.domain.source.model.Pin
import tachiyomi.domain.source.model.Source
import tachiyomi.i18n.MR
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
@ -49,7 +49,7 @@ fun SourcesScreen(
when {
state.isLoading -> LoadingScreen(Modifier.padding(contentPadding))
state.isEmpty -> EmptyScreen(
textResource = R.string.source_empty_screen,
stringRes = MR.strings.source_empty_screen,
modifier = Modifier.padding(contentPadding),
)
else -> {
@ -74,12 +74,10 @@ fun SourcesScreen(
when (model) {
is SourceUiModel.Header -> {
SourceHeader(
modifier = Modifier.animateItemPlacement(),
language = model.language,
)
}
is SourceUiModel.Item -> SourceItem(
modifier = Modifier.animateItemPlacement(),
source = model.source,
onClickItem = onClickItem,
onLongClickItem = onLongClickItem,
@ -123,7 +121,7 @@ private fun SourceItem(
if (source.supportsLatest) {
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,
),
@ -151,7 +149,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,
@ -174,7 +172,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
@ -184,7 +182,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()

View File

@ -4,11 +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.runtime.getValue
import androidx.compose.runtime.setValue
import androidx.compose.ui.res.stringResource
import eu.kanade.tachiyomi.R
import tachiyomi.domain.manga.model.Manga
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun RemoveMangaDialog(
@ -20,7 +18,7 @@ fun RemoveMangaDialog(
onDismissRequest = onDismissRequest,
dismissButton = {
TextButton(onClick = onDismissRequest) {
Text(text = stringResource(R.string.action_cancel))
Text(text = stringResource(MR.strings.action_cancel))
}
},
confirmButton = {
@ -30,14 +28,14 @@ fun RemoveMangaDialog(
onConfirm()
},
) {
Text(text = stringResource(R.string.action_remove))
Text(text = stringResource(MR.strings.action_remove))
}
},
title = {
Text(text = stringResource(R.string.are_you_sure))
Text(text = stringResource(MR.strings.are_you_sure))
},
text = {
Text(text = stringResource(R.string.remove_manga, mangaToRemove.title))
Text(text = stringResource(MR.strings.remove_manga, mangaToRemove.title))
},
)
}

View File

@ -10,18 +10,18 @@ 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.AppBarTitle
import eu.kanade.presentation.components.DropdownMenu
import eu.kanade.presentation.components.RadioMenuItem
import eu.kanade.presentation.components.SearchToolbar
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.source.ConfigurableSource
import eu.kanade.tachiyomi.source.Source
import kotlinx.collections.immutable.persistentListOf
import tachiyomi.domain.library.model.LibraryDisplayMode
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.source.local.LocalSource
@Composable
@ -58,7 +58,7 @@ fun BrowseSourceToolbar(
.apply {
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 {
@ -70,14 +70,14 @@ fun BrowseSourceToolbar(
if (isLocalSource) {
add(
AppBar.OverflowAction(
title = stringResource(R.string.label_help),
title = stringResource(MR.strings.label_help),
onClick = onHelpClick,
),
)
} else {
add(
AppBar.OverflowAction(
title = stringResource(R.string.action_open_in_web_view),
title = stringResource(MR.strings.action_open_in_web_view),
onClick = onWebViewClick,
),
)
@ -85,7 +85,7 @@ fun BrowseSourceToolbar(
if (isConfigurableSource) {
add(
AppBar.OverflowAction(
title = stringResource(R.string.action_settings),
title = stringResource(MR.strings.action_settings),
onClick = onSettingsClick,
),
)
@ -99,21 +99,21 @@ fun BrowseSourceToolbar(
onDismissRequest = { selectingDisplayMode = false },
) {
RadioMenuItem(
text = { Text(text = stringResource(R.string.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 = stringResource(R.string.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 = stringResource(R.string.action_display_list)) },
text = { Text(text = stringResource(MR.strings.action_display_list)) },
isChecked = displayMode == LibraryDisplayMode.List,
) {
selectingDisplayMode = false

View File

@ -13,15 +13,15 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.State
import androidx.compose.runtime.getValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import eu.kanade.presentation.library.components.CommonMangaItemDefaults
import eu.kanade.presentation.library.components.MangaComfortableGridItem
import eu.kanade.tachiyomi.R
import tachiyomi.domain.manga.model.Manga
import tachiyomi.domain.manga.model.MangaCover
import tachiyomi.domain.manga.model.asMangaCover
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun GlobalSearchCardRow(
@ -78,7 +78,7 @@ private fun MangaItem(
@Composable
private fun EmptyResultItem() {
Text(
text = stringResource(R.string.no_results_found),
text = stringResource(MR.strings.no_results_found),
modifier = Modifier
.padding(
horizontal = MaterialTheme.padding.medium,

View File

@ -12,7 +12,6 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
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.Error
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.Icon
@ -22,11 +21,11 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import eu.kanade.tachiyomi.R
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun GlobalSearchResultItem(
@ -93,7 +92,7 @@ fun GlobalSearchErrorResultItem(message: String?) {
Icon(imageVector = Icons.Outlined.Error, contentDescription = null)
Spacer(Modifier.height(4.dp))
Text(
text = message ?: stringResource(R.string.unknown_error),
text = message ?: stringResource(MR.strings.unknown_error),
textAlign = TextAlign.Center,
)
}

View File

@ -26,11 +26,11 @@ import androidx.compose.material3.VerticalDivider
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import eu.kanade.presentation.components.SearchToolbar
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.ui.browse.source.globalsearch.SourceFilter
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun GlobalSearchToolbar(
@ -85,7 +85,7 @@ fun GlobalSearchToolbar(
)
},
label = {
Text(text = stringResource(id = R.string.pinned_sources))
Text(text = stringResource(MR.strings.pinned_sources))
},
)
FilterChip(
@ -100,7 +100,7 @@ fun GlobalSearchToolbar(
)
},
label = {
Text(text = stringResource(id = R.string.all))
Text(text = stringResource(MR.strings.all))
},
)
@ -118,7 +118,7 @@ fun GlobalSearchToolbar(
)
},
label = {
Text(text = stringResource(id = R.string.has_results))
Text(text = stringResource(MR.strings.has_results))
},
)
}

View File

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

View File

@ -12,18 +12,18 @@ import androidx.compose.material.icons.outlined.SortByAlpha
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.CategoryListItem
import eu.kanade.presentation.components.AppBar
import eu.kanade.presentation.components.AppBarActions
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.ui.category.CategoryScreenState
import kotlinx.collections.immutable.persistentListOf
import tachiyomi.domain.category.model.Category
import tachiyomi.i18n.MR
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
@ -42,13 +42,13 @@ fun CategoryScreen(
Scaffold(
topBar = { scrollBehavior ->
AppBar(
title = stringResource(R.string.action_edit_categories),
title = stringResource(MR.strings.action_edit_categories),
navigateUp = navigateUp,
actions = {
AppBarActions(
persistentListOf(
AppBar.Action(
title = stringResource(R.string.action_sort),
title = stringResource(MR.strings.action_sort),
icon = Icons.Outlined.SortByAlpha,
onClick = onClickSortAlphabetically,
),
@ -67,7 +67,7 @@ fun CategoryScreen(
) { paddingValues ->
if (state.isEmpty) {
EmptyScreen(
textResource = R.string.information_empty_category,
stringRes = MR.strings.information_empty_category,
modifier = Modifier.padding(paddingValues),
)
return@Scaffold
@ -107,7 +107,6 @@ private fun CategoryContent(
key = { _, category -> "category-${category.id}" },
) { index, category ->
CategoryListItem(
modifier = Modifier.animateItemPlacement(),
category = category,
canMoveUp = index != 0,
canMoveDown = index != categories.lastIndex,

View File

@ -25,14 +25,14 @@ 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 eu.kanade.core.preference.asToggleableState
import eu.kanade.presentation.category.visualName
import eu.kanade.tachiyomi.R
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
@ -56,28 +56,28 @@ 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 = {
Text(text = stringResource(R.string.action_add_category))
Text(text = stringResource(MR.strings.action_add_category))
},
text = {
OutlinedTextField(
modifier = Modifier.focusRequester(focusRequester),
value = name,
onValueChange = { name = it },
label = { Text(text = stringResource(R.string.name)) },
label = { Text(text = stringResource(MR.strings.name)) },
supportingText = {
val msgRes = if (name.isNotEmpty() && nameAlreadyExists) {
R.string.error_category_exists
MR.strings.error_category_exists
} else {
R.string.information_required_plain
MR.strings.information_required_plain
}
Text(text = stringResource(msgRes))
},
@ -117,16 +117,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(
@ -136,12 +136,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) {
R.string.error_category_exists
MR.strings.error_category_exists
} else {
R.string.information_required_plain
MR.strings.information_required_plain
}
Text(text = stringResource(msgRes))
},
@ -171,19 +171,19 @@ 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 = {
Text(text = stringResource(R.string.delete_category))
Text(text = stringResource(MR.strings.delete_category))
},
text = {
Text(text = stringResource(R.string.delete_category_confirmation, category.name))
Text(text = stringResource(MR.strings.delete_category_confirmation, category.name))
},
)
}
@ -200,19 +200,19 @@ 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))
},
)
}
@ -234,14 +234,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
@ -255,11 +255,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 = {
@ -274,12 +274,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(

View File

@ -6,9 +6,9 @@ import androidx.compose.material.icons.outlined.Add
import androidx.compose.material3.Icon
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.res.stringResource
import eu.kanade.tachiyomi.R
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.ExtendedFloatingActionButton
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.isScrolledToEnd
import tachiyomi.presentation.core.util.isScrollingUp
@ -18,7 +18,7 @@ fun CategoryFloatingActionButton(
onCreate: () -> Unit,
) {
ExtendedFloatingActionButton(
text = { Text(text = stringResource(R.string.action_add)) },
text = { Text(text = stringResource(MR.strings.action_add)) },
icon = { Icon(imageVector = Icons.Outlined.Add, contentDescription = null) },
onClick = onCreate,
expanded = lazyListState.isScrollingUp() || lazyListState.isScrolledToEnd(),

View File

@ -11,7 +11,6 @@ import androidx.compose.material.icons.outlined.ArrowDropDown
import androidx.compose.material.icons.outlined.ArrowDropUp
import androidx.compose.material.icons.outlined.Delete
import androidx.compose.material.icons.outlined.Edit
import androidx.compose.material.icons.outlined.Label
import androidx.compose.material3.ElevatedCard
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
@ -20,10 +19,10 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import eu.kanade.tachiyomi.R
import tachiyomi.domain.category.model.Category
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun CategoryListItem(
@ -74,11 +73,11 @@ fun CategoryListItem(
IconButton(onClick = onRename) {
Icon(
imageVector = Icons.Outlined.Edit,
contentDescription = stringResource(R.string.action_rename_category),
contentDescription = stringResource(MR.strings.action_rename_category),
)
}
IconButton(onClick = onDelete) {
Icon(imageVector = Icons.Outlined.Delete, contentDescription = stringResource(R.string.action_delete))
Icon(imageVector = Icons.Outlined.Delete, contentDescription = stringResource(MR.strings.action_delete))
}
}
}

View File

@ -50,8 +50,9 @@ import androidx.compose.ui.text.input.VisualTransformation
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import eu.kanade.tachiyomi.R
import kotlinx.collections.immutable.ImmutableList
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.clearFocusOnSoftKeyboardHide
import tachiyomi.presentation.core.util.runOnEnterKeyPressed
import tachiyomi.presentation.core.util.secondaryItemAlpha
@ -133,7 +134,7 @@ fun AppBar(
IconButton(onClick = onCancelActionMode) {
Icon(
imageVector = Icons.Outlined.Close,
contentDescription = stringResource(R.string.action_cancel),
contentDescription = stringResource(MR.strings.action_cancel),
)
}
} else {
@ -218,7 +219,7 @@ fun AppBarActions(
positionProvider = TooltipDefaults.rememberPlainTooltipPositionProvider(),
tooltip = {
PlainTooltip {
Text(stringResource(R.string.abc_action_menu_overflow_description))
Text(stringResource(MR.strings.action_menu_overflow_description))
}
},
state = rememberTooltipState(),
@ -228,7 +229,7 @@ fun AppBarActions(
) {
Icon(
Icons.Outlined.MoreVert,
contentDescription = stringResource(R.string.abc_action_menu_overflow_description),
contentDescription = stringResource(MR.strings.action_menu_overflow_description),
)
}
}
@ -253,7 +254,7 @@ fun AppBarActions(
/**
* @param searchEnabled Set to false if you don't want to show search action.
* @param searchQuery If null, use normal toolbar.
* @param placeholderText If null, [R.string.action_search_hint] is used.
* @param placeholderText If null, [MR.strings.action_search_hint] is used.
*/
@Composable
fun SearchToolbar(
@ -317,7 +318,7 @@ fun SearchToolbar(
placeholder = {
Text(
modifier = Modifier.secondaryItemAlpha(),
text = (placeholderText ?: stringResource(R.string.action_search_hint)),
text = (placeholderText ?: stringResource(MR.strings.action_search_hint)),
maxLines = 1,
overflow = TextOverflow.Ellipsis,
style = MaterialTheme.typography.titleMedium.copy(
@ -342,7 +343,7 @@ fun SearchToolbar(
positionProvider = TooltipDefaults.rememberPlainTooltipPositionProvider(),
tooltip = {
PlainTooltip {
Text(stringResource(R.string.action_search))
Text(stringResource(MR.strings.action_search))
}
},
state = rememberTooltipState(),
@ -352,7 +353,7 @@ fun SearchToolbar(
) {
Icon(
Icons.Outlined.Search,
contentDescription = stringResource(R.string.action_search),
contentDescription = stringResource(MR.strings.action_search),
)
}
}
@ -361,7 +362,7 @@ fun SearchToolbar(
positionProvider = TooltipDefaults.rememberPlainTooltipPositionProvider(),
tooltip = {
PlainTooltip {
Text(stringResource(R.string.action_reset))
Text(stringResource(MR.strings.action_reset))
}
},
state = rememberTooltipState(),
@ -374,7 +375,7 @@ fun SearchToolbar(
) {
Icon(
Icons.Outlined.Close,
contentDescription = stringResource(R.string.action_reset),
contentDescription = stringResource(MR.strings.action_reset),
)
}
}
@ -394,7 +395,7 @@ fun UpIcon(navigationIcon: ImageVector? = null) {
?: Icons.AutoMirrored.Outlined.ArrowBack
Icon(
imageVector = icon,
contentDescription = stringResource(R.string.abc_action_bar_up_description),
contentDescription = stringResource(MR.strings.action_bar_up_description),
)
}

View File

@ -1,6 +1,5 @@
package eu.kanade.presentation.components
import androidx.annotation.StringRes
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.expandVertically
import androidx.compose.animation.shrinkVertically
@ -26,13 +25,14 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.SubcomposeLayout
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.compose.ui.util.fastForEach
import androidx.compose.ui.util.fastMap
import androidx.compose.ui.util.fastMaxBy
import eu.kanade.tachiyomi.R
import dev.icerock.moko.resources.StringResource
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.stringResource
val DownloadedOnlyBannerBackgroundColor
@Composable get() = MaterialTheme.colorScheme.tertiary
@ -43,7 +43,7 @@ val IndexingBannerBackgroundColor
@Composable
fun WarningBanner(
@StringRes textRes: Int,
textRes: StringResource,
modifier: Modifier = Modifier,
) {
Text(
@ -127,7 +127,7 @@ fun AppStateBanners(
@Composable
private fun DownloadedOnlyModeBanner(modifier: Modifier = Modifier) {
Text(
text = stringResource(R.string.label_downloaded_only),
text = stringResource(MR.strings.label_downloaded_only),
modifier = Modifier
.background(DownloadedOnlyBannerBackgroundColor)
.fillMaxWidth()
@ -142,7 +142,7 @@ private fun DownloadedOnlyModeBanner(modifier: Modifier = Modifier) {
@Composable
private fun IncognitoModeBanner(modifier: Modifier = Modifier) {
Text(
text = stringResource(R.string.pref_incognito_mode),
text = stringResource(MR.strings.pref_incognito_mode),
modifier = Modifier
.background(IncognitoModeBannerBackgroundColor)
.fillMaxWidth()
@ -173,7 +173,7 @@ private fun IndexingDownloadBanner(modifier: Modifier = Modifier) {
)
Spacer(modifier = Modifier.width(8.dp))
Text(
text = stringResource(R.string.download_notifier_cache_renewal),
text = stringResource(MR.strings.download_notifier_cache_renewal),
color = MaterialTheme.colorScheme.onSecondary,
textAlign = TextAlign.Center,
style = MaterialTheme.typography.labelMedium,

View File

@ -3,10 +3,10 @@ package eu.kanade.presentation.components
import androidx.compose.material3.DropdownMenuItem
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.res.pluralStringResource
import androidx.compose.ui.res.stringResource
import eu.kanade.presentation.manga.DownloadAction
import eu.kanade.tachiyomi.R
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.pluralStringResource
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun DownloadDropdownMenu(
@ -19,11 +19,11 @@ fun DownloadDropdownMenu(
onDismissRequest = onDismissRequest,
) {
listOfNotNull(
DownloadAction.NEXT_1_CHAPTER to pluralStringResource(R.plurals.download_amount, 1, 1),
DownloadAction.NEXT_5_CHAPTERS to pluralStringResource(R.plurals.download_amount, 5, 5),
DownloadAction.NEXT_10_CHAPTERS to pluralStringResource(R.plurals.download_amount, 10, 10),
DownloadAction.NEXT_25_CHAPTERS to pluralStringResource(R.plurals.download_amount, 25, 25),
DownloadAction.UNREAD_CHAPTERS to stringResource(R.string.download_unread),
DownloadAction.NEXT_1_CHAPTER to pluralStringResource(MR.plurals.download_amount, 1, 1),
DownloadAction.NEXT_5_CHAPTERS to pluralStringResource(MR.plurals.download_amount, 5, 5),
DownloadAction.NEXT_10_CHAPTERS to pluralStringResource(MR.plurals.download_amount, 10, 10),
DownloadAction.NEXT_25_CHAPTERS to pluralStringResource(MR.plurals.download_amount, 25, 25),
DownloadAction.UNREAD_CHAPTERS to stringResource(MR.strings.download_unread),
).map { (downloadAction, string) ->
DropdownMenuItem(
text = { Text(text = string) },

View File

@ -15,11 +15,11 @@ 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 androidx.compose.ui.window.PopupProperties
import eu.kanade.tachiyomi.R
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.stringResource
import androidx.compose.material3.DropdownMenu as ComposeDropdownMenu
@Composable
@ -54,13 +54,13 @@ fun RadioMenuItem(
if (isChecked) {
Icon(
imageVector = Icons.Outlined.RadioButtonChecked,
contentDescription = stringResource(R.string.selected),
contentDescription = stringResource(MR.strings.selected),
tint = MaterialTheme.colorScheme.primary,
)
} else {
Icon(
imageVector = Icons.Outlined.RadioButtonUnchecked,
contentDescription = stringResource(R.string.not_selected),
contentDescription = stringResource(MR.strings.not_selected),
)
}
},

View File

@ -2,14 +2,13 @@ package eu.kanade.presentation.components
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.outlined.HelpOutline
import androidx.compose.material.icons.outlined.HelpOutline
import androidx.compose.material.icons.outlined.Refresh
import androidx.compose.material3.Surface
import androidx.compose.runtime.Composable
import androidx.compose.ui.tooling.preview.PreviewLightDark
import eu.kanade.presentation.theme.TachiyomiTheme
import eu.kanade.tachiyomi.R
import kotlinx.collections.immutable.persistentListOf
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.screens.EmptyScreen
import tachiyomi.presentation.core.screens.EmptyScreenAction
@ -19,7 +18,7 @@ private fun NoActionPreview() {
TachiyomiTheme {
Surface {
EmptyScreen(
textResource = R.string.empty_screen,
stringRes = MR.strings.empty_screen,
)
}
}
@ -31,15 +30,15 @@ private fun WithActionPreview() {
TachiyomiTheme {
Surface {
EmptyScreen(
textResource = R.string.empty_screen,
stringRes = MR.strings.empty_screen,
actions = persistentListOf(
EmptyScreenAction(
stringResId = R.string.action_retry,
stringRes = MR.strings.action_retry,
icon = Icons.Outlined.Refresh,
onClick = {},
),
EmptyScreenAction(
stringResId = R.string.getting_started_guide,
stringRes = MR.strings.getting_started_guide,
icon = Icons.AutoMirrored.Outlined.HelpOutline,
onClick = {},
),

View File

@ -24,14 +24,14 @@ import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.compose.ui.util.fastForEachIndexed
import eu.kanade.tachiyomi.R
import kotlinx.collections.immutable.ImmutableList
import kotlinx.coroutines.launch
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.HorizontalPager
import tachiyomi.presentation.core.components.material.TabText
import tachiyomi.presentation.core.i18n.stringResource
object TabbedDialogPaddings {
val Horizontal = 24.dp
@ -94,7 +94,7 @@ private fun MoreMenu(
IconButton(onClick = { expanded = true }) {
Icon(
imageVector = Icons.Default.MoreVert,
contentDescription = stringResource(R.string.label_more),
contentDescription = stringResource(MR.strings.label_more),
)
}
DropdownMenu(

View File

@ -1,6 +1,5 @@
package eu.kanade.presentation.components
import androidx.annotation.StringRes
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.calculateEndPadding
@ -20,17 +19,18 @@ import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalLayoutDirection
import androidx.compose.ui.res.stringResource
import dev.icerock.moko.resources.StringResource
import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.persistentListOf
import kotlinx.coroutines.launch
import tachiyomi.presentation.core.components.HorizontalPager
import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.components.material.TabText
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun TabbedScreen(
@StringRes titleRes: Int,
titleRes: StringResource,
tabs: ImmutableList<TabContent>,
startIndex: Int? = null,
searchQuery: String? = null,
@ -96,7 +96,7 @@ fun TabbedScreen(
}
data class TabContent(
@StringRes val titleRes: Int,
val titleRes: StringResource,
val badgeNumber: Int? = null,
val searchEnabled: Boolean = false,
val actions: ImmutableList<AppBar.Action> = persistentListOf(),

View File

@ -13,13 +13,13 @@ import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.PreviewLightDark
import eu.kanade.presentation.theme.TachiyomiTheme
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.util.CrashLogUtil
import kotlinx.coroutines.launch
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.screens.InfoScreen
@Composable
@ -32,15 +32,15 @@ fun CrashScreen(
InfoScreen(
icon = Icons.Outlined.BugReport,
headingText = stringResource(R.string.crash_screen_title),
subtitleText = stringResource(R.string.crash_screen_description, stringResource(R.string.app_name)),
acceptText = stringResource(R.string.pref_dump_crash_logs),
headingText = stringResource(MR.strings.crash_screen_title),
subtitleText = stringResource(MR.strings.crash_screen_description, stringResource(MR.strings.app_name)),
acceptText = stringResource(MR.strings.pref_dump_crash_logs),
onAcceptClick = {
scope.launch {
CrashLogUtil(context).dumpLogs()
}
},
rejectText = stringResource(R.string.crash_screen_restart_application),
rejectText = stringResource(MR.strings.crash_screen_restart_application),
onRejectClick = onRestartClick,
) {
Box(

View File

@ -10,7 +10,6 @@ import androidx.compose.material3.SnackbarHostState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.PreviewLightDark
import androidx.compose.ui.tooling.preview.PreviewParameter
import eu.kanade.domain.ui.UiPreferences
@ -21,13 +20,14 @@ import eu.kanade.presentation.components.RelativeDateHeader
import eu.kanade.presentation.components.SearchToolbar
import eu.kanade.presentation.history.components.HistoryItem
import eu.kanade.presentation.theme.TachiyomiTheme
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.ui.history.HistoryScreenModel
import kotlinx.collections.immutable.persistentListOf
import tachiyomi.core.preference.InMemoryPreferenceStore
import tachiyomi.domain.history.model.HistoryWithRelations
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.FastScrollLazyColumn
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 uy.kohesive.injekt.Injekt
@ -47,14 +47,14 @@ fun HistoryScreen(
Scaffold(
topBar = { scrollBehavior ->
SearchToolbar(
titleContent = { AppBarTitle(stringResource(R.string.history)) },
titleContent = { AppBarTitle(stringResource(MR.strings.history)) },
searchQuery = state.searchQuery,
onChangeSearchQuery = onSearchQueryChange,
actions = {
AppBarActions(
persistentListOf(
AppBar.Action(
title = stringResource(R.string.pref_clear_history),
title = stringResource(MR.strings.pref_clear_history),
icon = Icons.Outlined.DeleteSweep,
onClick = {
onDialogChange(HistoryScreenModel.Dialog.DeleteAll)
@ -73,12 +73,12 @@ fun HistoryScreen(
LoadingScreen(Modifier.padding(contentPadding))
} else if (it.isEmpty()) {
val msg = if (!state.searchQuery.isNullOrEmpty()) {
R.string.no_results_found
MR.strings.no_results_found
} else {
R.string.information_no_recent_manga
MR.strings.information_no_recent_manga
}
EmptyScreen(
textResource = msg,
stringRes = msg,
modifier = Modifier.padding(contentPadding),
)
} else {
@ -123,7 +123,6 @@ private fun HistoryScreenContent(
when (item) {
is HistoryUiModel.Header -> {
RelativeDateHeader(
modifier = Modifier.animateItemPlacement(),
date = item.date,
relativeTime = relativeTime,
dateFormat = dateFormat,
@ -132,7 +131,6 @@ private fun HistoryScreenContent(
is HistoryUiModel.Item -> {
val value = item.item
HistoryItem(
modifier = Modifier.animateItemPlacement(),
history = value,
onClickCover = { onClickCover(value) },
onClickResume = { onClickResume(value) },

View File

@ -10,12 +10,12 @@ 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 androidx.compose.ui.tooling.preview.PreviewLightDark
import androidx.compose.ui.unit.dp
import eu.kanade.presentation.theme.TachiyomiTheme
import eu.kanade.tachiyomi.R
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.LabeledCheckbox
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun HistoryDeleteDialog(
@ -26,16 +26,16 @@ fun HistoryDeleteDialog(
AlertDialog(
title = {
Text(text = stringResource(R.string.action_remove))
Text(text = stringResource(MR.strings.action_remove))
},
text = {
Column(
verticalArrangement = Arrangement.spacedBy(8.dp),
) {
Text(text = stringResource(R.string.dialog_with_checkbox_remove_description))
Text(text = stringResource(MR.strings.dialog_with_checkbox_remove_description))
LabeledCheckbox(
label = stringResource(R.string.dialog_with_checkbox_reset),
label = stringResource(MR.strings.dialog_with_checkbox_reset),
checked = removeEverything,
onCheckedChange = { removeEverything = it },
)
@ -47,12 +47,12 @@ fun HistoryDeleteDialog(
onDelete(removeEverything)
onDismissRequest()
}) {
Text(text = stringResource(R.string.action_remove))
Text(text = stringResource(MR.strings.action_remove))
}
},
dismissButton = {
TextButton(onClick = onDismissRequest) {
Text(text = stringResource(R.string.action_cancel))
Text(text = stringResource(MR.strings.action_cancel))
}
},
)
@ -65,10 +65,10 @@ fun HistoryDeleteAllDialog(
) {
AlertDialog(
title = {
Text(text = stringResource(R.string.action_remove_everything))
Text(text = stringResource(MR.strings.action_remove_everything))
},
text = {
Text(text = stringResource(R.string.clear_history_confirmation))
Text(text = stringResource(MR.strings.clear_history_confirmation))
},
onDismissRequest = onDismissRequest,
confirmButton = {
@ -76,12 +76,12 @@ fun HistoryDeleteAllDialog(
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))
}
},
)

View File

@ -17,7 +17,6 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.PreviewLightDark
@ -26,10 +25,11 @@ import androidx.compose.ui.unit.dp
import eu.kanade.presentation.manga.components.MangaCover
import eu.kanade.presentation.theme.TachiyomiTheme
import eu.kanade.presentation.util.formatChapterNumber
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.util.lang.toTimestampString
import tachiyomi.domain.history.model.HistoryWithRelations
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.i18n.stringResource
private val HistoryItemHeight = 96.dp
@ -70,7 +70,7 @@ fun HistoryItem(
Text(
text = if (history.chapterNumber > -1) {
stringResource(
R.string.recent_manga_time,
MR.strings.recent_manga_time,
formatChapterNumber(history.chapterNumber),
readAt,
)
@ -85,7 +85,7 @@ fun HistoryItem(
IconButton(onClick = onClickDelete) {
Icon(
imageVector = Icons.Outlined.Delete,
contentDescription = stringResource(R.string.action_delete),
contentDescription = stringResource(MR.strings.action_delete),
tint = MaterialTheme.colorScheme.onSurface,
)
}

View File

@ -9,10 +9,11 @@ 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.tachiyomi.R
import dev.icerock.moko.resources.StringResource
import tachiyomi.core.preference.CheckboxState
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.LabeledCheckbox
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun DeleteLibraryMangaDialog(
@ -22,10 +23,10 @@ fun DeleteLibraryMangaDialog(
) {
var list by remember {
mutableStateOf(
buildList<CheckboxState.State<Int>> {
add(CheckboxState.State.None(R.string.manga_from_library))
buildList<CheckboxState.State<StringResource>> {
add(CheckboxState.State.None(MR.strings.manga_from_library))
if (!containsLocalManga) {
add(CheckboxState.State.None(R.string.downloaded_chapters))
add(CheckboxState.State.None(MR.strings.downloaded_chapters))
}
},
)
@ -34,7 +35,7 @@ fun DeleteLibraryMangaDialog(
onDismissRequest = onDismissRequest,
dismissButton = {
TextButton(onClick = onDismissRequest) {
Text(text = stringResource(R.string.action_cancel))
Text(text = stringResource(MR.strings.action_cancel))
}
},
confirmButton = {
@ -48,11 +49,11 @@ fun DeleteLibraryMangaDialog(
)
},
) {
Text(text = stringResource(R.string.action_ok))
Text(text = stringResource(MR.strings.action_ok))
}
},
title = {
Text(text = stringResource(R.string.action_remove))
Text(text = stringResource(MR.strings.action_remove))
},
text = {
Column {
@ -64,7 +65,7 @@ fun DeleteLibraryMangaDialog(
val index = list.indexOf(state)
if (index != -1) {
val mutableList = list.toMutableList()
mutableList[index] = state.next() as CheckboxState.State<Int>
mutableList[index] = state.next() as CheckboxState.State<StringResource>
list = mutableList.toList()
}
},

View File

@ -13,10 +13,8 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.res.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 tachiyomi.core.preference.TriState
@ -25,12 +23,14 @@ import tachiyomi.domain.library.model.LibraryDisplayMode
import tachiyomi.domain.library.model.LibrarySort
import tachiyomi.domain.library.model.sort
import tachiyomi.domain.library.service.LibraryPreferences
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.CheckboxItem
import tachiyomi.presentation.core.components.HeadingItem
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
@ -42,9 +42,9 @@ 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),
),
) { page ->
Column(
@ -75,7 +75,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 {
@ -86,25 +86,25 @@ 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) },
)
@ -118,13 +118,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(
@ -149,18 +149,18 @@ 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)
}
listOf(
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,
).plus(trackerSortOption).map { (titleRes, mode) ->
SortItem(
label = stringResource(titleRes),
@ -186,10 +186,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
@ -197,7 +197,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,
@ -219,43 +219,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(),
)
}

View File

@ -33,14 +33,14 @@ import androidx.compose.ui.draw.drawBehind
import androidx.compose.ui.graphics.Brush
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Shadow
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.TextStyle
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 tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.BadgeGroup
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.selectedBackground
object CommonMangaItemDefaults {
@ -378,7 +378,7 @@ private fun ContinueReadingButton(
) {
Icon(
imageVector = Icons.Filled.PlayArrow,
contentDescription = stringResource(R.string.action_resume),
contentDescription = stringResource(MR.strings.action_resume),
modifier = Modifier.size(16.dp),
)
}

View File

@ -4,9 +4,9 @@ import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.zIndex
import eu.kanade.tachiyomi.R
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.stringResource
@Composable
internal fun GlobalSearchItem(
@ -19,7 +19,7 @@ internal fun GlobalSearchItem(
onClick = onClick,
) {
Text(
text = stringResource(R.string.action_global_search_query, searchQuery),
text = stringResource(MR.strings.action_global_search_query, searchQuery),
modifier = Modifier.zIndex(99f),
)
}

View File

@ -18,10 +18,10 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.unit.dp
import eu.kanade.core.preference.PreferenceMutableState
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.ui.library.LibraryItem
import tachiyomi.domain.library.model.LibraryDisplayMode
import tachiyomi.domain.library.model.LibraryManga
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.HorizontalPager
import tachiyomi.presentation.core.screens.EmptyScreen
import tachiyomi.presentation.core.util.plus
@ -124,9 +124,9 @@ private fun LibraryPagerEmptyScreen(
onGlobalSearchClicked: () -> Unit,
) {
val msg = when {
!searchQuery.isNullOrEmpty() -> R.string.no_results_found
hasActiveFilters -> R.string.error_no_match
else -> R.string.information_no_manga_category
!searchQuery.isNullOrEmpty() -> MR.strings.no_results_found
hasActiveFilters -> MR.strings.error_no_match
else -> MR.strings.information_no_manga_category
}
Column(
@ -146,7 +146,7 @@ private fun LibraryPagerEmptyScreen(
}
EmptyScreen(
textResource = msg,
stringRes = msg,
modifier = Modifier.weight(1f),
)
}

View File

@ -14,15 +14,15 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.Immutable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.sp
import eu.kanade.presentation.components.AppBar
import eu.kanade.presentation.components.AppBarActions
import eu.kanade.presentation.components.SearchToolbar
import eu.kanade.tachiyomi.R
import kotlinx.collections.immutable.persistentListOf
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.Pill
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.theme.active
@Composable
@ -98,21 +98,21 @@ private fun LibraryRegularToolbar(
AppBarActions(
persistentListOf(
AppBar.Action(
title = stringResource(R.string.action_filter),
title = stringResource(MR.strings.action_filter),
icon = Icons.Outlined.FilterList,
iconTint = filterTint,
onClick = onClickFilter,
),
AppBar.OverflowAction(
title = stringResource(R.string.action_update_library),
title = stringResource(MR.strings.action_update_library),
onClick = onClickGlobalUpdate,
),
AppBar.OverflowAction(
title = stringResource(R.string.action_update_category),
title = stringResource(MR.strings.action_update_category),
onClick = onClickRefresh,
),
AppBar.OverflowAction(
title = stringResource(R.string.action_open_random_manga),
title = stringResource(MR.strings.action_open_random_manga),
onClick = onClickOpenRandomManga,
),
),
@ -135,12 +135,12 @@ private fun LibrarySelectionToolbar(
AppBarActions(
persistentListOf(
AppBar.Action(
title = stringResource(R.string.action_select_all),
title = stringResource(MR.strings.action_select_all),
icon = Icons.Outlined.SelectAll,
onClick = onClickSelectAll,
),
AppBar.Action(
title = stringResource(R.string.action_select_inverse),
title = stringResource(MR.strings.action_select_inverse),
icon = Icons.Outlined.FlipToBack,
onClick = onClickInvertSelection,
),

View File

@ -25,20 +25,20 @@ import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
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.domain.manga.model.downloadedFilter
import eu.kanade.domain.manga.model.forceDownloaded
import eu.kanade.presentation.components.TabbedDialog
import eu.kanade.presentation.components.TabbedDialogPaddings
import eu.kanade.tachiyomi.R
import kotlinx.collections.immutable.persistentListOf
import tachiyomi.core.preference.TriState
import tachiyomi.domain.manga.model.Manga
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.LabeledCheckbox
import tachiyomi.presentation.core.components.RadioItem
import tachiyomi.presentation.core.components.SortItem
import tachiyomi.presentation.core.components.TriStateItem
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.theme.active
@Composable
@ -66,20 +66,20 @@ fun ChapterSettingsDialog(
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),
),
tabOverflowMenuContent = { closeMenu ->
DropdownMenuItem(
text = { Text(stringResource(R.string.set_chapter_settings_as_default)) },
text = { Text(stringResource(MR.strings.set_chapter_settings_as_default)) },
onClick = {
showSetAsDefaultDialog = true
closeMenu()
},
)
DropdownMenuItem(
text = { Text(stringResource(R.string.action_reset)) },
text = { Text(stringResource(MR.strings.action_reset)) },
onClick = {
onResetToDefault()
closeMenu()
@ -136,17 +136,17 @@ private fun ColumnScope.FilterPage(
onScanlatorFilterClicked: (() -> Unit),
) {
TriStateItem(
label = stringResource(R.string.label_downloaded),
label = stringResource(MR.strings.label_downloaded),
state = downloadFilter,
onClick = onDownloadFilterChanged,
)
TriStateItem(
label = stringResource(R.string.action_filter_unread),
label = stringResource(MR.strings.action_filter_unread),
state = unreadFilter,
onClick = onUnreadFilterChanged,
)
TriStateItem(
label = stringResource(R.string.action_filter_bookmarked),
label = stringResource(MR.strings.action_filter_bookmarked),
state = bookmarkedFilter,
onClick = onBookmarkedFilterChanged,
)
@ -179,7 +179,7 @@ fun ScanlatorFilterItem(
},
)
Text(
text = stringResource(R.string.scanlator),
text = stringResource(MR.strings.scanlator),
style = MaterialTheme.typography.bodyMedium,
)
}
@ -192,10 +192,10 @@ private fun ColumnScope.SortPage(
onItemSelected: (Long) -> Unit,
) {
listOf(
R.string.sort_by_source to Manga.CHAPTER_SORTING_SOURCE,
R.string.sort_by_number to Manga.CHAPTER_SORTING_NUMBER,
R.string.sort_by_upload_date to Manga.CHAPTER_SORTING_UPLOAD_DATE,
R.string.action_sort_alpha to Manga.CHAPTER_SORTING_ALPHABET,
MR.strings.sort_by_source to Manga.CHAPTER_SORTING_SOURCE,
MR.strings.sort_by_number to Manga.CHAPTER_SORTING_NUMBER,
MR.strings.sort_by_upload_date to Manga.CHAPTER_SORTING_UPLOAD_DATE,
MR.strings.action_sort_alpha to Manga.CHAPTER_SORTING_ALPHABET,
).map { (titleRes, mode) ->
SortItem(
label = stringResource(titleRes),
@ -211,8 +211,8 @@ private fun ColumnScope.DisplayPage(
onItemSelected: (Long) -> Unit,
) {
listOf(
R.string.show_title to Manga.CHAPTER_DISPLAY_NAME,
R.string.show_chapter_number to Manga.CHAPTER_DISPLAY_NUMBER,
MR.strings.show_title to Manga.CHAPTER_DISPLAY_NAME,
MR.strings.show_chapter_number to Manga.CHAPTER_DISPLAY_NUMBER,
).map { (titleRes, mode) ->
RadioItem(
label = stringResource(titleRes),
@ -231,15 +231,15 @@ private fun SetAsDefaultDialog(
AlertDialog(
onDismissRequest = onDismissRequest,
title = { Text(text = stringResource(R.string.chapter_settings)) },
title = { Text(text = stringResource(MR.strings.chapter_settings)) },
text = {
Column(
verticalArrangement = Arrangement.spacedBy(12.dp),
) {
Text(text = stringResource(R.string.confirm_set_chapter_settings))
Text(text = stringResource(MR.strings.confirm_set_chapter_settings))
LabeledCheckbox(
label = stringResource(R.string.also_set_chapter_settings_for_library),
label = stringResource(MR.strings.also_set_chapter_settings_for_library),
checked = optionalChecked,
onCheckedChange = { optionalChecked = it },
)
@ -247,7 +247,7 @@ private fun SetAsDefaultDialog(
},
dismissButton = {
TextButton(onClick = onDismissRequest) {
Text(text = stringResource(R.string.action_cancel))
Text(text = stringResource(MR.strings.action_cancel))
}
},
confirmButton = {
@ -257,7 +257,7 @@ private fun SetAsDefaultDialog(
onDismissRequest()
},
) {
Text(text = stringResource(R.string.action_ok))
Text(text = stringResource(MR.strings.action_ok))
}
},
)

View File

@ -8,9 +8,9 @@ import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
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.MR
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun DuplicateMangaDialog(
@ -21,10 +21,10 @@ fun DuplicateMangaDialog(
AlertDialog(
onDismissRequest = onDismissRequest,
title = {
Text(text = stringResource(R.string.are_you_sure))
Text(text = stringResource(MR.strings.are_you_sure))
},
text = {
Text(text = stringResource(R.string.confirm_add_duplicate_manga))
Text(text = stringResource(MR.strings.confirm_add_duplicate_manga))
},
confirmButton = {
FlowRow(
@ -36,13 +36,13 @@ fun DuplicateMangaDialog(
onOpenManga()
},
) {
Text(text = stringResource(R.string.action_show_manga))
Text(text = stringResource(MR.strings.action_show_manga))
}
Spacer(modifier = Modifier.weight(1f))
TextButton(onClick = onDismissRequest) {
Text(text = stringResource(R.string.action_cancel))
Text(text = stringResource(MR.strings.action_cancel))
}
TextButton(
onClick = {
@ -50,7 +50,7 @@ fun DuplicateMangaDialog(
onConfirm()
},
) {
Text(text = stringResource(R.string.action_add))
Text(text = stringResource(MR.strings.action_add))
}
}
},

View File

@ -44,7 +44,6 @@ import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.platform.LocalHapticFeedback
import androidx.compose.ui.platform.LocalLayoutDirection
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.util.fastAll
import androidx.compose.ui.util.fastAny
import androidx.compose.ui.util.fastMap
@ -58,7 +57,6 @@ import eu.kanade.presentation.manga.components.MangaInfoBox
import eu.kanade.presentation.manga.components.MangaToolbar
import eu.kanade.presentation.manga.components.MissingChapterCountListItem
import eu.kanade.presentation.util.formatChapterNumber
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.download.model.Download
import eu.kanade.tachiyomi.source.getNameForMangaInfo
import eu.kanade.tachiyomi.ui.manga.ChapterList
@ -70,11 +68,13 @@ import tachiyomi.domain.chapter.service.missingChaptersCount
import tachiyomi.domain.library.service.LibraryPreferences
import tachiyomi.domain.manga.model.Manga
import tachiyomi.domain.source.model.StubSource
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.TwoPanelBox
import tachiyomi.presentation.core.components.VerticalFastScroller
import tachiyomi.presentation.core.components.material.ExtendedFloatingActionButton
import tachiyomi.presentation.core.components.material.PullRefresh
import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.isScrolledToEnd
import tachiyomi.presentation.core.util.isScrollingUp
import java.text.DateFormat
@ -349,7 +349,9 @@ private fun MangaScreenSmallImpl(
val isReading = remember(state.chapters) {
state.chapters.fastAny { it.chapter.read }
}
Text(text = stringResource(if (isReading) R.string.action_resume else R.string.action_start))
Text(
text = stringResource(if (isReading) MR.strings.action_resume else MR.strings.action_start),
)
},
icon = { Icon(imageVector = Icons.Filled.PlayArrow, contentDescription = null) },
onClick = onContinueReading,
@ -608,7 +610,9 @@ fun MangaScreenLargeImpl(
state.chapters.fastAny { it.chapter.read }
}
Text(
text = stringResource(if (isReading) R.string.action_resume else R.string.action_start),
text = stringResource(
if (isReading) MR.strings.action_resume else MR.strings.action_start,
),
)
},
icon = { Icon(imageVector = Icons.Filled.PlayArrow, contentDescription = null) },
@ -788,7 +792,7 @@ private fun LazyListScope.sharedChapterItems(
MangaChapterListItem(
title = if (manga.displayMode == Manga.CHAPTER_DISPLAY_NUMBER) {
stringResource(
R.string.display_mode_chapter,
MR.strings.display_mode_chapter,
formatChapterNumber(item.chapter.chapterNumber),
)
} else {
@ -807,7 +811,7 @@ private fun LazyListScope.sharedChapterItems(
.takeIf { !item.chapter.read && it > 0L }
?.let {
stringResource(
R.string.chapter_progress,
MR.strings.chapter_progress,
it + 1,
)
},

View File

@ -29,13 +29,14 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.hapticfeedback.HapticFeedbackType
import androidx.compose.ui.platform.LocalHapticFeedback
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.unit.dp
import eu.kanade.presentation.components.DropdownMenu
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.download.model.Download
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.IconButtonTokens
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.secondaryItemAlpha
enum class ChapterDownloadAction {
@ -98,7 +99,7 @@ private fun NotDownloadedIndicator(
) {
Icon(
painter = painterResource(R.drawable.ic_download_chapter_24dp),
contentDescription = stringResource(R.string.manga_download),
contentDescription = stringResource(MR.strings.manga_download),
modifier = Modifier.size(IndicatorSize),
tint = MaterialTheme.colorScheme.onSurfaceVariant,
)
@ -156,14 +157,14 @@ private fun DownloadingIndicator(
}
DropdownMenu(expanded = isMenuExpanded, onDismissRequest = { isMenuExpanded = false }) {
DropdownMenuItem(
text = { Text(text = stringResource(R.string.action_start_downloading_now)) },
text = { Text(text = stringResource(MR.strings.action_start_downloading_now)) },
onClick = {
onClick(ChapterDownloadAction.START_NOW)
isMenuExpanded = false
},
)
DropdownMenuItem(
text = { Text(text = stringResource(R.string.action_cancel)) },
text = { Text(text = stringResource(MR.strings.action_cancel)) },
onClick = {
onClick(ChapterDownloadAction.CANCEL)
isMenuExpanded = false
@ -204,7 +205,7 @@ private fun DownloadedIndicator(
)
DropdownMenu(expanded = isMenuExpanded, onDismissRequest = { isMenuExpanded = false }) {
DropdownMenuItem(
text = { Text(text = stringResource(R.string.action_delete)) },
text = { Text(text = stringResource(MR.strings.action_delete)) },
onClick = {
onClick(ChapterDownloadAction.DELETE)
isMenuExpanded = false
@ -232,7 +233,7 @@ private fun ErrorIndicator(
) {
Icon(
imageVector = Icons.Outlined.ErrorOutline,
contentDescription = stringResource(R.string.chapter_error),
contentDescription = stringResource(MR.strings.chapter_error),
modifier = Modifier.size(IndicatorSize),
tint = MaterialTheme.colorScheme.error,
)

View File

@ -9,12 +9,12 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.pluralStringResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import eu.kanade.tachiyomi.R
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.SecondaryItemAlpha
import tachiyomi.presentation.core.i18n.pluralStringResource
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun ChapterHeader(
@ -35,9 +35,9 @@ fun ChapterHeader(
) {
Text(
text = if (chapterCount == null) {
stringResource(R.string.chapters)
stringResource(MR.strings.chapters)
} else {
pluralStringResource(id = R.plurals.manga_num_chapters, count = chapterCount, chapterCount)
pluralStringResource(MR.plurals.manga_num_chapters, count = chapterCount, chapterCount)
},
style = MaterialTheme.typography.titleMedium,
color = MaterialTheme.colorScheme.onBackground,
@ -54,7 +54,7 @@ private fun MissingChaptersWarning(count: Int) {
}
Text(
text = pluralStringResource(id = R.plurals.missing_chapters, count = count, count),
text = pluralStringResource(MR.plurals.missing_chapters, count = count, count),
maxLines = 1,
overflow = TextOverflow.Ellipsis,
style = MaterialTheme.typography.bodySmall,

View File

@ -29,7 +29,6 @@ import androidx.compose.material.icons.outlined.BookmarkRemove
import androidx.compose.material.icons.outlined.Delete
import androidx.compose.material.icons.outlined.DoneAll
import androidx.compose.material.icons.outlined.Download
import androidx.compose.material.icons.outlined.Label
import androidx.compose.material.icons.outlined.RemoveDone
import androidx.compose.material.ripple.rememberRipple
import androidx.compose.material3.Icon
@ -48,7 +47,6 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.hapticfeedback.HapticFeedbackType
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
@ -59,6 +57,8 @@ import kotlinx.coroutines.Job
import kotlinx.coroutines.delay
import kotlinx.coroutines.isActive
import kotlinx.coroutines.launch
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.stringResource
import kotlin.time.Duration.Companion.seconds
@Composable
@ -107,7 +107,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) },
@ -116,7 +116,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) },
@ -125,7 +125,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) },
@ -134,7 +134,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) },
@ -143,7 +143,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) },
@ -152,7 +152,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) },
@ -161,7 +161,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) },
@ -258,21 +258,21 @@ 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) },
onClick = onChangeCategoryClicked,
)
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) },
onClick = onMarkAsReadClicked,
)
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) },
@ -281,7 +281,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) },
@ -296,7 +296,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) },

View File

@ -42,23 +42,22 @@ import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.platform.LocalHapticFeedback
import androidx.compose.ui.platform.LocalViewConfiguration
import androidx.compose.ui.platform.ViewConfiguration
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.tachiyomi.R
import eu.kanade.tachiyomi.data.download.model.Download
import me.saket.swipe.SwipeableActionsBox
import me.saket.swipe.rememberSwipeableActionsState
import tachiyomi.domain.library.service.LibraryPreferences
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.ReadItemAlpha
import tachiyomi.presentation.core.components.material.SecondaryItemAlpha
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.selectedBackground
import kotlin.math.absoluteValue
@Composable
fun MangaChapterListItem(
modifier: Modifier = Modifier,
title: String,
date: String?,
readProgress: String?,
@ -75,6 +74,7 @@ fun MangaChapterListItem(
onClick: () -> Unit,
onDownloadClick: ((ChapterDownloadAction) -> Unit)?,
onChapterSwipe: (LibraryPreferences.ChapterSwipeAction) -> Unit,
modifier: Modifier = Modifier,
) {
val haptic = LocalHapticFeedback.current
val density = LocalDensity.current
@ -143,7 +143,7 @@ fun MangaChapterListItem(
if (!read) {
Icon(
imageVector = Icons.Filled.Circle,
contentDescription = stringResource(R.string.unread),
contentDescription = stringResource(MR.strings.unread),
modifier = Modifier
.height(8.dp)
.padding(end = 4.dp),
@ -153,7 +153,7 @@ fun MangaChapterListItem(
if (bookmark) {
Icon(
imageVector = Icons.Filled.Bookmark,
contentDescription = stringResource(R.string.action_filter_bookmarked),
contentDescription = stringResource(MR.strings.action_filter_bookmarked),
modifier = Modifier
.sizeIn(maxHeight = with(LocalDensity.current) { textHeight.toDp() - 2.dp }),
tint = MaterialTheme.colorScheme.primary,

View File

@ -32,7 +32,6 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.DpOffset
import androidx.compose.ui.unit.dp
import androidx.compose.ui.viewinterop.AndroidView
@ -47,11 +46,12 @@ import eu.kanade.presentation.components.AppBar
import eu.kanade.presentation.components.AppBarActions
import eu.kanade.presentation.components.DropdownMenu
import eu.kanade.presentation.manga.EditCoverAction
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.ui.reader.viewer.ReaderPageImageView
import kotlinx.collections.immutable.persistentListOf
import tachiyomi.domain.manga.model.Manga
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.clickableNoIndication
@Composable
@ -85,7 +85,7 @@ fun MangaCoverDialog(
IconButton(onClick = onDismissRequest) {
Icon(
imageVector = Icons.Outlined.Close,
contentDescription = stringResource(R.string.action_close),
contentDescription = stringResource(MR.strings.action_close),
)
}
}
@ -94,12 +94,12 @@ fun MangaCoverDialog(
AppBarActions(
actions = persistentListOf(
AppBar.Action(
title = stringResource(R.string.action_share),
title = stringResource(MR.strings.action_share),
icon = Icons.Outlined.Share,
onClick = onShareClick,
),
AppBar.Action(
title = stringResource(R.string.action_save),
title = stringResource(MR.strings.action_save),
icon = Icons.Outlined.Save,
onClick = onSaveClick,
),
@ -119,7 +119,7 @@ fun MangaCoverDialog(
) {
Icon(
imageVector = Icons.Outlined.Edit,
contentDescription = stringResource(R.string.action_edit_cover),
contentDescription = stringResource(MR.strings.action_edit_cover),
)
}
DropdownMenu(
@ -128,14 +128,14 @@ fun MangaCoverDialog(
offset = DpOffset(8.dp, 0.dp),
) {
DropdownMenuItem(
text = { Text(text = stringResource(R.string.action_edit)) },
text = { Text(text = stringResource(MR.strings.action_edit)) },
onClick = {
onEditClick(EditCoverAction.EDIT)
expanded = false
},
)
DropdownMenuItem(
text = { Text(text = stringResource(R.string.action_delete)) },
text = { Text(text = stringResource(MR.strings.action_delete)) },
onClick = {
onEditClick(EditCoverAction.DELETE)
expanded = false

View File

@ -12,13 +12,13 @@ import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
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 eu.kanade.tachiyomi.R
import kotlinx.collections.immutable.toImmutableList
import tachiyomi.domain.manga.interactor.FetchInterval
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.WheelTextPicker
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun DeleteChaptersDialog(
@ -29,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 = {
@ -39,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))
},
)
}
@ -61,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(),
@ -71,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()
}
@ -87,7 +87,7 @@ fun SetIntervalDialog(
},
dismissButton = {
TextButton(onClick = onDismissRequest) {
Text(text = stringResource(R.string.action_cancel))
Text(text = stringResource(MR.strings.action_cancel))
}
},
confirmButton = {
@ -95,7 +95,7 @@ fun SetIntervalDialog(
onValueChanged(selectedInterval)
onDismissRequest()
}) {
Text(text = stringResource(R.string.action_ok))
Text(text = stringResource(MR.strings.action_ok))
}
},
)

View File

@ -66,8 +66,6 @@ import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.layout.Layout
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.pluralStringResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.Constraints
@ -80,8 +78,11 @@ import eu.kanade.tachiyomi.R
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.presentation.core.components.material.TextButton
import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.i18n.pluralStringResource
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.clickableNoIndication
import tachiyomi.presentation.core.util.secondaryItemAlpha
import kotlin.math.absoluteValue
@ -178,9 +179,9 @@ fun MangaActionRow(
Row(modifier = modifier.padding(start = 16.dp, top = 8.dp, end = 16.dp)) {
MangaActionButton(
title = if (favorite) {
stringResource(R.string.in_library)
stringResource(MR.strings.in_library)
} else {
stringResource(R.string.add_to_library)
stringResource(MR.strings.add_to_library)
},
icon = if (favorite) Icons.Filled.Favorite else Icons.Outlined.FavoriteBorder,
color = if (favorite) MaterialTheme.colorScheme.primary else defaultActionButtonColor,
@ -190,7 +191,7 @@ fun MangaActionRow(
if (onEditIntervalClicked != null && fetchInterval != null) {
MangaActionButton(
title = pluralStringResource(
id = R.plurals.day,
MR.plurals.day,
count = fetchInterval.absoluteValue,
fetchInterval.absoluteValue,
),
@ -202,9 +203,9 @@ fun MangaActionRow(
if (onTrackingClicked != null) {
MangaActionButton(
title = if (trackingCount == 0) {
stringResource(R.string.manga_tracking_tab)
stringResource(MR.strings.manga_tracking_tab)
} else {
pluralStringResource(id = R.plurals.num_trackers, count = trackingCount, trackingCount)
pluralStringResource(MR.plurals.num_trackers, count = trackingCount, trackingCount)
},
icon = if (trackingCount == 0) Icons.Outlined.Sync else Icons.Outlined.Done,
color = if (trackingCount == 0) defaultActionButtonColor else MaterialTheme.colorScheme.primary,
@ -213,7 +214,7 @@ fun MangaActionRow(
}
if (onWebViewClicked != null) {
MangaActionButton(
title = stringResource(R.string.action_web_view),
title = stringResource(MR.strings.action_web_view),
icon = Icons.Outlined.Public,
color = defaultActionButtonColor,
onClick = onWebViewClicked,
@ -237,7 +238,7 @@ fun ExpandableMangaDescription(
mutableStateOf(defaultExpandState)
}
val desc =
description.takeIf { !it.isNullOrBlank() } ?: stringResource(R.string.description_placeholder)
description.takeIf { !it.isNullOrBlank() } ?: stringResource(MR.strings.description_placeholder)
val trimmedDescription = remember(desc) {
desc
.replace(whitespaceLineRegex, "\n")
@ -267,14 +268,14 @@ fun ExpandableMangaDescription(
onDismissRequest = { showMenu = false },
) {
DropdownMenuItem(
text = { Text(text = stringResource(R.string.action_search)) },
text = { Text(text = stringResource(MR.strings.action_search)) },
onClick = {
onTagSearch(tagSelected)
showMenu = false
},
)
DropdownMenuItem(
text = { Text(text = stringResource(R.string.action_copy_to_clipboard)) },
text = { Text(text = stringResource(MR.strings.action_copy_to_clipboard)) },
onClick = {
onCopyTagToClipboard(tagSelected)
showMenu = false
@ -341,7 +342,7 @@ private fun MangaAndSourceTitlesLarge(
MangaCover.Book(
modifier = Modifier.fillMaxWidth(0.65f),
data = coverDataProvider(),
contentDescription = stringResource(R.string.manga_cover),
contentDescription = stringResource(MR.strings.manga_cover),
onClick = onCoverClick,
)
Spacer(modifier = Modifier.height(16.dp))
@ -383,7 +384,7 @@ private fun MangaAndSourceTitlesSmall(
.sizeIn(maxWidth = 100.dp)
.align(Alignment.Top),
data = coverDataProvider(),
contentDescription = stringResource(R.string.manga_cover),
contentDescription = stringResource(MR.strings.manga_cover),
onClick = onCoverClick,
)
Column(
@ -415,7 +416,7 @@ private fun MangaContentInfo(
) {
val context = LocalContext.current
Text(
text = title.ifBlank { stringResource(R.string.unknown_title) },
text = title.ifBlank { stringResource(MR.strings.unknown_title) },
style = MaterialTheme.typography.titleLarge,
modifier = Modifier.clickableNoIndication(
onLongClick = {
@ -445,7 +446,7 @@ private fun MangaContentInfo(
)
Text(
text = author?.takeIf { it.isNotBlank() }
?: stringResource(R.string.unknown_author),
?: stringResource(MR.strings.unknown_author),
style = MaterialTheme.typography.titleSmall,
modifier = Modifier
.clickableNoIndication(
@ -511,13 +512,13 @@ private fun MangaContentInfo(
ProvideTextStyle(MaterialTheme.typography.bodyMedium) {
Text(
text = when (status) {
SManga.ONGOING.toLong() -> stringResource(R.string.ongoing)
SManga.COMPLETED.toLong() -> stringResource(R.string.completed)
SManga.LICENSED.toLong() -> stringResource(R.string.licensed)
SManga.PUBLISHING_FINISHED.toLong() -> stringResource(R.string.publishing_finished)
SManga.CANCELLED.toLong() -> stringResource(R.string.cancelled)
SManga.ON_HIATUS.toLong() -> stringResource(R.string.on_hiatus)
else -> stringResource(R.string.unknown)
SManga.ONGOING.toLong() -> stringResource(MR.strings.ongoing)
SManga.COMPLETED.toLong() -> stringResource(MR.strings.completed)
SManga.LICENSED.toLong() -> stringResource(MR.strings.licensed)
SManga.PUBLISHING_FINISHED.toLong() -> stringResource(MR.strings.publishing_finished)
SManga.CANCELLED.toLong() -> stringResource(MR.strings.cancelled)
SManga.ON_HIATUS.toLong() -> stringResource(MR.strings.on_hiatus)
else -> stringResource(MR.strings.unknown)
},
overflow = TextOverflow.Ellipsis,
maxLines = 1,
@ -592,7 +593,7 @@ private fun MangaSummary(
Icon(
painter = rememberAnimatedVectorPainter(image, !expanded),
contentDescription = stringResource(
if (expanded) R.string.manga_info_collapse else R.string.manga_info_expand,
if (expanded) MR.strings.manga_info_collapse else MR.strings.manga_info_expand,
),
tint = MaterialTheme.colorScheme.onBackground,
modifier = Modifier.background(Brush.radialGradient(colors = colors.asReversed())),

View File

@ -21,7 +21,6 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.alpha
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
import eu.kanade.presentation.components.AppBar
@ -29,8 +28,9 @@ import eu.kanade.presentation.components.AppBarActions
import eu.kanade.presentation.components.DownloadDropdownMenu
import eu.kanade.presentation.components.UpIcon
import eu.kanade.presentation.manga.DownloadAction
import eu.kanade.tachiyomi.R
import kotlinx.collections.immutable.persistentListOf
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.theme.active
@Composable
@ -75,12 +75,12 @@ fun MangaToolbar(
AppBarActions(
persistentListOf(
AppBar.Action(
title = stringResource(R.string.action_select_all),
title = stringResource(MR.strings.action_select_all),
icon = Icons.Outlined.SelectAll,
onClick = onSelectAll,
),
AppBar.Action(
title = stringResource(R.string.action_select_inverse),
title = stringResource(MR.strings.action_select_inverse),
icon = Icons.Outlined.FlipToBack,
onClick = onInvertSelection,
),
@ -104,7 +104,7 @@ fun MangaToolbar(
if (onClickDownload != null) {
add(
AppBar.Action(
title = stringResource(R.string.manga_download),
title = stringResource(MR.strings.manga_download),
icon = Icons.Outlined.Download,
onClick = { downloadExpanded = !downloadExpanded },
),
@ -112,7 +112,7 @@ fun MangaToolbar(
}
add(
AppBar.Action(
title = stringResource(R.string.action_filter),
title = stringResource(MR.strings.action_filter),
icon = Icons.Outlined.FilterList,
iconTint = filterTint,
onClick = onClickFilter,
@ -120,14 +120,14 @@ fun MangaToolbar(
)
add(
AppBar.OverflowAction(
title = stringResource(R.string.action_webview_refresh),
title = stringResource(MR.strings.action_webview_refresh),
onClick = onClickRefresh,
),
)
if (onClickEditCategory != null) {
add(
AppBar.OverflowAction(
title = stringResource(R.string.action_edit_categories),
title = stringResource(MR.strings.action_edit_categories),
onClick = onClickEditCategory,
),
)
@ -135,7 +135,7 @@ fun MangaToolbar(
if (onClickMigrate != null) {
add(
AppBar.OverflowAction(
title = stringResource(R.string.action_migrate),
title = stringResource(MR.strings.action_migrate),
onClick = onClickMigrate,
),
)
@ -143,7 +143,7 @@ fun MangaToolbar(
if (onClickShare != null) {
add(
AppBar.OverflowAction(
title = stringResource(R.string.action_share),
title = stringResource(MR.strings.action_share),
onClick = onClickShare,
),
)

View File

@ -10,11 +10,11 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.pluralStringResource
import androidx.compose.ui.tooling.preview.PreviewLightDark
import eu.kanade.presentation.theme.TachiyomiTheme
import eu.kanade.tachiyomi.R
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.i18n.pluralStringResource
import tachiyomi.presentation.core.util.secondaryItemAlpha
@Composable
@ -34,7 +34,7 @@ fun MissingChapterCountListItem(
) {
HorizontalDivider(modifier = Modifier.weight(1f))
Text(
text = pluralStringResource(id = R.plurals.missing_chapters, count = count, count),
text = pluralStringResource(MR.plurals.missing_chapters, count = count, count),
style = MaterialTheme.typography.labelMedium,
)
HorizontalDivider(modifier = Modifier.weight(1f))

View File

@ -20,19 +20,17 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.material3.minimumInteractiveComponentSize
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.runtime.toMutableStateList
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.DialogProperties
import eu.kanade.tachiyomi.R
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.TextButton
import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.isScrolledToEnd
import tachiyomi.presentation.core.util.isScrolledToStart
@ -49,10 +47,10 @@ fun ScanlatorFilterDialog(
val mutableExcludedScanlators = remember(excludedScanlators) { excludedScanlators.toMutableStateList() }
AlertDialog(
onDismissRequest = onDismissRequest,
title = { Text(text = stringResource(R.string.exclude_scanlators)) },
title = { Text(text = stringResource(MR.strings.exclude_scanlators)) },
text = textFunc@{
if (sortedAvailableScanlators.isEmpty()) {
Text(text = stringResource(R.string.no_scanlators_found))
Text(text = stringResource(MR.strings.no_scanlators_found))
return@textFunc
}
Box {
@ -108,16 +106,16 @@ fun ScanlatorFilterDialog(
confirmButton = {
if (sortedAvailableScanlators.isEmpty()) {
TextButton(onClick = onDismissRequest) {
Text(text = stringResource(R.string.action_cancel))
Text(text = stringResource(MR.strings.action_cancel))
}
} else {
FlowRow {
TextButton(onClick = mutableExcludedScanlators::clear) {
Text(text = stringResource(R.string.action_reset))
Text(text = stringResource(MR.strings.action_reset))
}
Spacer(modifier = Modifier.weight(1f))
TextButton(onClick = onDismissRequest) {
Text(text = stringResource(R.string.action_cancel))
Text(text = stringResource(MR.strings.action_cancel))
}
TextButton(
onClick = {
@ -125,7 +123,7 @@ fun ScanlatorFilterDialog(
onDismissRequest()
},
) {
Text(text = stringResource(R.string.action_ok))
Text(text = stringResource(MR.strings.action_ok))
}
}
}

View File

@ -13,9 +13,7 @@ import androidx.compose.material.icons.automirrored.outlined.HelpOutline
import androidx.compose.material.icons.automirrored.outlined.Label
import androidx.compose.material.icons.outlined.CloudOff
import androidx.compose.material.icons.outlined.GetApp
import androidx.compose.material.icons.outlined.HelpOutline
import androidx.compose.material.icons.outlined.Info
import androidx.compose.material.icons.outlined.Label
import androidx.compose.material.icons.outlined.QueryStats
import androidx.compose.material.icons.outlined.Settings
import androidx.compose.material.icons.outlined.Storage
@ -24,8 +22,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
@ -33,8 +29,11 @@ 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.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(
@ -62,7 +61,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",
@ -81,8 +80,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,
@ -90,8 +89,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,
@ -103,17 +102,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,
)
@ -122,7 +121,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,
@ -131,21 +130,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_backup_and_sync),
title = stringResource(MR.strings.label_backup_and_sync),
icon = Icons.Outlined.Storage,
onPreferenceClick = onClickDataAndStorage,
)
@ -155,21 +154,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

@ -6,7 +6,6 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.outlined.OpenInNew
import androidx.compose.material.icons.filled.OpenInNew
import androidx.compose.material.icons.outlined.NewReleases
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
@ -14,7 +13,6 @@ import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.tooling.preview.PreviewLightDark
import com.halilibo.richtext.markdown.Markdown
@ -22,8 +20,9 @@ import com.halilibo.richtext.ui.RichTextStyle
import com.halilibo.richtext.ui.material3.Material3RichText
import com.halilibo.richtext.ui.string.RichTextStringStyle
import eu.kanade.presentation.theme.TachiyomiTheme
import eu.kanade.tachiyomi.R
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.screens.InfoScreen
@Composable
@ -36,11 +35,11 @@ fun NewUpdateScreen(
) {
InfoScreen(
icon = Icons.Outlined.NewReleases,
headingText = stringResource(R.string.update_check_notification_update_available),
headingText = stringResource(MR.strings.update_check_notification_update_available),
subtitleText = versionName,
acceptText = stringResource(R.string.update_check_confirm),
acceptText = stringResource(MR.strings.update_check_confirm),
onAcceptClick = onAcceptUpdate,
rejectText = stringResource(R.string.action_not_now),
rejectText = stringResource(MR.strings.action_not_now),
onRejectClick = onRejectUpdate,
) {
Material3RichText(
@ -59,7 +58,7 @@ fun NewUpdateScreen(
onClick = onOpenInBrowser,
modifier = Modifier.padding(top = MaterialTheme.padding.small),
) {
Text(text = stringResource(R.string.update_check_open))
Text(text = stringResource(MR.strings.update_check_open))
Spacer(modifier = Modifier.width(MaterialTheme.padding.tiny))
Icon(imageVector = Icons.AutoMirrored.Outlined.OpenInNew, contentDescription = null)
}

View File

@ -3,9 +3,9 @@ package eu.kanade.presentation.more.settings
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.res.stringResource
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.track.Tracker
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.core.preference.Preference as PreferenceData
sealed class Preference {
@ -109,7 +109,7 @@ sealed class Preference {
v.map { e[it] }
.takeIf { it.isNotEmpty() }
?.joinToString()
} ?: stringResource(R.string.none)
} ?: stringResource(MR.strings.none)
subtitle?.format(combined)
},
override val icon: ImageVector? = null,

View File

@ -1,15 +1,15 @@
package eu.kanade.presentation.more.settings
import androidx.annotation.StringRes
import androidx.compose.foundation.layout.RowScope
import androidx.compose.runtime.Composable
import androidx.compose.ui.res.stringResource
import dev.icerock.moko.resources.StringResource
import eu.kanade.presentation.components.AppBar
import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun PreferenceScaffold(
@StringRes titleRes: Int,
titleRes: StringResource,
actions: @Composable RowScope.() -> Unit = {},
onBackPressed: (() -> Unit)? = null,
itemsProvider: @Composable () -> List<Preference>,

View File

@ -3,10 +3,10 @@ package eu.kanade.presentation.more.settings.screen
import androidx.compose.runtime.Composable
import androidx.compose.runtime.ReadOnlyComposable
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import eu.kanade.presentation.category.visualName
import eu.kanade.tachiyomi.R
import tachiyomi.domain.category.model.Category
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.stringResource
/**
* Returns a string of categories name for settings subtitle
@ -34,15 +34,15 @@ fun getCategoriesLabel(
includedCategories.isNotEmpty() && includedCategories.size != allCategories.size ->
includedCategories.joinToString { it.visualName(context) }
// All explicitly selected
includedCategories.size == allCategories.size -> stringResource(R.string.all)
allExcluded -> stringResource(R.string.none)
else -> stringResource(R.string.all)
includedCategories.size == allCategories.size -> stringResource(MR.strings.all)
allExcluded -> stringResource(MR.strings.none)
else -> stringResource(MR.strings.all)
}
val excludedItemsText = when {
excludedCategories.isEmpty() -> stringResource(R.string.none)
allExcluded -> stringResource(R.string.all)
excludedCategories.isEmpty() -> stringResource(MR.strings.none)
allExcluded -> stringResource(MR.strings.all)
else -> excludedCategories.joinToString { it.visualName(context) }
}
return stringResource(R.string.include, includedItemsText) + "\n" +
stringResource(R.string.exclude, excludedItemsText)
return stringResource(MR.strings.include, includedItemsText) + "\n" +
stringResource(MR.strings.exclude, excludedItemsText)
}

View File

@ -1,10 +1,10 @@
package eu.kanade.presentation.more.settings.screen
import androidx.annotation.StringRes
import androidx.compose.foundation.layout.RowScope
import androidx.compose.runtime.Composable
import androidx.compose.runtime.ReadOnlyComposable
import cafe.adriel.voyager.core.screen.Screen
import dev.icerock.moko.resources.StringResource
import eu.kanade.presentation.more.settings.Preference
import eu.kanade.presentation.more.settings.PreferenceScaffold
import eu.kanade.presentation.util.LocalBackPress
@ -13,8 +13,7 @@ interface SearchableSettings : Screen {
@Composable
@ReadOnlyComposable
@StringRes
fun getTitleRes(): Int
fun getTitleRes(): StringResource
@Composable
fun getPreferences(): List<Preference>

View File

@ -7,7 +7,6 @@ import android.os.Build
import android.provider.Settings
import android.webkit.WebStorage
import android.webkit.WebView
import androidx.annotation.StringRes
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
@ -21,7 +20,6 @@ import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalUriHandler
import androidx.compose.ui.res.stringResource
import androidx.core.net.toUri
import cafe.adriel.voyager.navigator.LocalNavigator
import cafe.adriel.voyager.navigator.currentOrThrow
@ -29,9 +27,8 @@ import eu.kanade.domain.base.BasePreferences
import eu.kanade.presentation.more.settings.Preference
import eu.kanade.presentation.more.settings.screen.advanced.ClearDatabaseScreen
import eu.kanade.presentation.more.settings.screen.debug.DebugInfoScreen
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.download.DownloadCache
import eu.kanade.tachiyomi.data.library.LibraryUpdateJob
import eu.kanade.tachiyomi.data.library.MetadataUpdateJob
import eu.kanade.tachiyomi.network.NetworkHelper
import eu.kanade.tachiyomi.network.NetworkPreferences
import eu.kanade.tachiyomi.network.PREF_DOH_360
@ -60,6 +57,8 @@ import tachiyomi.core.util.lang.launchNonCancellable
import tachiyomi.core.util.lang.withUIContext
import tachiyomi.core.util.system.logcat
import tachiyomi.domain.manga.interactor.ResetViewerFlags
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.collectAsState
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
@ -69,8 +68,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> {
@ -86,13 +84,13 @@ object SettingsAdvancedScreen : SearchableSettings {
listOf(
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,
),
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()
@ -101,15 +99,15 @@ object SettingsAdvancedScreen : SearchableSettings {
),
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
},
),
Preference.PreferenceItem.TextPreference(
title = stringResource(R.string.pref_debug_info),
title = stringResource(MR.strings.pref_debug_info),
onClick = { navigator.push(DebugInfoScreen()) },
),
),
@ -117,7 +115,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)
@ -145,11 +143,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)) {
@ -162,16 +160,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/") },
),
),
@ -184,19 +182,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()) },
),
),
@ -214,17 +212,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 {
@ -236,18 +234,18 @@ object SettingsAdvancedScreen : SearchableSettings {
}
WebStorage.getInstance().deleteAllData()
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",
@ -262,30 +260,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)
},
),
),
@ -298,23 +296,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),
onClick = { LibraryUpdateJob.startNow(context, target = LibraryUpdateJob.Target.COVERS) },
title = stringResource(MR.strings.pref_refresh_library_covers),
onClick = { MetadataUpdateJob.startNow(context) },
),
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)
}
@ -338,11 +336,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 = {
@ -352,19 +350,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

View File

@ -3,7 +3,6 @@ package eu.kanade.presentation.more.settings.screen
import android.app.Activity
import android.content.Context
import android.os.Build
import androidx.annotation.StringRes
import androidx.appcompat.app.AppCompatDelegate
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
@ -13,7 +12,6 @@ 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.core.app.ActivityCompat
import androidx.core.os.LocaleListCompat
import eu.kanade.domain.ui.UiPreferences
@ -29,6 +27,9 @@ import kotlinx.coroutines.flow.collectLatest
import kotlinx.coroutines.flow.drop
import kotlinx.coroutines.flow.merge
import org.xmlpull.v1.XmlPullParser
import tachiyomi.core.i18n.stringResource
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.collectAsState
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
@ -38,8 +39,7 @@ object SettingsAppearanceScreen : SearchableSettings {
@ReadOnlyComposable
@Composable
@StringRes
override fun getTitleRes() = R.string.pref_category_appearance
override fun getTitleRes() = MR.strings.pref_category_appearance
@Composable
override fun getPreferences(): List<Preference> {
@ -76,26 +76,26 @@ object SettingsAppearanceScreen : SearchableSettings {
}
return Preference.PreferenceGroup(
title = stringResource(R.string.pref_category_theme),
title = stringResource(MR.strings.pref_category_theme),
preferenceItems = listOf(
Preference.PreferenceItem.ListPreference(
pref = themeModePref,
title = stringResource(R.string.pref_theme_mode),
title = stringResource(MR.strings.pref_theme_mode),
entries = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
mapOf(
ThemeMode.SYSTEM to stringResource(R.string.theme_system),
ThemeMode.LIGHT to stringResource(R.string.theme_light),
ThemeMode.DARK to stringResource(R.string.theme_dark),
ThemeMode.SYSTEM to stringResource(MR.strings.theme_system),
ThemeMode.LIGHT to stringResource(MR.strings.theme_light),
ThemeMode.DARK to stringResource(MR.strings.theme_dark),
)
} else {
mapOf(
ThemeMode.LIGHT to stringResource(R.string.theme_light),
ThemeMode.DARK to stringResource(R.string.theme_dark),
ThemeMode.LIGHT to stringResource(MR.strings.theme_light),
ThemeMode.DARK to stringResource(MR.strings.theme_dark),
)
},
),
Preference.PreferenceItem.CustomPreference(
title = stringResource(R.string.pref_app_theme),
title = stringResource(MR.strings.pref_app_theme),
) { item ->
val value by appThemePref.collectAsState()
AppThemePreferenceWidget(
@ -107,7 +107,7 @@ object SettingsAppearanceScreen : SearchableSettings {
},
Preference.PreferenceItem.SwitchPreference(
pref = amoledPref,
title = stringResource(R.string.pref_dark_theme_pure_black),
title = stringResource(MR.strings.pref_dark_theme_pure_black),
enabled = themeMode != ThemeMode.LIGHT,
),
),
@ -140,11 +140,11 @@ object SettingsAppearanceScreen : SearchableSettings {
}
return Preference.PreferenceGroup(
title = stringResource(R.string.pref_category_display),
title = stringResource(MR.strings.pref_category_display),
preferenceItems = listOf(
Preference.PreferenceItem.BasicListPreference(
value = currentLanguage,
title = stringResource(R.string.pref_app_language),
title = stringResource(MR.strings.pref_app_language),
entries = langs,
onValueChanged = { newValue ->
currentLanguage = newValue
@ -153,28 +153,28 @@ object SettingsAppearanceScreen : SearchableSettings {
),
Preference.PreferenceItem.ListPreference(
pref = uiPreferences.tabletUiMode(),
title = stringResource(R.string.pref_tablet_ui_mode),
entries = TabletUiMode.entries.associateWith { stringResource(it.titleResId) },
title = stringResource(MR.strings.pref_tablet_ui_mode),
entries = TabletUiMode.entries.associateWith { stringResource(it.titleRes) },
onValueChanged = {
context.toast(R.string.requires_app_restart)
context.toast(MR.strings.requires_app_restart)
true
},
),
Preference.PreferenceItem.ListPreference(
pref = uiPreferences.dateFormat(),
title = stringResource(R.string.pref_date_format),
title = stringResource(MR.strings.pref_date_format),
entries = DateFormats
.associateWith {
val formattedDate = UiPreferences.dateFormat(it).format(now)
"${it.ifEmpty { stringResource(R.string.label_default) }} ($formattedDate)"
"${it.ifEmpty { stringResource(MR.strings.label_default) }} ($formattedDate)"
},
),
Preference.PreferenceItem.SwitchPreference(
pref = uiPreferences.relativeTime(),
title = stringResource(R.string.pref_relative_format),
title = stringResource(MR.strings.pref_relative_format),
subtitle = stringResource(
R.string.pref_relative_format_summary,
stringResource(R.string.relative_time_today),
MR.strings.pref_relative_format_summary,
stringResource(MR.strings.relative_time_today),
formattedNow,
),
),
@ -201,7 +201,7 @@ object SettingsAppearanceScreen : SearchableSettings {
}
langs.sortBy { it.second }
langs.add(0, Pair("", context.getString(R.string.label_default)))
langs.add(0, Pair("", context.stringResource(MR.strings.label_default)))
return langs.toMap()
}

View File

@ -1,16 +1,16 @@
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.remember
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.fragment.app.FragmentActivity
import eu.kanade.domain.source.service.SourcePreferences
import eu.kanade.presentation.more.settings.Preference
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.util.system.AuthenticatorUtil.authenticate
import tachiyomi.core.i18n.stringResource
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.stringResource
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
@ -18,8 +18,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> {
@ -27,28 +26,28 @@ object SettingsBrowseScreen : SearchableSettings {
val sourcePreferences = remember { Injekt.get<SourcePreferences>() }
return listOf(
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

@ -8,7 +8,6 @@ import android.text.format.Formatter
import android.widget.Toast
import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.result.contract.ActivityResultContracts
import androidx.annotation.StringRes
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.padding
@ -27,7 +26,6 @@ import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import cafe.adriel.voyager.navigator.LocalNavigator
import cafe.adriel.voyager.navigator.currentOrThrow
import eu.kanade.presentation.more.settings.Preference
@ -36,7 +34,6 @@ import eu.kanade.presentation.more.settings.widget.BasePreferenceWidget
import eu.kanade.presentation.more.settings.widget.PrefsHorizontalPadding
import eu.kanade.presentation.permissions.PermissionRequestHelper
import eu.kanade.presentation.util.relativeTimeSpanString
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.backup.BackupCreateJob
import eu.kanade.tachiyomi.data.backup.BackupFileValidator
import eu.kanade.tachiyomi.data.backup.BackupRestoreJob
@ -51,11 +48,14 @@ import eu.kanade.tachiyomi.util.system.copyToClipboard
import eu.kanade.tachiyomi.util.system.toast
import kotlinx.coroutines.launch
import logcat.LogPriority
import tachiyomi.core.i18n.stringResource
import tachiyomi.core.util.lang.launchNonCancellable
import tachiyomi.core.util.lang.withUIContext
import tachiyomi.core.util.system.logcat
import tachiyomi.domain.backup.service.BackupPreferences
import tachiyomi.domain.library.service.LibraryPreferences
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.domain.sync.SyncPreferences
import tachiyomi.presentation.core.util.collectAsState
import uy.kohesive.injekt.Injekt
@ -65,8 +65,7 @@ object SettingsDataScreen : SearchableSettings {
@ReadOnlyComposable
@Composable
@StringRes
override fun getTitleRes() = R.string.label_backup_and_sync
override fun getTitleRes() = MR.strings.label_backup_and_sync
@Composable
override fun getPreferences(): List<Preference> {
@ -107,7 +106,7 @@ object SettingsDataScreen : SearchableSettings {
val lastAutoBackup by backupPreferences.lastAutoBackupTimestamp().collectAsState()
return Preference.PreferenceGroup(
title = stringResource(R.string.label_backup),
title = stringResource(MR.strings.label_backup),
preferenceItems = listOf(
// Manual actions
getCreateBackupPref(),
@ -116,14 +115,14 @@ object SettingsDataScreen : SearchableSettings {
// Automatic backups
Preference.PreferenceItem.ListPreference(
pref = backupIntervalPref,
title = stringResource(R.string.pref_backup_interval),
title = stringResource(MR.strings.pref_backup_interval),
entries = mapOf(
0 to stringResource(R.string.off),
6 to stringResource(R.string.update_6hour),
12 to stringResource(R.string.update_12hour),
24 to stringResource(R.string.update_24hour),
48 to stringResource(R.string.update_48hour),
168 to stringResource(R.string.update_weekly),
0 to stringResource(MR.strings.off),
6 to stringResource(MR.strings.update_6hour),
12 to stringResource(MR.strings.update_12hour),
24 to stringResource(MR.strings.update_24hour),
48 to stringResource(MR.strings.update_48hour),
168 to stringResource(MR.strings.update_weekly),
),
onValueChanged = {
BackupCreateJob.setupTask(context, it)
@ -133,12 +132,12 @@ object SettingsDataScreen : SearchableSettings {
Preference.PreferenceItem.ListPreference(
pref = backupPreferences.numberOfBackups(),
enabled = backupInterval != 0,
title = stringResource(R.string.pref_backup_slots),
title = stringResource(MR.strings.pref_backup_slots),
entries = listOf(2, 3, 4, 5).associateWith { it.toString() },
),
Preference.PreferenceItem.InfoPreference(
stringResource(R.string.backup_info) + "\n\n" +
stringResource(R.string.last_auto_backup_info, relativeTimeSpanString(lastAutoBackup)),
stringResource(MR.strings.backup_info) + "\n\n" +
stringResource(MR.strings.last_auto_backup_info, relativeTimeSpanString(lastAutoBackup)),
),
),
)
@ -148,8 +147,8 @@ object SettingsDataScreen : SearchableSettings {
private fun getCreateBackupPref(): Preference.PreferenceItem.TextPreference {
val navigator = LocalNavigator.currentOrThrow
return Preference.PreferenceItem.TextPreference(
title = stringResource(R.string.pref_create_backup),
subtitle = stringResource(R.string.pref_create_backup_summ),
title = stringResource(MR.strings.pref_create_backup),
subtitle = stringResource(MR.strings.pref_create_backup_summ),
onClick = { navigator.push(CreateBackupScreen()) },
)
}
@ -164,7 +163,7 @@ object SettingsDataScreen : SearchableSettings {
is InvalidRestore -> {
AlertDialog(
onDismissRequest = onDismissRequest,
title = { Text(text = stringResource(R.string.invalid_backup_file)) },
title = { Text(text = stringResource(MR.strings.invalid_backup_file)) },
text = { Text(text = listOfNotNull(err.uri, err.message).joinToString("\n\n")) },
dismissButton = {
TextButton(
@ -173,12 +172,12 @@ object SettingsDataScreen : SearchableSettings {
onDismissRequest()
},
) {
Text(text = stringResource(R.string.action_copy_to_clipboard))
Text(text = stringResource(MR.strings.action_copy_to_clipboard))
}
},
confirmButton = {
TextButton(onClick = onDismissRequest) {
Text(text = stringResource(R.string.action_ok))
Text(text = stringResource(MR.strings.action_ok))
}
},
)
@ -186,15 +185,15 @@ object SettingsDataScreen : SearchableSettings {
is MissingRestoreComponents -> {
AlertDialog(
onDismissRequest = onDismissRequest,
title = { Text(text = stringResource(R.string.pref_restore_backup)) },
title = { Text(text = stringResource(MR.strings.pref_restore_backup)) },
text = {
Column(
modifier = Modifier.verticalScroll(rememberScrollState()),
) {
val msg = buildString {
append(stringResource(R.string.backup_restore_content_full))
append(stringResource(MR.strings.backup_restore_content_full))
if (err.sources.isNotEmpty()) {
append("\n\n").append(stringResource(R.string.backup_restore_missing_sources))
append("\n\n").append(stringResource(MR.strings.backup_restore_missing_sources))
err.sources.joinTo(
this,
separator = "\n- ",
@ -202,7 +201,9 @@ object SettingsDataScreen : SearchableSettings {
)
}
if (err.trackers.isNotEmpty()) {
append("\n\n").append(stringResource(R.string.backup_restore_missing_trackers))
append(
"\n\n",
).append(stringResource(MR.strings.backup_restore_missing_trackers))
err.trackers.joinTo(
this,
separator = "\n- ",
@ -220,7 +221,7 @@ object SettingsDataScreen : SearchableSettings {
onDismissRequest()
},
) {
Text(text = stringResource(R.string.action_restore))
Text(text = stringResource(MR.strings.action_restore))
}
},
)
@ -233,12 +234,12 @@ object SettingsDataScreen : SearchableSettings {
object : ActivityResultContracts.GetContent() {
override fun createIntent(context: Context, input: String): Intent {
val intent = super.createIntent(context, input)
return Intent.createChooser(intent, context.getString(R.string.file_select_backup))
return Intent.createChooser(intent, context.stringResource(MR.strings.file_select_backup))
}
},
) {
if (it == null) {
context.toast(R.string.file_null_uri_error)
context.toast(MR.strings.file_null_uri_error)
return@rememberLauncherForActivityResult
}
@ -258,17 +259,17 @@ object SettingsDataScreen : SearchableSettings {
}
return Preference.PreferenceItem.TextPreference(
title = stringResource(R.string.pref_restore_backup),
subtitle = stringResource(R.string.pref_restore_backup_summ),
title = stringResource(MR.strings.pref_restore_backup),
subtitle = stringResource(MR.strings.pref_restore_backup_summ),
onClick = {
if (!BackupRestoreJob.isRunning(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)
}
// no need to catch because it's wrapped with a chooser
chooseBackup.launch("*/*")
} else {
context.toast(R.string.restore_in_progress)
context.toast(MR.strings.restore_in_progress)
}
},
)
@ -285,31 +286,31 @@ object SettingsDataScreen : SearchableSettings {
val cacheReadableSize = remember(cacheReadableSizeSema) { chapterCache.readableSize }
return Preference.PreferenceGroup(
title = stringResource(R.string.label_data),
title = stringResource(MR.strings.label_data),
preferenceItems = listOf(
getStorageInfoPref(cacheReadableSize),
Preference.PreferenceItem.TextPreference(
title = stringResource(R.string.pref_clear_chapter_cache),
subtitle = stringResource(R.string.used_cache, cacheReadableSize),
title = stringResource(MR.strings.pref_clear_chapter_cache),
subtitle = stringResource(MR.strings.used_cache, cacheReadableSize),
onClick = {
scope.launchNonCancellable {
try {
val deletedFiles = chapterCache.clear()
withUIContext {
context.toast(context.getString(R.string.cache_deleted, deletedFiles))
context.toast(context.stringResource(MR.strings.cache_deleted, deletedFiles))
cacheReadableSizeSema++
}
} catch (e: Throwable) {
logcat(LogPriority.ERROR, e)
withUIContext { context.toast(R.string.cache_delete_error) }
withUIContext { context.toast(MR.strings.cache_delete_error) }
}
}
},
),
Preference.PreferenceItem.SwitchPreference(
pref = libraryPreferences.autoClearChapterCache(),
title = stringResource(R.string.pref_auto_clear_chapter_cache),
title = stringResource(MR.strings.pref_auto_clear_chapter_cache),
),
),
)
@ -328,10 +329,10 @@ object SettingsDataScreen : SearchableSettings {
}
return Preference.PreferenceItem.CustomPreference(
title = stringResource(R.string.pref_storage_usage),
title = stringResource(MR.strings.pref_storage_usage),
) {
BasePreferenceWidget(
title = stringResource(R.string.pref_storage_usage),
title = stringResource(MR.strings.pref_storage_usage),
subcomponent = {
// TODO: downloads, SD cards, bar representation?, i18n
Box(modifier = Modifier.padding(horizontal = PrefsHorizontalPadding)) {
@ -364,7 +365,7 @@ private fun getGoogleDrivePreferences(): List<Preference> {
val googleDriveSync = Injekt.get<GoogleDriveService>()
return listOf(
Preference.PreferenceItem.TextPreference(
title = stringResource(R.string.pref_google_drive_sign_in),
title = stringResource(MR.string.pref_google_drive_sign_in),
onClick = {
val intent = googleDriveSync.getSignInIntent()
context.startActivity(intent)
@ -389,13 +390,13 @@ private fun getGoogleDrivePurge(): Preference.PreferenceItem.TextPreference {
val result = googleDriveSync.deleteSyncDataFromGoogleDrive()
when (result) {
GoogleDriveSyncService.DeleteSyncDataStatus.NOT_INITIALIZED -> context.toast(
R.string.google_drive_not_signed_in,
MR.string.google_drive_not_signed_in,
)
GoogleDriveSyncService.DeleteSyncDataStatus.NO_FILES -> context.toast(
R.string.google_drive_sync_data_not_found,
MR.string.google_drive_sync_data_not_found,
)
GoogleDriveSyncService.DeleteSyncDataStatus.SUCCESS -> context.toast(
R.string.google_drive_sync_data_purged,
MR.string.google_drive_sync_data_purged,
)
}
}
@ -405,7 +406,7 @@ private fun getGoogleDrivePurge(): Preference.PreferenceItem.TextPreference {
}
return Preference.PreferenceItem.TextPreference(
title = stringResource(R.string.pref_google_drive_purge_sync_data),
title = stringResource(MR.string.pref_google_drive_purge_sync_data),
onClick = { showPurgeDialog.value = true },
)
}
@ -417,11 +418,11 @@ fun PurgeConfirmationDialog(
) {
AlertDialog(
onDismissRequest = onDismissRequest,
title = { Text(text = stringResource(R.string.pref_purge_confirmation_title)) },
text = { Text(text = stringResource(R.string.pref_purge_confirmation_message)) },
title = { Text(text = stringResource(MR.string.pref_purge_confirmation_title)) },
text = { Text(text = stringResource(MR.string.pref_purge_confirmation_message)) },
dismissButton = {
TextButton(onClick = onDismissRequest) {
Text(text = stringResource(R.string.action_cancel))
Text(text = stringResource(MR.string.action_cancel))
}
},
confirmButton = {
@ -437,8 +438,8 @@ private fun getSelfHostPreferences(syncPreferences: SyncPreferences): List<Prefe
val scope = rememberCoroutineScope()
return listOf(
Preference.PreferenceItem.EditTextPreference(
title = stringResource(R.string.pref_sync_host),
subtitle = stringResource(R.string.pref_sync_host_summ),
title = stringResource(MR.string.pref_sync_host),
subtitle = stringResource(MR.string.pref_sync_host_summ),
pref = syncPreferences.syncHost(),
onValueChanged = { newValue ->
scope.launch {
@ -451,8 +452,8 @@ private fun getSelfHostPreferences(syncPreferences: SyncPreferences): List<Prefe
},
),
Preference.PreferenceItem.EditTextPreference(
title = stringResource(R.string.pref_sync_api_key),
subtitle = stringResource(R.string.pref_sync_api_key_summ),
title = stringResource(MR.string.pref_sync_api_key),
subtitle = stringResource(MR.string.pref_sync_api_key_summ),
pref = syncPreferences.syncAPIKey(),
),
)
@ -471,7 +472,7 @@ private fun getSyncNowPref(): Preference.PreferenceGroup {
if (!SyncDataJob.isAnyJobRunning(context)) {
SyncDataJob.startNow(context)
} else {
context.toast(R.string.sync_in_progress)
context.toast(MR.string.sync_in_progress)
}
}
},
@ -479,11 +480,11 @@ private fun getSyncNowPref(): Preference.PreferenceGroup {
)
}
return Preference.PreferenceGroup(
title = stringResource(R.string.pref_sync_now_group_title),
title = stringResource(MR.string.pref_sync_now_group_title),
preferenceItems = listOf(
Preference.PreferenceItem.TextPreference(
title = stringResource(R.string.pref_sync_now),
subtitle = stringResource(R.string.pref_sync_now_subtitle),
title = stringResource(MR.string.pref_sync_now),
subtitle = stringResource(MR.string.pref_sync_now_subtitle),
onClick = {
showDialog = true
},
@ -499,21 +500,21 @@ private fun getAutomaticSyncGroup(syncPreferences: SyncPreferences): Preference.
val lastSync by syncPreferences.lastSyncTimestamp().collectAsState()
return Preference.PreferenceGroup(
title = stringResource(R.string.pref_sync_service_category),
title = stringResource(MR.string.pref_sync_service_category),
preferenceItems = listOf(
Preference.PreferenceItem.ListPreference(
pref = syncIntervalPref,
title = stringResource(R.string.pref_sync_interval),
title = stringResource(MR.string.pref_sync_interval),
entries = mapOf(
0 to stringResource(R.string.off),
30 to stringResource(R.string.update_30min),
60 to stringResource(R.string.update_1hour),
180 to stringResource(R.string.update_3hour),
360 to stringResource(R.string.update_6hour),
720 to stringResource(R.string.update_12hour),
1440 to stringResource(R.string.update_24hour),
2880 to stringResource(R.string.update_48hour),
10080 to stringResource(R.string.update_weekly),
0 to stringResource(MR.string.off),
30 to stringResource(MR.string.update_30min),
60 to stringResource(MR.string.update_1hour),
180 to stringResource(MR.string.update_3hour),
360 to stringResource(MR.string.update_6hour),
720 to stringResource(MR.string.update_12hour),
1440 to stringResource(MR.string.update_24hour),
2880 to stringResource(MR.string.update_48hour),
10080 to stringResource(MR.string.update_weekly),
),
onValueChanged = {
SyncDataJob.setupTask(context, it)
@ -521,7 +522,7 @@ private fun getAutomaticSyncGroup(syncPreferences: SyncPreferences): Preference.
},
),
Preference.PreferenceItem.InfoPreference(
stringResource(R.string.last_synchronization, relativeTimeSpanString(lastSync)),
stringResource(MR.string.last_synchronization, relativeTimeSpanString(lastSync)),
),
),
)
@ -534,11 +535,11 @@ fun SyncConfirmationDialog(
) {
AlertDialog(
onDismissRequest = onDismissRequest,
title = { Text(text = stringResource(R.string.pref_sync_confirmation_title)) },
text = { Text(text = stringResource(R.string.pref_sync_confirmation_message)) },
title = { Text(text = stringResource(MR.string.pref_sync_confirmation_title)) },
text = { Text(text = stringResource(MR.string.pref_sync_confirmation_message)) },
dismissButton = {
TextButton(onClick = onDismissRequest) {
Text(text = stringResource(R.string.action_cancel))
Text(text = stringResource(MR.string.action_cancel))
}
},
confirmButton = {

View File

@ -4,7 +4,6 @@ import android.content.Intent
import android.os.Environment
import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.result.contract.ActivityResultContracts
import androidx.annotation.StringRes
import androidx.compose.runtime.Composable
import androidx.compose.runtime.ReadOnlyComposable
import androidx.compose.runtime.collectAsState
@ -14,19 +13,19 @@ import androidx.compose.runtime.remember
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.net.toUri
import com.hippo.unifile.UniFile
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 kotlinx.coroutines.runBlocking
import tachiyomi.domain.category.interactor.GetCategories
import tachiyomi.domain.category.model.Category
import tachiyomi.domain.download.service.DownloadPreferences
import tachiyomi.i18n.MR
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
@ -36,8 +35,7 @@ object SettingsDownloadScreen : SearchableSettings {
@ReadOnlyComposable
@Composable
@StringRes
override fun getTitleRes() = R.string.pref_category_downloads
override fun getTitleRes() = MR.strings.pref_category_downloads
@Composable
override fun getPreferences(): List<Preference> {
@ -49,16 +47,16 @@ object SettingsDownloadScreen : SearchableSettings {
getDownloadLocationPreference(downloadPreferences = downloadPreferences),
Preference.PreferenceItem.SwitchPreference(
pref = downloadPreferences.downloadOnlyOverWifi(),
title = stringResource(R.string.connected_to_wifi),
title = stringResource(MR.strings.connected_to_wifi),
),
Preference.PreferenceItem.SwitchPreference(
pref = downloadPreferences.saveChaptersAsCBZ(),
title = stringResource(R.string.save_chapter_as_cbz),
title = stringResource(MR.strings.save_chapter_as_cbz),
),
Preference.PreferenceItem.SwitchPreference(
pref = downloadPreferences.splitTallImages(),
title = stringResource(R.string.split_tall_images),
subtitle = stringResource(R.string.split_tall_images_summary),
title = stringResource(MR.strings.split_tall_images),
subtitle = stringResource(MR.strings.split_tall_images_summary),
),
getDeleteChaptersGroup(
downloadPreferences = downloadPreferences,
@ -99,15 +97,15 @@ object SettingsDownloadScreen : SearchableSettings {
return Preference.PreferenceItem.ListPreference(
pref = currentDirPref,
title = stringResource(R.string.pref_download_directory),
title = stringResource(MR.strings.pref_download_directory),
subtitleProvider = { value, _ ->
remember(value) {
UniFile.fromUri(context, value.toUri())?.filePath
} ?: stringResource(R.string.invalid_location, value)
} ?: stringResource(MR.strings.invalid_location, value)
},
entries = mapOf(
defaultDirPair,
customDirEntryKey to stringResource(R.string.custom_dir),
customDirEntryKey to stringResource(MR.strings.custom_dir),
),
onValueChanged = {
val default = it == defaultDirPair.first
@ -121,7 +119,7 @@ object SettingsDownloadScreen : SearchableSettings {
@Composable
private fun rememberDefaultDownloadDir(): Pair<String, String> {
val appName = stringResource(R.string.app_name)
val appName = stringResource(MR.strings.app_name)
return remember {
val file = UniFile.fromFile(
File(
@ -139,27 +137,27 @@ object SettingsDownloadScreen : SearchableSettings {
categories: List<Category>,
): Preference.PreferenceGroup {
return Preference.PreferenceGroup(
title = stringResource(R.string.pref_category_delete_chapters),
title = stringResource(MR.strings.pref_category_delete_chapters),
preferenceItems = listOf(
Preference.PreferenceItem.SwitchPreference(
pref = downloadPreferences.removeAfterMarkedAsRead(),
title = stringResource(R.string.pref_remove_after_marked_as_read),
title = stringResource(MR.strings.pref_remove_after_marked_as_read),
),
Preference.PreferenceItem.ListPreference(
pref = downloadPreferences.removeAfterReadSlots(),
title = stringResource(R.string.pref_remove_after_read),
title = stringResource(MR.strings.pref_remove_after_read),
entries = mapOf(
-1 to stringResource(R.string.disabled),
0 to stringResource(R.string.last_read_chapter),
1 to stringResource(R.string.second_to_last),
2 to stringResource(R.string.third_to_last),
3 to stringResource(R.string.fourth_to_last),
4 to stringResource(R.string.fifth_to_last),
-1 to stringResource(MR.strings.disabled),
0 to stringResource(MR.strings.last_read_chapter),
1 to stringResource(MR.strings.second_to_last),
2 to stringResource(MR.strings.third_to_last),
3 to stringResource(MR.strings.fourth_to_last),
4 to stringResource(MR.strings.fifth_to_last),
),
),
Preference.PreferenceItem.SwitchPreference(
pref = downloadPreferences.removeBookmarkedChapters(),
title = stringResource(R.string.pref_remove_bookmarked_chapters),
title = stringResource(MR.strings.pref_remove_bookmarked_chapters),
),
getExcludedCategoriesPreference(
downloadPreferences = downloadPreferences,
@ -176,7 +174,7 @@ object SettingsDownloadScreen : SearchableSettings {
): Preference.PreferenceItem.MultiSelectListPreference {
return Preference.PreferenceItem.MultiSelectListPreference(
pref = downloadPreferences.removeExcludeCategories(),
title = stringResource(R.string.pref_remove_exclude_categories),
title = stringResource(MR.strings.pref_remove_exclude_categories),
entries = categories().associate { it.id.toString() to it.visualName },
)
}
@ -197,8 +195,8 @@ object SettingsDownloadScreen : SearchableSettings {
var showDialog by rememberSaveable { mutableStateOf(false) }
if (showDialog) {
TriStateListDialog(
title = stringResource(R.string.categories),
message = stringResource(R.string.pref_download_new_categories_details),
title = stringResource(MR.strings.categories),
message = stringResource(MR.strings.pref_download_new_categories_details),
items = allCategories,
initialChecked = included.mapNotNull { id -> allCategories.find { it.id.toString() == id } },
initialInversed = excluded.mapNotNull { id -> allCategories.find { it.id.toString() == id } },
@ -213,14 +211,14 @@ object SettingsDownloadScreen : SearchableSettings {
}
return Preference.PreferenceGroup(
title = stringResource(R.string.pref_category_auto_download),
title = stringResource(MR.strings.pref_category_auto_download),
preferenceItems = listOf(
Preference.PreferenceItem.SwitchPreference(
pref = downloadNewChaptersPref,
title = stringResource(R.string.pref_download_new),
title = stringResource(MR.strings.pref_download_new),
),
Preference.PreferenceItem.TextPreference(
title = stringResource(R.string.categories),
title = stringResource(MR.strings.categories),
subtitle = getCategoriesLabel(
allCategories = allCategories,
included = included,
@ -238,20 +236,20 @@ object SettingsDownloadScreen : SearchableSettings {
downloadPreferences: DownloadPreferences,
): Preference.PreferenceGroup {
return Preference.PreferenceGroup(
title = stringResource(R.string.download_ahead),
title = stringResource(MR.strings.download_ahead),
preferenceItems = listOf(
Preference.PreferenceItem.ListPreference(
pref = downloadPreferences.autoDownloadWhileReading(),
title = stringResource(R.string.auto_download_while_reading),
title = stringResource(MR.strings.auto_download_while_reading),
entries = listOf(0, 2, 3, 5, 10).associateWith {
if (it == 0) {
stringResource(R.string.disabled)
stringResource(MR.strings.disabled)
} else {
pluralStringResource(id = R.plurals.next_unread_chapters, count = it, it)
pluralStringResource(MR.plurals.next_unread_chapters, count = it, it)
}
},
),
Preference.PreferenceItem.InfoPreference(stringResource(R.string.download_ahead_info)),
Preference.PreferenceItem.InfoPreference(stringResource(MR.strings.download_ahead_info)),
),
)
}

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 kotlinx.coroutines.launch
@ -37,6 +33,9 @@ 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.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
@ -45,8 +44,7 @@ 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> {
@ -77,16 +75,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,
),
@ -94,13 +92,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 {
@ -132,8 +130,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 } },
@ -148,18 +146,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)
@ -169,12 +167,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.
@ -183,7 +181,7 @@ object SettingsLibraryScreen : SearchableSettings {
},
),
Preference.PreferenceItem.TextPreference(
title = stringResource(R.string.categories),
title = stringResource(MR.strings.categories),
subtitle = getCategoriesLabel(
allCategories = allCategories,
included = included,
@ -193,22 +191,22 @@ object SettingsLibraryScreen : SearchableSettings {
),
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),
),
),
)
@ -219,34 +217,34 @@ 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),
stringResource(MR.strings.disabled),
LibraryPreferences.ChapterSwipeAction.ToggleBookmark to
stringResource(R.string.action_bookmark),
stringResource(MR.strings.action_bookmark),
LibraryPreferences.ChapterSwipeAction.ToggleRead to
stringResource(R.string.action_mark_as_read),
stringResource(MR.strings.action_mark_as_read),
LibraryPreferences.ChapterSwipeAction.Download to
stringResource(R.string.action_download),
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),
stringResource(MR.strings.disabled),
LibraryPreferences.ChapterSwipeAction.ToggleBookmark to
stringResource(R.string.action_bookmark),
stringResource(MR.strings.action_bookmark),
LibraryPreferences.ChapterSwipeAction.ToggleRead to
stringResource(R.string.action_mark_as_read),
stringResource(MR.strings.action_mark_as_read),
LibraryPreferences.ChapterSwipeAction.Download to
stringResource(R.string.action_download),
stringResource(MR.strings.action_download),
),
),
),

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
@ -10,7 +9,6 @@ import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.outlined.ChromeReaderMode
import androidx.compose.material.icons.outlined.ChromeReaderMode
import androidx.compose.material.icons.outlined.Code
import androidx.compose.material.icons.outlined.CollectionsBookmark
import androidx.compose.material.icons.outlined.Explore
@ -34,21 +32,22 @@ 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 kotlinx.collections.immutable.persistentListOf
import tachiyomi.i18n.MR
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() {
@ -85,13 +84,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) },
),
@ -165,73 +164,72 @@ object SettingsMainScreen : Screen() {
}
private data class Item(
@StringRes val titleRes: Int,
@StringRes val subtitleRes: Int,
val formatSubtitle: @Composable () -> String = { stringResource(subtitleRes) },
val titleRes: StringResource,
val subtitleRes: StringResource? = null,
val formatSubtitle: @Composable () -> String? = { subtitleRes?.let { stringResource(it) } },
val icon: ImageVector,
val screen: VoyagerScreen,
)
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_backup_and_sync,
subtitleRes = R.string.pref_backup_summary,
titleRes = MR.strings.label_backup_and_sync,
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,
),
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,
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,18 +1,17 @@
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.ReaderOrientation
import eu.kanade.tachiyomi.ui.reader.setting.ReaderPreferences
import eu.kanade.tachiyomi.ui.reader.setting.ReadingMode
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.collectAsState
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
@ -22,8 +21,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> {
@ -31,43 +29,43 @@ 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),
),
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,
),
Preference.PreferenceItem.SwitchPreference(
pref = readerPref.pageTransitions(),
title = stringResource(R.string.pref_page_transitions),
title = stringResource(MR.strings.pref_page_transitions),
),
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),
@ -83,42 +81,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),
),
),
)
@ -127,23 +125,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),
),
),
)
@ -162,57 +160,57 @@ 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 = listOf(
ReaderPreferences.TappingInvertMode.NONE,
ReaderPreferences.TappingInvertMode.HORIZONTAL,
ReaderPreferences.TappingInvertMode.VERTICAL,
ReaderPreferences.TappingInvertMode.BOTH,
).associateWith { stringResource(it.titleResId) },
).associateWith { stringResource(it.titleRes) },
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),
),
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
@ -220,13 +218,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
@ -234,7 +232,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,
),
),
@ -254,29 +252,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 = listOf(
ReaderPreferences.TappingInvertMode.NONE,
ReaderPreferences.TappingInvertMode.HORIZONTAL,
ReaderPreferences.TappingInvertMode.VERTICAL,
ReaderPreferences.TappingInvertMode.BOTH,
).associateWith { stringResource(it.titleResId) },
).associateWith { stringResource(it.titleRes) },
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,
@ -287,31 +285,31 @@ 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,
),
),
@ -323,15 +321,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,
),
),
@ -341,16 +339,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),
),
),
)

View File

@ -41,7 +41,6 @@ import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.platform.LocalFocusManager
import androidx.compose.ui.platform.LocalLayoutDirection
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.TextFieldValue
@ -53,8 +52,9 @@ import cafe.adriel.voyager.navigator.currentOrThrow
import eu.kanade.presentation.components.UpIcon
import eu.kanade.presentation.more.settings.Preference
import eu.kanade.presentation.util.Screen
import eu.kanade.tachiyomi.R
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.screens.EmptyScreen
import tachiyomi.presentation.core.util.runOnEnterKeyPressed
import cafe.adriel.voyager.core.screen.Screen as VoyagerScreen
@ -118,7 +118,7 @@ class SettingsSearchScreen : Screen() {
decorationBox = {
if (textFieldValue.text.isEmpty()) {
Text(
text = stringResource(R.string.action_search_settings),
text = stringResource(MR.strings.action_search_settings),
color = MaterialTheme.colorScheme.onSurfaceVariant,
style = MaterialTheme.typography.bodyLarge,
)
@ -222,7 +222,7 @@ private fun SearchResult(
when {
it == null -> {}
it.isEmpty() -> {
EmptyScreen(stringResource(R.string.no_results_found))
EmptyScreen(stringResource(MR.strings.no_results_found))
}
else -> {
LazyColumn(

View File

@ -1,19 +1,19 @@
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 eu.kanade.presentation.more.settings.Preference
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.core.security.SecurityPreferences
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.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
@ -22,8 +22,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> {
@ -37,43 +36,43 @@ 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) },
),
Preference.PreferenceItem.InfoPreference(stringResource(R.string.secure_screen_summary)),
Preference.PreferenceItem.InfoPreference(stringResource(MR.strings.secure_screen_summary)),
)
}
}

View File

@ -1,7 +1,6 @@
package eu.kanade.presentation.more.settings.screen
import android.content.Context
import androidx.annotation.StringRes
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
@ -13,7 +12,6 @@ import androidx.compose.material.icons.automirrored.outlined.HelpOutline
import androidx.compose.material.icons.filled.Visibility
import androidx.compose.material.icons.filled.VisibilityOff
import androidx.compose.material.icons.outlined.Close
import androidx.compose.material.icons.outlined.HelpOutline
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
@ -34,7 +32,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.input.ImeAction
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.text.input.PasswordVisualTransformation
@ -42,9 +39,9 @@ import androidx.compose.ui.text.input.TextFieldValue
import androidx.compose.ui.text.input.VisualTransformation
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import dev.icerock.moko.resources.StringResource
import eu.kanade.domain.track.service.TrackPreferences
import eu.kanade.presentation.more.settings.Preference
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.track.EnhancedTracker
import eu.kanade.tachiyomi.data.track.Tracker
import eu.kanade.tachiyomi.data.track.TrackerManager
@ -57,7 +54,9 @@ import eu.kanade.tachiyomi.util.system.toast
import tachiyomi.core.util.lang.launchIO
import tachiyomi.core.util.lang.withUIContext
import tachiyomi.domain.source.service.SourceManager
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.i18n.stringResource
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
@ -65,8 +64,7 @@ object SettingsTrackingScreen : SearchableSettings {
@ReadOnlyComposable
@Composable
@StringRes
override fun getTitleRes() = R.string.pref_category_tracking
override fun getTitleRes() = MR.strings.pref_category_tracking
@Composable
override fun RowScope.AppBarAction() {
@ -74,7 +72,7 @@ object SettingsTrackingScreen : SearchableSettings {
IconButton(onClick = { uriHandler.openUri("https://tachiyomi.org/docs/guides/tracking") }) {
Icon(
imageVector = Icons.AutoMirrored.Outlined.HelpOutline,
contentDescription = stringResource(R.string.tracking_guide),
contentDescription = stringResource(MR.strings.tracking_guide),
)
}
}
@ -111,10 +109,10 @@ object SettingsTrackingScreen : SearchableSettings {
val acceptedSources = (service as EnhancedTracker).getAcceptedSources()
sourceManager.getCatalogueSources().any { it::class.qualifiedName in acceptedSources }
}
var enhancedTrackerInfo = stringResource(R.string.enhanced_tracking_info)
var enhancedTrackerInfo = stringResource(MR.strings.enhanced_tracking_info)
if (enhancedTrackers.second.isNotEmpty()) {
val missingSourcesInfo = stringResource(
R.string.enhanced_services_not_installed,
MR.strings.enhanced_services_not_installed,
enhancedTrackers.second.joinToString { it.name },
)
enhancedTrackerInfo += "\n\n$missingSourcesInfo"
@ -123,10 +121,10 @@ object SettingsTrackingScreen : SearchableSettings {
return listOf(
Preference.PreferenceItem.SwitchPreference(
pref = trackPreferences.autoUpdateTrack(),
title = stringResource(R.string.pref_auto_update_manga_sync),
title = stringResource(MR.strings.pref_auto_update_manga_sync),
),
Preference.PreferenceGroup(
title = stringResource(R.string.services),
title = stringResource(MR.strings.services),
preferenceItems = listOf(
Preference.PreferenceItem.TrackerPreference(
title = trackerManager.myAnimeList.name,
@ -143,13 +141,13 @@ object SettingsTrackingScreen : SearchableSettings {
Preference.PreferenceItem.TrackerPreference(
title = trackerManager.kitsu.name,
tracker = trackerManager.kitsu,
login = { dialog = LoginDialog(trackerManager.kitsu, R.string.email) },
login = { dialog = LoginDialog(trackerManager.kitsu, MR.strings.email) },
logout = { dialog = LogoutDialog(trackerManager.kitsu) },
),
Preference.PreferenceItem.TrackerPreference(
title = trackerManager.mangaUpdates.name,
tracker = trackerManager.mangaUpdates,
login = { dialog = LoginDialog(trackerManager.mangaUpdates, R.string.username) },
login = { dialog = LoginDialog(trackerManager.mangaUpdates, MR.strings.username) },
logout = { dialog = LogoutDialog(trackerManager.mangaUpdates) },
),
Preference.PreferenceItem.TrackerPreference(
@ -164,11 +162,11 @@ object SettingsTrackingScreen : SearchableSettings {
login = { context.openInBrowser(BangumiApi.authUrl(), forceDefaultBrowser = true) },
logout = { dialog = LogoutDialog(trackerManager.bangumi) },
),
Preference.PreferenceItem.InfoPreference(stringResource(R.string.tracking_info)),
Preference.PreferenceItem.InfoPreference(stringResource(MR.strings.tracking_info)),
),
),
Preference.PreferenceGroup(
title = stringResource(R.string.enhanced_services),
title = stringResource(MR.strings.enhanced_services),
preferenceItems = enhancedTrackers.first
.map { service ->
Preference.PreferenceItem.TrackerPreference(
@ -185,7 +183,7 @@ object SettingsTrackingScreen : SearchableSettings {
@Composable
private fun TrackingLoginDialog(
tracker: Tracker,
@StringRes uNameStringRes: Int,
uNameStringRes: StringResource,
onDismissRequest: () -> Unit,
) {
val context = LocalContext.current
@ -201,13 +199,13 @@ object SettingsTrackingScreen : SearchableSettings {
title = {
Row(verticalAlignment = Alignment.CenterVertically) {
Text(
text = stringResource(R.string.login_title, tracker.name),
text = stringResource(MR.strings.login_title, tracker.name),
modifier = Modifier.weight(1f),
)
IconButton(onClick = onDismissRequest) {
Icon(
imageVector = Icons.Outlined.Close,
contentDescription = stringResource(R.string.action_close),
contentDescription = stringResource(MR.strings.action_close),
)
}
}
@ -229,7 +227,7 @@ object SettingsTrackingScreen : SearchableSettings {
modifier = Modifier.fillMaxWidth(),
value = password,
onValueChange = { password = it },
label = { Text(text = stringResource(R.string.password)) },
label = { Text(text = stringResource(MR.strings.password)) },
trailingIcon = {
IconButton(onClick = { hidePassword = !hidePassword }) {
Icon(
@ -275,7 +273,7 @@ object SettingsTrackingScreen : SearchableSettings {
}
},
) {
val id = if (processing) R.string.loading else R.string.login
val id = if (processing) MR.strings.loading else MR.strings.login
Text(text = stringResource(id))
}
},
@ -290,7 +288,7 @@ object SettingsTrackingScreen : SearchableSettings {
): Boolean {
return try {
tracker.login(username, password)
withUIContext { context.toast(R.string.login_success) }
withUIContext { context.toast(MR.strings.login_success) }
true
} catch (e: Throwable) {
tracker.logout()
@ -309,7 +307,7 @@ object SettingsTrackingScreen : SearchableSettings {
onDismissRequest = onDismissRequest,
title = {
Text(
text = stringResource(R.string.logout_title, tracker.name),
text = stringResource(MR.strings.logout_title, tracker.name),
textAlign = TextAlign.Center,
modifier = Modifier.fillMaxWidth(),
)
@ -320,21 +318,21 @@ object SettingsTrackingScreen : SearchableSettings {
modifier = Modifier.weight(1f),
onClick = onDismissRequest,
) {
Text(text = stringResource(R.string.action_cancel))
Text(text = stringResource(MR.strings.action_cancel))
}
Button(
modifier = Modifier.weight(1f),
onClick = {
tracker.logout()
onDismissRequest()
context.toast(R.string.logout_success)
context.toast(MR.strings.logout_success)
},
colors = ButtonDefaults.buttonColors(
containerColor = MaterialTheme.colorScheme.error,
contentColor = MaterialTheme.colorScheme.onError,
),
) {
Text(text = stringResource(R.string.logout))
Text(text = stringResource(MR.strings.logout))
}
}
},
@ -344,7 +342,7 @@ object SettingsTrackingScreen : SearchableSettings {
private data class LoginDialog(
val tracker: Tracker,
@StringRes val uNameStringRes: Int,
val uNameStringRes: StringResource,
)
private data class LogoutDialog(

View File

@ -19,7 +19,6 @@ import androidx.compose.runtime.setValue
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.unit.dp
import cafe.adriel.voyager.navigator.LocalNavigator
import cafe.adriel.voyager.navigator.currentOrThrow
@ -30,7 +29,6 @@ import eu.kanade.presentation.more.settings.widget.TextPreferenceWidget
import eu.kanade.presentation.util.LocalBackPress
import eu.kanade.presentation.util.Screen
import eu.kanade.tachiyomi.BuildConfig
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.updater.AppUpdateChecker
import eu.kanade.tachiyomi.data.updater.RELEASE_URL
import eu.kanade.tachiyomi.ui.more.NewUpdateScreen
@ -44,9 +42,11 @@ import tachiyomi.core.util.lang.withIOContext
import tachiyomi.core.util.lang.withUIContext
import tachiyomi.core.util.system.logcat
import tachiyomi.domain.release.interactor.GetApplicationRelease
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.stringResource
import tachiyomi.presentation.core.icons.CustomIcons
import tachiyomi.presentation.core.icons.Discord
import tachiyomi.presentation.core.icons.Facebook
@ -74,7 +74,7 @@ object AboutScreen : Screen() {
Scaffold(
topBar = { scrollBehavior ->
AppBar(
title = stringResource(R.string.pref_category_about),
title = stringResource(MR.strings.pref_category_about),
navigateUp = if (handleBack != null) handleBack::invoke else null,
scrollBehavior = scrollBehavior,
)
@ -89,7 +89,7 @@ object AboutScreen : Screen() {
item {
TextPreferenceWidget(
title = stringResource(R.string.version),
title = stringResource(MR.strings.version),
subtitle = getVersionName(withBuildDate = true),
onPreferenceClick = {
val deviceInfo = CrashLogUtil(context).getDebugInfo()
@ -101,7 +101,7 @@ object AboutScreen : Screen() {
if (BuildConfig.INCLUDE_UPDATER) {
item {
TextPreferenceWidget(
title = stringResource(R.string.check_for_updates),
title = stringResource(MR.strings.check_for_updates),
widget = {
AnimatedVisibility(visible = isCheckingUpdates) {
CircularProgressIndicator(
@ -140,7 +140,7 @@ object AboutScreen : Screen() {
if (!BuildConfig.DEBUG) {
item {
TextPreferenceWidget(
title = stringResource(R.string.whats_new),
title = stringResource(MR.strings.whats_new),
onPreferenceClick = { uriHandler.openUri(RELEASE_URL) },
)
}
@ -148,21 +148,21 @@ object AboutScreen : Screen() {
item {
TextPreferenceWidget(
title = stringResource(R.string.help_translate),
title = stringResource(MR.strings.help_translate),
onPreferenceClick = { uriHandler.openUri("https://tachiyomi.org/docs/contribute#translation") },
)
}
item {
TextPreferenceWidget(
title = stringResource(R.string.licenses),
title = stringResource(MR.strings.licenses),
onPreferenceClick = { navigator.push(OpenSourceLicensesScreen()) },
)
}
item {
TextPreferenceWidget(
title = stringResource(R.string.privacy_policy),
title = stringResource(MR.strings.privacy_policy),
onPreferenceClick = { uriHandler.openUri("https://tachiyomi.org/privacy/") },
)
}
@ -175,7 +175,7 @@ object AboutScreen : Screen() {
horizontalArrangement = Arrangement.Center,
) {
LinkIcon(
label = stringResource(R.string.website),
label = stringResource(MR.strings.website),
icon = Icons.Outlined.Public,
url = "https://tachiyomi.org",
)
@ -226,10 +226,10 @@ object AboutScreen : Screen() {
onAvailableUpdate(result)
}
is GetApplicationRelease.Result.NoNewUpdate -> {
context.toast(R.string.update_check_no_new_updates)
context.toast(MR.strings.update_check_no_new_updates)
}
is GetApplicationRelease.Result.OsTooOld -> {
context.toast(R.string.update_check_eol)
context.toast(MR.strings.update_check_eol)
}
else -> {}
}

View File

@ -9,7 +9,6 @@ import androidx.compose.material.icons.filled.Public
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalUriHandler
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.compose.ui.viewinterop.AndroidView
import androidx.core.text.HtmlCompat
@ -19,9 +18,10 @@ import com.google.android.material.textview.MaterialTextView
import eu.kanade.presentation.components.AppBar
import eu.kanade.presentation.components.AppBarActions
import eu.kanade.presentation.util.Screen
import eu.kanade.tachiyomi.R
import kotlinx.collections.immutable.persistentListOf
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.i18n.stringResource
class OpenSourceLibraryLicenseScreen(
private val name: String,
@ -44,7 +44,7 @@ class OpenSourceLibraryLicenseScreen(
AppBarActions(
persistentListOf(
AppBar.Action(
title = stringResource(R.string.website),
title = stringResource(MR.strings.website),
icon = Icons.Default.Public,
onClick = { uriHandler.openUri(website) },
),

View File

@ -4,7 +4,6 @@ import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import cafe.adriel.voyager.navigator.LocalNavigator
import cafe.adriel.voyager.navigator.currentOrThrow
import com.mikepenz.aboutlibraries.ui.compose.LibrariesContainer
@ -12,8 +11,9 @@ import com.mikepenz.aboutlibraries.ui.compose.LibraryDefaults
import com.mikepenz.aboutlibraries.ui.compose.util.htmlReadyLicenseContent
import eu.kanade.presentation.components.AppBar
import eu.kanade.presentation.util.Screen
import eu.kanade.tachiyomi.R
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.i18n.stringResource
class OpenSourceLicensesScreen : Screen() {
@ -23,7 +23,7 @@ class OpenSourceLicensesScreen : Screen() {
Scaffold(
topBar = { scrollBehavior ->
AppBar(
title = stringResource(R.string.licenses),
title = stringResource(MR.strings.licenses),
navigateUp = navigator::pop,
scrollBehavior = scrollBehavior,
)

View File

@ -27,7 +27,6 @@ import androidx.compose.runtime.rememberCoroutineScope
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
@ -39,7 +38,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
@ -51,7 +49,9 @@ 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.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
@ -81,20 +81,20 @@ class ClearDatabaseScreen : Screen() {
model.removeMangaBySourceId()
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 = {
Text(text = stringResource(R.string.clear_database_confirmation))
Text(text = stringResource(MR.strings.clear_database_confirmation))
},
)
}
@ -102,19 +102,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,
),
@ -128,7 +128,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 {
@ -160,7 +160,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,
)
}
@ -196,7 +196,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,11 @@ 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.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 +71,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 +89,7 @@ class CreateBackupScreen : Screen() {
) {
item {
LabeledCheckbox(
label = stringResource(R.string.manga),
label = stringResource(MR.strings.manga),
checked = true,
onCheckedChange = {},
enabled = false,
@ -117,20 +117,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,10 +163,10 @@ 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,
)

View File

@ -10,7 +10,6 @@ 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.text.font.FontFamily
import androidx.compose.ui.unit.dp
import cafe.adriel.voyager.navigator.LocalNavigator
@ -18,12 +17,13 @@ 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.data.backup.models.Backup
import eu.kanade.tachiyomi.util.system.copyToClipboard
import kotlinx.collections.immutable.persistentListOf
import kotlinx.serialization.protobuf.schema.ProtoBufSchemaGenerator
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.i18n.stringResource
class BackupSchemaScreen : Screen() {
@ -47,7 +47,7 @@ class BackupSchemaScreen : Screen() {
AppBarActions(
persistentListOf(
AppBar.Action(
title = stringResource(R.string.action_copy_to_clipboard),
title = stringResource(MR.strings.action_copy_to_clipboard),
icon = Icons.Default.ContentCopy,
onClick = {
context.copyToClipboard(title, schema)

View File

@ -17,6 +17,7 @@ import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.util.system.DeviceUtil
import eu.kanade.tachiyomi.util.system.WebViewUtil
import kotlinx.coroutines.guava.await
import tachiyomi.i18n.MR
class DebugInfoScreen : Screen() {
@ -24,7 +25,7 @@ class DebugInfoScreen : Screen() {
override fun Content() {
val navigator = LocalNavigator.currentOrThrow
PreferenceScaffold(
titleRes = R.string.pref_debug_info,
titleRes = MR.strings.pref_debug_info,
onBackPressed = navigator::pop,
itemsProvider = {
listOf(

View File

@ -15,7 +15,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.text.font.FontFamily
import androidx.compose.ui.unit.dp
import androidx.compose.ui.util.fastForEach
@ -30,14 +29,15 @@ import eu.kanade.presentation.components.AppBar
import eu.kanade.presentation.components.AppBarActions
import eu.kanade.presentation.util.Screen
import eu.kanade.presentation.util.ioCoroutineScope
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.util.system.copyToClipboard
import eu.kanade.tachiyomi.util.system.workManager
import kotlinx.collections.immutable.persistentListOf
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.stateIn
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.Scaffold
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.plus
class WorkerInfoScreen : Screen() {
@ -65,7 +65,7 @@ class WorkerInfoScreen : Screen() {
AppBarActions(
persistentListOf(
AppBar.Action(
title = stringResource(R.string.action_copy_to_clipboard),
title = stringResource(MR.strings.action_copy_to_clipboard),
icon = Icons.Default.ContentCopy,
onClick = {
context.copyToClipboard(title, enqueued + finished + running)

View File

@ -36,17 +36,17 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.alpha
import androidx.compose.ui.draw.clip
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.PreviewLightDark
import androidx.compose.ui.unit.dp
import eu.kanade.domain.ui.model.AppTheme
import eu.kanade.presentation.manga.components.MangaCover
import eu.kanade.presentation.theme.TachiyomiTheme
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.util.system.DeviceUtil
import eu.kanade.tachiyomi.util.system.isDynamicColorAvailable
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.secondaryItemAlpha
@Composable
@ -76,7 +76,7 @@ private fun AppThemesList(
) {
val appThemes = remember {
AppTheme.entries
.filterNot { it.titleResId == null || (it == AppTheme.MONET && !DeviceUtil.isDynamicColorAvailable) }
.filterNot { it.titleRes == null || (it == AppTheme.MONET && !DeviceUtil.isDynamicColorAvailable) }
}
LazyRow(
contentPadding = PaddingValues(horizontal = PrefsHorizontalPadding),
@ -104,7 +104,7 @@ private fun AppThemesList(
Spacer(modifier = Modifier.height(8.dp))
Text(
text = stringResource(appTheme.titleResId!!),
text = stringResource(appTheme.titleRes!!),
modifier = Modifier
.fillMaxWidth()
.secondaryItemAlpha(),
@ -167,7 +167,7 @@ fun AppThemePreviewItem(
if (selected) {
Icon(
imageVector = Icons.Filled.CheckCircle,
contentDescription = stringResource(R.string.selected),
contentDescription = stringResource(MR.strings.selected),
tint = MaterialTheme.colorScheme.primary,
)
}

View File

@ -19,11 +19,11 @@ import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.vector.ImageVector
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 kotlinx.coroutines.launch
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun EditTextPreferenceWidget(
@ -83,12 +83,12 @@ fun EditTextPreferenceWidget(
}
},
) {
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

@ -11,11 +11,11 @@ import androidx.compose.material3.Surface
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.tooling.preview.PreviewLightDark
import eu.kanade.presentation.theme.TachiyomiTheme
import eu.kanade.tachiyomi.R
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.secondaryItemAlpha
@Composable
@ -45,7 +45,7 @@ internal fun InfoWidget(text: String) {
private fun InfoWidgetPreview() {
TachiyomiTheme {
Surface {
InfoWidget(text = stringResource(R.string.download_ahead_info))
InfoWidget(text = stringResource(MR.strings.download_ahead_info))
}
}
}

View File

@ -22,10 +22,10 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import eu.kanade.tachiyomi.R
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.ScrollbarLazyColumn
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.isScrolledToEnd
import tachiyomi.presentation.core.util.isScrolledToStart
@ -75,7 +75,7 @@ fun <T> ListPreferenceWidget(
},
confirmButton = {
TextButton(onClick = { isDialogShown = false }) {
Text(text = stringResource(R.string.action_cancel))
Text(text = stringResource(MR.strings.action_cancel))
}
},
)

View File

@ -10,11 +10,11 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.runtime.toMutableStateList
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.window.DialogProperties
import eu.kanade.presentation.more.settings.Preference
import eu.kanade.tachiyomi.R
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.LabeledCheckbox
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun MultiSelectListPreferenceWidget(
@ -70,12 +70,12 @@ fun MultiSelectListPreferenceWidget(
isDialogShown = false
},
) {
Text(text = stringResource(R.string.action_ok))
Text(text = stringResource(MR.strings.action_ok))
}
},
dismissButton = {
TextButton(onClick = { isDialogShown = false }) {
Text(text = stringResource(R.string.action_cancel))
Text(text = stringResource(MR.strings.action_cancel))
}
},
)

View File

@ -15,12 +15,12 @@ import androidx.compose.runtime.Composable
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 eu.kanade.presentation.more.settings.LocalPreferenceHighlighted
import eu.kanade.presentation.track.components.TrackLogoIcon
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.track.Tracker
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun TrackingPreferenceWidget(
@ -55,7 +55,7 @@ fun TrackingPreferenceWidget(
.padding(4.dp)
.size(32.dp),
tint = Color(0xFF4CAF50),
contentDescription = stringResource(R.string.login_success),
contentDescription = stringResource(MR.strings.login_success),
)
}
}

View File

@ -27,9 +27,9 @@ import androidx.compose.runtime.toMutableStateList
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import eu.kanade.tachiyomi.R
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.isScrolledToEnd
import tachiyomi.presentation.core.util.isScrolledToStart
@ -104,9 +104,9 @@ fun <T> TriStateListDialog(
},
contentDescription = stringResource(
when (state) {
State.UNCHECKED -> R.string.not_selected
State.CHECKED -> R.string.selected
State.INVERSED -> R.string.disabled
State.UNCHECKED -> MR.strings.not_selected
State.CHECKED -> MR.strings.selected
State.INVERSED -> MR.strings.disabled
},
),
)
@ -130,7 +130,7 @@ fun <T> TriStateListDialog(
},
dismissButton = {
TextButton(onClick = onDismissRequest) {
Text(text = stringResource(R.string.action_cancel))
Text(text = stringResource(MR.strings.action_cancel))
}
},
confirmButton = {
@ -145,7 +145,7 @@ fun <T> TriStateListDialog(
onValueChanged(included, excluded)
},
) {
Text(text = stringResource(R.string.action_ok))
Text(text = stringResource(MR.strings.action_ok))
}
},
)

View File

@ -13,14 +13,14 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import eu.kanade.presentation.more.stats.components.StatsItem
import eu.kanade.presentation.more.stats.components.StatsOverviewItem
import eu.kanade.presentation.more.stats.components.StatsSection
import eu.kanade.presentation.more.stats.data.StatsData
import eu.kanade.presentation.util.toDurationString
import eu.kanade.tachiyomi.R
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.i18n.stringResource
import java.util.Locale
import kotlin.time.DurationUnit
import kotlin.time.toDuration
@ -55,28 +55,28 @@ fun StatsScreenContent(
private fun OverviewSection(
data: StatsData.Overview,
) {
val none = stringResource(R.string.none)
val none = stringResource(MR.strings.none)
val context = LocalContext.current
val readDurationString = remember(data.totalReadDuration) {
data.totalReadDuration
.toDuration(DurationUnit.MILLISECONDS)
.toDurationString(context, fallback = none)
}
StatsSection(R.string.label_overview_section) {
StatsSection(MR.strings.label_overview_section) {
Row {
StatsOverviewItem(
title = data.libraryMangaCount.toString(),
subtitle = stringResource(R.string.in_library),
subtitle = stringResource(MR.strings.in_library),
icon = Icons.Outlined.CollectionsBookmark,
)
StatsOverviewItem(
title = data.completedMangaCount.toString(),
subtitle = stringResource(R.string.label_completed_titles),
subtitle = stringResource(MR.strings.label_completed_titles),
icon = Icons.Outlined.LocalLibrary,
)
StatsOverviewItem(
title = readDurationString,
subtitle = stringResource(R.string.label_read_duration),
subtitle = stringResource(MR.strings.label_read_duration),
icon = Icons.Outlined.Schedule,
)
}
@ -87,19 +87,19 @@ private fun OverviewSection(
private fun TitlesStats(
data: StatsData.Titles,
) {
StatsSection(R.string.label_titles_section) {
StatsSection(MR.strings.label_titles_section) {
Row {
StatsItem(
data.globalUpdateItemCount.toString(),
stringResource(R.string.label_titles_in_global_update),
stringResource(MR.strings.label_titles_in_global_update),
)
StatsItem(
data.startedMangaCount.toString(),
stringResource(R.string.label_started),
stringResource(MR.strings.label_started),
)
StatsItem(
data.localMangaCount.toString(),
stringResource(R.string.label_local),
stringResource(MR.strings.label_local),
)
}
}
@ -109,19 +109,19 @@ private fun TitlesStats(
private fun ChapterStats(
data: StatsData.Chapters,
) {
StatsSection(R.string.chapters) {
StatsSection(MR.strings.chapters) {
Row {
StatsItem(
data.totalChapterCount.toString(),
stringResource(R.string.label_total_chapters),
stringResource(MR.strings.label_total_chapters),
)
StatsItem(
data.readChapterCount.toString(),
stringResource(R.string.label_read_chapters),
stringResource(MR.strings.label_read_chapters),
)
StatsItem(
data.downloadCount.toString(),
stringResource(R.string.label_downloaded),
stringResource(MR.strings.label_downloaded),
)
}
}
@ -131,7 +131,7 @@ private fun ChapterStats(
private fun TrackerStats(
data: StatsData.Trackers,
) {
val notApplicable = stringResource(R.string.not_applicable)
val notApplicable = stringResource(MR.strings.not_applicable)
val meanScoreStr = remember(data.trackedTitleCount, data.meanScore) {
if (data.trackedTitleCount > 0 && !data.meanScore.isNaN()) {
// All other numbers are localized in English
@ -140,19 +140,19 @@ private fun TrackerStats(
notApplicable
}
}
StatsSection(R.string.label_tracker_section) {
StatsSection(MR.strings.label_tracker_section) {
Row {
StatsItem(
data.trackedTitleCount.toString(),
stringResource(R.string.label_tracked_titles),
stringResource(MR.strings.label_tracked_titles),
)
StatsItem(
meanScoreStr,
stringResource(R.string.label_mean_score),
stringResource(MR.strings.label_mean_score),
)
StatsItem(
data.trackerCount.toString(),
stringResource(R.string.label_used),
stringResource(MR.strings.label_used),
)
}
}

View File

@ -1,6 +1,5 @@
package eu.kanade.presentation.more.stats.components
import androidx.annotation.StringRes
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
@ -9,12 +8,13 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import dev.icerock.moko.resources.StringResource
import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun StatsSection(
@StringRes titleRes: Int,
titleRes: StringResource,
content: @Composable () -> Unit,
) {
Text(

View File

@ -26,8 +26,6 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.pluralStringResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.Placeholder
import androidx.compose.ui.text.PlaceholderVerticalAlign
import androidx.compose.ui.text.buildAnnotatedString
@ -36,13 +34,15 @@ import androidx.compose.ui.tooling.preview.PreviewLightDark
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import eu.kanade.presentation.theme.TachiyomiTheme
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.database.models.Chapter
import eu.kanade.tachiyomi.data.database.models.ChapterImpl
import eu.kanade.tachiyomi.data.database.models.toDomainChapter
import eu.kanade.tachiyomi.ui.reader.model.ChapterTransition
import eu.kanade.tachiyomi.ui.reader.model.ReaderChapter
import tachiyomi.domain.chapter.service.calculateChapterGap
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.pluralStringResource
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.secondaryItemAlpha
@Composable
@ -58,25 +58,25 @@ fun ChapterTransition(
when (transition) {
is ChapterTransition.Prev -> {
TransitionText(
topLabel = stringResource(R.string.transition_previous),
topLabel = stringResource(MR.strings.transition_previous),
topChapter = goingToChapter,
topChapterDownloaded = goingToChapterDownloaded,
bottomLabel = stringResource(R.string.transition_current),
bottomLabel = stringResource(MR.strings.transition_current),
bottomChapter = currChapter,
bottomChapterDownloaded = currChapterDownloaded,
fallbackLabel = stringResource(R.string.transition_no_previous),
fallbackLabel = stringResource(MR.strings.transition_no_previous),
chapterGap = calculateChapterGap(currChapter.toDomainChapter(), goingToChapter?.toDomainChapter()),
)
}
is ChapterTransition.Next -> {
TransitionText(
topLabel = stringResource(R.string.transition_finished),
topLabel = stringResource(MR.strings.transition_finished),
topChapter = currChapter,
topChapterDownloaded = currChapterDownloaded,
bottomLabel = stringResource(R.string.transition_next),
bottomLabel = stringResource(MR.strings.transition_next),
bottomChapter = goingToChapter,
bottomChapterDownloaded = goingToChapterDownloaded,
fallbackLabel = stringResource(R.string.transition_no_next),
fallbackLabel = stringResource(MR.strings.transition_no_next),
chapterGap = calculateChapterGap(goingToChapter?.toDomainChapter(), currChapter.toDomainChapter()),
)
}
@ -191,7 +191,7 @@ private fun ChapterGapWarning(
)
Text(
text = pluralStringResource(R.plurals.missing_chapters_warning, count = gapCount, gapCount),
text = pluralStringResource(MR.plurals.missing_chapters_warning, count = gapCount, gapCount),
style = MaterialTheme.typography.bodyMedium,
)
}
@ -245,7 +245,7 @@ private fun ChapterText(
) {
Icon(
imageVector = Icons.Filled.CheckCircle,
contentDescription = stringResource(R.string.label_downloaded),
contentDescription = stringResource(MR.strings.label_downloaded),
)
},
),

View File

@ -12,18 +12,19 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.res.vectorResource
import androidx.compose.ui.tooling.preview.PreviewLightDark
import dev.icerock.moko.resources.StringResource
import eu.kanade.domain.manga.model.readerOrientation
import eu.kanade.presentation.components.AdaptiveSheet
import eu.kanade.presentation.reader.components.ModeSelectionDialog
import eu.kanade.presentation.theme.TachiyomiTheme
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.ui.reader.setting.ReaderOrientation
import eu.kanade.tachiyomi.ui.reader.setting.ReaderSettingsScreenModel
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.SettingsIconGrid
import tachiyomi.presentation.core.components.material.IconToggleButton
import tachiyomi.presentation.core.i18n.stringResource
private val ReaderOrientationsWithoutDefault = ReaderOrientation.entries - ReaderOrientation.DEFAULT
@ -31,7 +32,7 @@ private val ReaderOrientationsWithoutDefault = ReaderOrientation.entries - Reade
fun OrientationSelectDialog(
onDismissRequest: () -> Unit,
screenModel: ReaderSettingsScreenModel,
onChange: (Int) -> Unit,
onChange: (StringResource) -> Unit,
) {
val manga by screenModel.mangaFlow.collectAsState()
val orientation = remember(manga) { ReaderOrientation.fromPreference(manga?.readerOrientation?.toInt()) }
@ -63,7 +64,7 @@ private fun DialogContent(
}.takeIf { orientation != ReaderOrientation.DEFAULT },
onApply = { onChangeOrientation(selected) },
) {
SettingsIconGrid(R.string.rotation_type) {
SettingsIconGrid(MR.strings.rotation_type) {
items(ReaderOrientationsWithoutDefault) { mode ->
IconToggleButton(
checked = mode == selected,

View File

@ -17,12 +17,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.dp
import eu.kanade.presentation.components.AdaptiveSheet
import eu.kanade.tachiyomi.R
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.ActionButton
import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun ReaderPageActionsDialog(
@ -42,13 +42,13 @@ fun ReaderPageActionsDialog(
) {
ActionButton(
modifier = Modifier.weight(1f),
title = stringResource(R.string.set_as_cover),
title = stringResource(MR.strings.set_as_cover),
icon = Icons.Outlined.Photo,
onClick = { showSetCoverDialog = true },
)
ActionButton(
modifier = Modifier.weight(1f),
title = stringResource(R.string.action_share),
title = stringResource(MR.strings.action_share),
icon = Icons.Outlined.Share,
onClick = {
onShare()
@ -57,7 +57,7 @@ fun ReaderPageActionsDialog(
)
ActionButton(
modifier = Modifier.weight(1f),
title = stringResource(R.string.action_save),
title = stringResource(MR.strings.action_save),
icon = Icons.Outlined.Save,
onClick = {
onSave()
@ -85,16 +85,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

@ -12,18 +12,19 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.res.vectorResource
import androidx.compose.ui.tooling.preview.PreviewLightDark
import dev.icerock.moko.resources.StringResource
import eu.kanade.domain.manga.model.readingMode
import eu.kanade.presentation.components.AdaptiveSheet
import eu.kanade.presentation.reader.components.ModeSelectionDialog
import eu.kanade.presentation.theme.TachiyomiTheme
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.ui.reader.setting.ReaderSettingsScreenModel
import eu.kanade.tachiyomi.ui.reader.setting.ReadingMode
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.SettingsIconGrid
import tachiyomi.presentation.core.components.material.IconToggleButton
import tachiyomi.presentation.core.i18n.stringResource
private val ReadingModesWithoutDefault = ReadingMode.entries - ReadingMode.DEFAULT
@ -31,7 +32,7 @@ private val ReadingModesWithoutDefault = ReadingMode.entries - ReadingMode.DEFAU
fun ReadingModeSelectDialog(
onDismissRequest: () -> Unit,
screenModel: ReaderSettingsScreenModel,
onChange: (Int) -> Unit,
onChange: (StringResource) -> Unit,
) {
val manga by screenModel.mangaFlow.collectAsState()
val readingMode = remember(manga) { ReadingMode.fromPreference(manga?.readingMode?.toInt()) }
@ -59,7 +60,7 @@ private fun DialogContent(
onUseDefault = { onChangeReadingMode(ReadingMode.DEFAULT) }.takeIf { readingMode != ReadingMode.DEFAULT },
onApply = { onChangeReadingMode(selected) },
) {
SettingsIconGrid(R.string.pref_category_reading_mode) {
SettingsIconGrid(MR.strings.pref_category_reading_mode) {
items(ReadingModesWithoutDefault) { mode ->
IconToggleButton(
checked = mode == selected,

View File

@ -14,11 +14,12 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.ui.reader.setting.ReaderOrientation
import eu.kanade.tachiyomi.ui.reader.setting.ReadingMode
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun BottomReaderBar(
@ -42,28 +43,28 @@ fun BottomReaderBar(
IconButton(onClick = onClickReadingMode) {
Icon(
painter = painterResource(readingMode.iconRes),
contentDescription = stringResource(R.string.viewer),
contentDescription = stringResource(MR.strings.viewer),
)
}
IconButton(onClick = onClickOrientation) {
Icon(
painter = painterResource(orientation.iconRes),
contentDescription = stringResource(R.string.rotation_type),
contentDescription = stringResource(MR.strings.rotation_type),
)
}
IconButton(onClick = onClickCropBorder) {
Icon(
painter = painterResource(if (cropEnabled) R.drawable.ic_crop_24dp else R.drawable.ic_crop_off_24dp),
contentDescription = stringResource(R.string.pref_crop_borders),
contentDescription = stringResource(MR.strings.pref_crop_borders),
)
}
IconButton(onClick = onClickSettings) {
Icon(
imageVector = Icons.Outlined.Settings,
contentDescription = stringResource(R.string.action_settings),
contentDescription = stringResource(MR.strings.action_settings),
)
}
}

View File

@ -18,18 +18,18 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.surfaceColorAtElevation
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.IntOffset
import androidx.compose.ui.unit.dp
import eu.kanade.presentation.components.AppBar
import eu.kanade.presentation.components.AppBarActions
import eu.kanade.presentation.reader.components.ChapterNavigator
import eu.kanade.tachiyomi.R
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 tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.stringResource
private val animationSpec = tween<IntOffset>(200)
@ -105,9 +105,9 @@ fun ReaderAppBars(
AppBar.Action(
title = stringResource(
if (bookmarked) {
R.string.action_remove_bookmark
MR.strings.action_remove_bookmark
} else {
R.string.action_bookmark
MR.strings.action_bookmark
},
),
icon = if (bookmarked) {
@ -121,7 +121,7 @@ fun ReaderAppBars(
onOpenInWebView?.let {
add(
AppBar.OverflowAction(
title = stringResource(R.string.action_open_in_web_view),
title = stringResource(MR.strings.action_open_in_web_view),
onClick = it,
),
)
@ -129,7 +129,7 @@ fun ReaderAppBars(
onShare?.let {
add(
AppBar.OverflowAction(
title = stringResource(R.string.action_share),
title = stringResource(MR.strings.action_share),
onClick = it,
),
)

View File

@ -30,11 +30,11 @@ import androidx.compose.ui.draw.clip
import androidx.compose.ui.hapticfeedback.HapticFeedbackType
import androidx.compose.ui.platform.LocalHapticFeedback
import androidx.compose.ui.platform.LocalLayoutDirection
import androidx.compose.ui.res.stringResource
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
@ -78,7 +78,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,
),
)
}
@ -130,7 +130,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,
),
)
}

View File

@ -16,12 +16,12 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.PreviewLightDark
import androidx.compose.ui.unit.dp
import eu.kanade.presentation.theme.TachiyomiTheme
import eu.kanade.tachiyomi.R
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.SettingsItemsPaddings
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun ModeSelectionDialog(
@ -40,7 +40,7 @@ fun ModeSelectionDialog(
) {
onUseDefault?.let {
OutlinedButton(onClick = it) {
Text(text = stringResource(R.string.action_revert_to_default))
Text(text = stringResource(MR.strings.action_revert_to_default))
}
}
@ -57,7 +57,7 @@ fun ModeSelectionDialog(
imageVector = Icons.Outlined.Check,
contentDescription = null,
)
Text(text = stringResource(R.string.action_apply))
Text(text = stringResource(MR.strings.action_apply))
}
}
}

View File

@ -6,17 +6,17 @@ 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 androidx.core.graphics.alpha
import androidx.core.graphics.blue
import androidx.core.graphics.green
import androidx.core.graphics.red
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.ui.reader.setting.ReaderSettingsScreenModel
import tachiyomi.core.preference.getAndSet
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.CheckboxItem
import tachiyomi.presentation.core.components.SettingsChipRow
import tachiyomi.presentation.core.components.SliderItem
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.collectAsState
@Composable
@ -24,17 +24,17 @@ internal fun ColumnScope.ColorFilterPage(screenModel: ReaderSettingsScreenModel)
val colorFilterModes = buildList {
addAll(
listOf(
R.string.label_default,
R.string.filter_mode_multiply,
R.string.filter_mode_screen,
MR.strings.label_default,
MR.strings.filter_mode_multiply,
MR.strings.filter_mode_screen,
),
)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
addAll(
listOf(
R.string.filter_mode_overlay,
R.string.filter_mode_lighten,
R.string.filter_mode_darken,
MR.strings.filter_mode_overlay,
MR.strings.filter_mode_lighten,
MR.strings.filter_mode_darken,
),
)
}
@ -42,7 +42,7 @@ internal fun ColumnScope.ColorFilterPage(screenModel: ReaderSettingsScreenModel)
val customBrightness by screenModel.preferences.customBrightness().collectAsState()
CheckboxItem(
label = stringResource(R.string.pref_custom_brightness),
label = stringResource(MR.strings.pref_custom_brightness),
pref = screenModel.preferences.customBrightness(),
)
@ -55,7 +55,7 @@ internal fun ColumnScope.ColorFilterPage(screenModel: ReaderSettingsScreenModel)
if (customBrightness) {
val customBrightnessValue by screenModel.preferences.customBrightnessValue().collectAsState()
SliderItem(
label = stringResource(R.string.pref_custom_brightness),
label = stringResource(MR.strings.pref_custom_brightness),
min = -75,
max = 100,
value = customBrightnessValue,
@ -66,13 +66,13 @@ internal fun ColumnScope.ColorFilterPage(screenModel: ReaderSettingsScreenModel)
val colorFilter by screenModel.preferences.colorFilter().collectAsState()
CheckboxItem(
label = stringResource(R.string.pref_custom_color_filter),
label = stringResource(MR.strings.pref_custom_color_filter),
pref = screenModel.preferences.colorFilter(),
)
if (colorFilter) {
val colorFilterValue by screenModel.preferences.colorFilterValue().collectAsState()
SliderItem(
label = stringResource(R.string.color_filter_r_value),
label = stringResource(MR.strings.color_filter_r_value),
max = 255,
value = colorFilterValue.red,
valueText = colorFilterValue.red.toString(),
@ -83,7 +83,7 @@ internal fun ColumnScope.ColorFilterPage(screenModel: ReaderSettingsScreenModel)
},
)
SliderItem(
label = stringResource(R.string.color_filter_g_value),
label = stringResource(MR.strings.color_filter_g_value),
max = 255,
value = colorFilterValue.green,
valueText = colorFilterValue.green.toString(),
@ -94,7 +94,7 @@ internal fun ColumnScope.ColorFilterPage(screenModel: ReaderSettingsScreenModel)
},
)
SliderItem(
label = stringResource(R.string.color_filter_b_value),
label = stringResource(MR.strings.color_filter_b_value),
max = 255,
value = colorFilterValue.blue,
valueText = colorFilterValue.blue.toString(),
@ -105,7 +105,7 @@ internal fun ColumnScope.ColorFilterPage(screenModel: ReaderSettingsScreenModel)
},
)
SliderItem(
label = stringResource(R.string.color_filter_a_value),
label = stringResource(MR.strings.color_filter_a_value),
max = 255,
value = colorFilterValue.alpha,
valueText = colorFilterValue.alpha.toString(),
@ -117,7 +117,7 @@ internal fun ColumnScope.ColorFilterPage(screenModel: ReaderSettingsScreenModel)
)
val colorFilterMode by screenModel.preferences.colorFilterMode().collectAsState()
SettingsChipRow(R.string.pref_color_filter_mode) {
SettingsChipRow(MR.strings.pref_color_filter_mode) {
colorFilterModes.mapIndexed { index, it ->
FilterChip(
selected = colorFilterMode == index,
@ -129,11 +129,11 @@ internal fun ColumnScope.ColorFilterPage(screenModel: ReaderSettingsScreenModel)
}
CheckboxItem(
label = stringResource(R.string.pref_grayscale),
label = stringResource(MR.strings.pref_grayscale),
pref = screenModel.preferences.grayscale(),
)
CheckboxItem(
label = stringResource(R.string.pref_inverted_colors),
label = stringResource(MR.strings.pref_inverted_colors),
pref = screenModel.preferences.invertedColors(),
)
}

View File

@ -5,24 +5,24 @@ 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.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,44 +33,44 @@ 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(),
)
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(),
)
CheckboxItem(
label = stringResource(R.string.pref_page_transitions),
label = stringResource(MR.strings.pref_page_transitions),
pref = screenModel.preferences.pageTransitions(),
)
CheckboxItem(
label = stringResource(R.string.pref_flash_page),
label = stringResource(MR.strings.pref_flash_page),
pref = screenModel.preferences.flashOnPageChange(),
)
}

View File

@ -11,13 +11,13 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalView
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.window.DialogWindowProvider
import eu.kanade.presentation.components.TabbedDialog
import eu.kanade.presentation.components.TabbedDialogPaddings
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.ui.reader.setting.ReaderSettingsScreenModel
import kotlinx.collections.immutable.persistentListOf
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun ReaderSettingsDialog(
@ -27,9 +27,9 @@ fun ReaderSettingsDialog(
screenModel: ReaderSettingsScreenModel,
) {
val tabTitles = persistentListOf(
stringResource(R.string.pref_category_reading_mode),
stringResource(R.string.pref_category_general),
stringResource(R.string.custom_filter),
stringResource(MR.strings.pref_category_reading_mode),
stringResource(MR.strings.pref_category_general),
stringResource(MR.strings.custom_filter),
)
val pagerState = rememberPagerState { tabTitles.size }

View File

@ -7,29 +7,29 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.res.stringResource
import eu.kanade.domain.manga.model.readerOrientation
import eu.kanade.domain.manga.model.readingMode
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.ui.reader.setting.ReaderOrientation
import eu.kanade.tachiyomi.ui.reader.setting.ReaderPreferences
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.presentation.core.components.CheckboxItem
import tachiyomi.presentation.core.components.HeadingItem
import tachiyomi.presentation.core.components.SettingsChipRow
import tachiyomi.presentation.core.components.SliderItem
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.collectAsState
import java.text.NumberFormat
@Composable
internal fun ColumnScope.ReadingModePage(screenModel: ReaderSettingsScreenModel) {
HeadingItem(R.string.pref_category_for_this_series)
HeadingItem(MR.strings.pref_category_for_this_series)
val manga by screenModel.mangaFlow.collectAsState()
val readingMode = remember(manga) { ReadingMode.fromPreference(manga?.readingMode?.toInt()) }
SettingsChipRow(R.string.pref_category_reading_mode) {
SettingsChipRow(MR.strings.pref_category_reading_mode) {
ReadingMode.entries.map {
FilterChip(
selected = it == readingMode,
@ -40,7 +40,7 @@ internal fun ColumnScope.ReadingModePage(screenModel: ReaderSettingsScreenModel)
}
val orientation = remember(manga) { ReaderOrientation.fromPreference(manga?.readerOrientation?.toInt()) }
SettingsChipRow(R.string.rotation_type) {
SettingsChipRow(MR.strings.rotation_type) {
ReaderOrientation.entries.map {
FilterChip(
selected = it == orientation,
@ -60,7 +60,7 @@ internal fun ColumnScope.ReadingModePage(screenModel: ReaderSettingsScreenModel)
@Composable
private fun ColumnScope.PagerViewerSettings(screenModel: ReaderSettingsScreenModel) {
HeadingItem(R.string.pager_viewer)
HeadingItem(MR.strings.pager_viewer)
val navigationModePager by screenModel.preferences.navigationModePager().collectAsState()
val pagerNavInverted by screenModel.preferences.pagerNavInverted().collectAsState()
@ -72,7 +72,7 @@ private fun ColumnScope.PagerViewerSettings(screenModel: ReaderSettingsScreenMod
)
val imageScaleType by screenModel.preferences.imageScaleType().collectAsState()
SettingsChipRow(R.string.pref_image_scale_type) {
SettingsChipRow(MR.strings.pref_image_scale_type) {
ReaderPreferences.ImageScaleType.mapIndexed { index, it ->
FilterChip(
selected = imageScaleType == index + 1,
@ -83,7 +83,7 @@ private fun ColumnScope.PagerViewerSettings(screenModel: ReaderSettingsScreenMod
}
val zoomStart by screenModel.preferences.zoomStart().collectAsState()
SettingsChipRow(R.string.pref_zoom_start) {
SettingsChipRow(MR.strings.pref_zoom_start) {
ReaderPreferences.ZoomStart.mapIndexed { index, it ->
FilterChip(
selected = zoomStart == index + 1,
@ -94,42 +94,42 @@ private fun ColumnScope.PagerViewerSettings(screenModel: ReaderSettingsScreenMod
}
CheckboxItem(
label = stringResource(R.string.pref_crop_borders),
label = stringResource(MR.strings.pref_crop_borders),
pref = screenModel.preferences.cropBorders(),
)
CheckboxItem(
label = stringResource(R.string.pref_landscape_zoom),
label = stringResource(MR.strings.pref_landscape_zoom),
pref = screenModel.preferences.landscapeZoom(),
)
CheckboxItem(
label = stringResource(R.string.pref_navigate_pan),
label = stringResource(MR.strings.pref_navigate_pan),
pref = screenModel.preferences.navigateToPan(),
)
val dualPageSplitPaged by screenModel.preferences.dualPageSplitPaged().collectAsState()
CheckboxItem(
label = stringResource(R.string.pref_dual_page_split),
label = stringResource(MR.strings.pref_dual_page_split),
pref = screenModel.preferences.dualPageSplitPaged(),
)
if (dualPageSplitPaged) {
CheckboxItem(
label = stringResource(R.string.pref_dual_page_invert),
label = stringResource(MR.strings.pref_dual_page_invert),
pref = screenModel.preferences.dualPageInvertPaged(),
)
}
val dualPageRotateToFit by screenModel.preferences.dualPageRotateToFit().collectAsState()
CheckboxItem(
label = stringResource(R.string.pref_page_rotate),
label = stringResource(MR.strings.pref_page_rotate),
pref = screenModel.preferences.dualPageRotateToFit(),
)
if (dualPageRotateToFit) {
CheckboxItem(
label = stringResource(R.string.pref_page_rotate_invert),
label = stringResource(MR.strings.pref_page_rotate_invert),
pref = screenModel.preferences.dualPageRotateToFitInvert(),
)
}
@ -139,7 +139,7 @@ private fun ColumnScope.PagerViewerSettings(screenModel: ReaderSettingsScreenMod
private fun ColumnScope.WebtoonViewerSettings(screenModel: ReaderSettingsScreenModel) {
val numberFormat = remember { NumberFormat.getPercentInstance() }
HeadingItem(R.string.webtoon_viewer)
HeadingItem(MR.strings.webtoon_viewer)
val navigationModeWebtoon by screenModel.preferences.navigationModeWebtoon().collectAsState()
val webtoonNavInverted by screenModel.preferences.webtoonNavInverted().collectAsState()
@ -152,7 +152,7 @@ private fun ColumnScope.WebtoonViewerSettings(screenModel: ReaderSettingsScreenM
val webtoonSidePadding by screenModel.preferences.webtoonSidePadding().collectAsState()
SliderItem(
label = stringResource(R.string.pref_webtoon_side_padding),
label = stringResource(MR.strings.pref_webtoon_side_padding),
min = ReaderPreferences.WEBTOON_PADDING_MIN,
max = ReaderPreferences.WEBTOON_PADDING_MAX,
value = webtoonSidePadding,
@ -163,25 +163,25 @@ private fun ColumnScope.WebtoonViewerSettings(screenModel: ReaderSettingsScreenM
)
CheckboxItem(
label = stringResource(R.string.pref_crop_borders),
label = stringResource(MR.strings.pref_crop_borders),
pref = screenModel.preferences.cropBordersWebtoon(),
)
val dualPageSplitWebtoon by screenModel.preferences.dualPageSplitWebtoon().collectAsState()
CheckboxItem(
label = stringResource(R.string.pref_dual_page_split),
label = stringResource(MR.strings.pref_dual_page_split),
pref = screenModel.preferences.dualPageSplitWebtoon(),
)
if (dualPageSplitWebtoon) {
CheckboxItem(
label = stringResource(R.string.pref_dual_page_invert),
label = stringResource(MR.strings.pref_dual_page_invert),
pref = screenModel.preferences.dualPageInvertWebtoon(),
)
}
CheckboxItem(
label = stringResource(R.string.pref_double_tap_zoom),
label = stringResource(MR.strings.pref_double_tap_zoom),
pref = screenModel.preferences.webtoonDoubleTapZoomEnabled(),
)
}
@ -193,7 +193,7 @@ private fun ColumnScope.TapZonesItems(
invertMode: ReaderPreferences.TappingInvertMode,
onSelectInvertMode: (ReaderPreferences.TappingInvertMode) -> Unit,
) {
SettingsChipRow(R.string.pref_viewer_nav) {
SettingsChipRow(MR.strings.pref_viewer_nav) {
ReaderPreferences.TapZones.mapIndexed { index, it ->
FilterChip(
selected = selected == index,
@ -204,12 +204,12 @@ private fun ColumnScope.TapZonesItems(
}
if (selected != 5) {
SettingsChipRow(R.string.pref_read_with_tapping_inverted) {
SettingsChipRow(MR.strings.pref_read_with_tapping_inverted) {
ReaderPreferences.TappingInvertMode.entries.map {
FilterChip(
selected = it == invertMode,
onClick = { onSelectInvertMode(it) },
label = { Text(stringResource(it.titleResId)) },
label = { Text(stringResource(it.titleRes)) },
)
}
}

View File

@ -1,6 +1,5 @@
package eu.kanade.presentation.track
import androidx.annotation.StringRes
import androidx.compose.animation.animateContentSize
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
@ -42,20 +41,21 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.alpha
import androidx.compose.ui.draw.clip
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.PreviewLightDark
import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.unit.dp
import dev.icerock.moko.resources.StringResource
import eu.kanade.domain.track.model.toDbTrack
import eu.kanade.presentation.components.DropdownMenu
import eu.kanade.presentation.theme.TachiyomiTheme
import eu.kanade.presentation.track.components.TrackLogoIcon
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.track.Tracker
import eu.kanade.tachiyomi.ui.manga.track.TrackItem
import eu.kanade.tachiyomi.util.system.copyToClipboard
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.stringResource
import java.text.DateFormat
private const val UnsetStatusTextAlpha = 0.5F
@ -131,7 +131,7 @@ fun TrackInfoDialogHome(
private fun TrackInfoItem(
title: String,
tracker: Tracker,
@StringRes status: Int?,
status: StringResource?,
onStatusClick: () -> Unit,
chapters: String,
onChaptersClick: () -> Unit,
@ -209,7 +209,7 @@ private fun TrackInfoItem(
modifier = Modifier
.weight(1f)
.alpha(if (score == null) UnsetStatusTextAlpha else 1f),
text = score ?: stringResource(R.string.score),
text = score ?: stringResource(MR.strings.score),
onClick = onScoreClick,
)
}
@ -221,14 +221,14 @@ private fun TrackInfoItem(
TrackDetailsItem(
modifier = Modifier.weight(1F),
text = startDate,
placeholder = stringResource(R.string.track_started_reading_date),
placeholder = stringResource(MR.strings.track_started_reading_date),
onClick = onStartDateClick,
)
VerticalDivider()
TrackDetailsItem(
modifier = Modifier.weight(1F),
text = endDate,
placeholder = stringResource(R.string.track_finished_reading_date),
placeholder = stringResource(MR.strings.track_finished_reading_date),
onClick = onEndDateClick,
)
}
@ -279,7 +279,7 @@ private fun TrackInfoItemEmpty(
.padding(start = 16.dp)
.weight(1f),
) {
Text(text = stringResource(R.string.add_tracking))
Text(text = stringResource(MR.strings.add_tracking))
}
}
}
@ -294,7 +294,7 @@ private fun TrackInfoItemMenu(
IconButton(onClick = { expanded = true }) {
Icon(
imageVector = Icons.Default.MoreVert,
contentDescription = stringResource(R.string.label_more),
contentDescription = stringResource(MR.strings.label_more),
)
}
DropdownMenu(
@ -302,14 +302,14 @@ private fun TrackInfoItemMenu(
onDismissRequest = { expanded = false },
) {
DropdownMenuItem(
text = { Text(stringResource(R.string.action_open_in_browser)) },
text = { Text(stringResource(MR.strings.action_open_in_browser)) },
onClick = {
onOpenInBrowser()
expanded = false
},
)
DropdownMenuItem(
text = { Text(stringResource(R.string.action_remove)) },
text = { Text(stringResource(MR.strings.action_remove)) },
onClick = {
onRemoved()
expanded = false

View File

@ -29,18 +29,19 @@ 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.res.stringResource
import androidx.compose.ui.tooling.preview.PreviewLightDark
import androidx.compose.ui.unit.dp
import dev.icerock.moko.resources.StringResource
import eu.kanade.presentation.theme.TachiyomiTheme
import eu.kanade.tachiyomi.R
import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.toImmutableList
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.components.ScrollbarLazyColumn
import tachiyomi.presentation.core.components.WheelNumberPicker
import tachiyomi.presentation.core.components.WheelTextPicker
import tachiyomi.presentation.core.components.material.AlertDialogContent
import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.isScrolledToEnd
import tachiyomi.presentation.core.util.isScrolledToStart
@ -48,12 +49,12 @@ import tachiyomi.presentation.core.util.isScrolledToStart
fun TrackStatusSelector(
selection: Int,
onSelectionChange: (Int) -> Unit,
selections: Map<Int, Int?>,
selections: Map<Int, StringResource?>,
onConfirm: () -> Unit,
onDismissRequest: () -> Unit,
) {
BaseSelector(
title = stringResource(R.string.status),
title = stringResource(MR.strings.status),
content = {
val state = rememberLazyListState()
ScrollbarLazyColumn(state = state) {
@ -101,7 +102,7 @@ fun TrackChapterSelector(
onDismissRequest: () -> Unit,
) {
BaseSelector(
title = stringResource(R.string.chapters),
title = stringResource(MR.strings.chapters),
content = {
WheelNumberPicker(
items = range.toImmutableList(),
@ -124,7 +125,7 @@ fun TrackScoreSelector(
onDismissRequest: () -> Unit,
) {
BaseSelector(
title = stringResource(R.string.score),
title = stringResource(MR.strings.score),
content = {
WheelTextPicker(
items = selections,
@ -171,15 +172,15 @@ fun TrackDateSelector(
) {
if (onRemove != null) {
TextButton(onClick = onRemove) {
Text(text = stringResource(R.string.action_remove))
Text(text = stringResource(MR.strings.action_remove))
}
Spacer(modifier = Modifier.weight(1f))
}
TextButton(onClick = onDismissRequest) {
Text(text = stringResource(R.string.action_cancel))
Text(text = stringResource(MR.strings.action_cancel))
}
TextButton(onClick = { onConfirm(pickerState.selectedDateMillis!!) }) {
Text(text = stringResource(R.string.action_ok))
Text(text = stringResource(MR.strings.action_ok))
}
}
}
@ -214,10 +215,10 @@ private fun BaseSelector(
Spacer(modifier = Modifier.weight(1f))
}
TextButton(onClick = onDismissRequest) {
Text(text = stringResource(R.string.action_cancel))
Text(text = stringResource(MR.strings.action_cancel))
}
TextButton(onClick = onConfirm) {
Text(text = stringResource(R.string.action_ok))
Text(text = stringResource(MR.strings.action_ok))
}
}
},
@ -234,12 +235,12 @@ private fun TrackStatusSelectorPreviews() {
onSelectionChange = {},
selections = mapOf(
// Anilist values
1 to R.string.reading,
2 to R.string.plan_to_read,
3 to R.string.completed,
4 to R.string.on_hold,
5 to R.string.dropped,
6 to R.string.repeating,
1 to MR.strings.reading,
2 to MR.strings.plan_to_read,
3 to MR.strings.completed,
4 to MR.strings.on_hold,
5 to MR.strings.dropped,
6 to MR.strings.repeating,
),
onConfirm = {},
onDismissRequest = {},

View File

@ -29,7 +29,6 @@ import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.outlined.ArrowBack
import androidx.compose.material.icons.filled.ArrowBack
import androidx.compose.material.icons.filled.CheckCircle
import androidx.compose.material.icons.filled.Close
import androidx.compose.material3.Button
@ -50,7 +49,6 @@ import androidx.compose.ui.focus.focusRequester
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.platform.LocalFocusManager
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.capitalize
import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.text.input.TextFieldValue
@ -62,11 +60,12 @@ import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.unit.dp
import eu.kanade.presentation.manga.components.MangaCover
import eu.kanade.presentation.theme.TachiyomiTheme
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.track.model.TrackSearch
import tachiyomi.i18n.MR
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
import tachiyomi.presentation.core.screens.LoadingScreen
import tachiyomi.presentation.core.util.plus
@ -121,7 +120,7 @@ fun TrackerSearch(
decorationBox = {
if (query.text.isEmpty()) {
Text(
text = stringResource(R.string.action_search_hint),
text = stringResource(MR.strings.action_search_hint),
color = MaterialTheme.colorScheme.onSurfaceVariant,
style = MaterialTheme.typography.bodyLarge,
)
@ -164,7 +163,7 @@ fun TrackerSearch(
.fillMaxWidth(),
elevation = ButtonDefaults.elevatedButtonElevation(),
) {
Text(text = stringResource(R.string.action_track))
Text(text = stringResource(MR.strings.action_track))
}
}
},
@ -177,7 +176,7 @@ fun TrackerSearch(
if (availableTracks.isEmpty()) {
EmptyScreen(
modifier = Modifier.padding(innerPadding),
textResource = R.string.no_results_found,
stringRes = MR.strings.no_results_found,
)
} else {
ScrollbarLazyColumn(
@ -205,7 +204,7 @@ fun TrackerSearch(
EmptyScreen(
modifier = Modifier.padding(innerPadding),
message = queryResult.exceptionOrNull()?.message
?: stringResource(R.string.unknown_error),
?: stringResource(MR.strings.unknown_error),
)
}
}
@ -264,19 +263,19 @@ private fun SearchResultItem(
)
if (type.isNotBlank()) {
SearchResultItemDetails(
title = stringResource(R.string.track_type),
title = stringResource(MR.strings.track_type),
text = type,
)
}
if (startDate.isNotBlank()) {
SearchResultItemDetails(
title = stringResource(R.string.label_started),
title = stringResource(MR.strings.label_started),
text = startDate,
)
}
if (status.isNotBlank()) {
SearchResultItemDetails(
title = stringResource(R.string.track_status),
title = stringResource(MR.strings.track_status),
text = status,
)
}

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