Finish migration to moko resources

This commit is contained in:
Jobobby04
2023-12-23 22:40:54 -05:00
parent 82098460ff
commit 16d433973c
175 changed files with 2061 additions and 1946 deletions
@@ -19,6 +19,7 @@ import eu.kanade.tachiyomi.ui.reader.setting.ReaderSettingsScreenModel
import eu.kanade.tachiyomi.util.lang.toRelativeString
import exh.metadata.MetadataUtil
import exh.source.isEhBasedManga
import kotlinx.collections.immutable.ImmutableList
import tachiyomi.domain.chapter.model.Chapter
import tachiyomi.domain.library.service.LibraryPreferences
import java.util.Date
@@ -27,7 +28,7 @@ import java.util.Date
fun ChapterListDialog(
onDismissRequest: () -> Unit,
screenModel: ReaderSettingsScreenModel,
chapters: List<ReaderChapterItem>,
chapters: ImmutableList<ReaderChapterItem>,
onClickChapter: (Chapter) -> Unit,
onBookmark: (Chapter) -> Unit,
dateRelativeTime: Boolean,
@@ -18,12 +18,13 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import eu.kanade.presentation.components.AdaptiveSheet
import eu.kanade.tachiyomi.R
import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.components.ActionButton
import tachiyomi.presentation.core.components.material.padding
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun ReaderPageActionsDialog(
@@ -54,9 +55,9 @@ fun ReaderPageActionsDialog(
title = stringResource(
// SY -->
if (hasExtraPage) {
R.string.action_set_first_page_cover
SYMR.strings.action_set_first_page_cover
} else {
R.string.set_as_cover
MR.strings.set_as_cover
},
// SY <--
),
@@ -68,9 +69,9 @@ fun ReaderPageActionsDialog(
title = stringResource(
// SY -->
if (hasExtraPage) {
R.string.action_share_first_page
SYMR.strings.action_share_first_page
} else {
R.string.action_share
MR.strings.action_share
},
// SY <--
),
@@ -88,9 +89,9 @@ fun ReaderPageActionsDialog(
title = stringResource(
// SY -->
if (hasExtraPage) {
R.string.action_save_first_page
SYMR.strings.action_save_first_page
} else {
R.string.action_save
MR.strings.action_save
},
// SY <--
),
@@ -109,7 +110,7 @@ fun ReaderPageActionsDialog(
) {
ActionButton(
modifier = Modifier.weight(1f),
title = stringResource(R.string.action_set_second_page_cover),
title = stringResource(SYMR.strings.action_set_second_page_cover),
icon = Icons.Outlined.Photo,
onClick = {
showSetCoverDialog = true
@@ -117,7 +118,7 @@ fun ReaderPageActionsDialog(
)
ActionButton(
modifier = Modifier.weight(1f),
title = stringResource(R.string.action_share_second_page),
title = stringResource(SYMR.strings.action_share_second_page),
icon = Icons.Outlined.Share,
onClick = {
onShare(true)
@@ -126,7 +127,7 @@ fun ReaderPageActionsDialog(
)
ActionButton(
modifier = Modifier.weight(1f),
title = stringResource(R.string.action_save_second_page),
title = stringResource(SYMR.strings.action_save_second_page),
icon = Icons.Outlined.Save,
onClick = {
onSave(true)
@@ -139,7 +140,7 @@ fun ReaderPageActionsDialog(
) {
ActionButton(
modifier = Modifier.weight(1f),
title = stringResource(R.string.action_share_combined_page),
title = stringResource(SYMR.strings.action_share_combined_page),
icon = Icons.Outlined.Share,
onClick = {
onShareCombined()
@@ -148,7 +149,7 @@ fun ReaderPageActionsDialog(
)
ActionButton(
modifier = Modifier.weight(1f),
title = stringResource(R.string.action_save_combined_page),
title = stringResource(SYMR.strings.action_save_combined_page),
icon = Icons.Outlined.Save,
onClick = {
onSaveCombined()
@@ -181,16 +182,16 @@ private fun SetCoverDialog(
) {
AlertDialog(
text = {
Text(stringResource(R.string.confirm_set_image_as_cover))
Text(stringResource(MR.strings.confirm_set_image_as_cover))
},
confirmButton = {
TextButton(onClick = onConfirm) {
Text(stringResource(R.string.action_ok))
Text(stringResource(MR.strings.action_ok))
}
},
dismissButton = {
TextButton(onClick = onDismiss) {
Text(stringResource(R.string.action_cancel))
Text(stringResource(MR.strings.action_cancel))
}
},
onDismissRequest = onDismiss,
@@ -22,13 +22,15 @@ import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.ui.reader.setting.ReaderBottomButton
import eu.kanade.tachiyomi.ui.reader.setting.ReaderOrientation
import eu.kanade.tachiyomi.ui.reader.setting.ReadingMode
import kotlinx.collections.immutable.ImmutableSet
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.localize
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun BottomReaderBar(
// SY -->
enabledButtons: Set<String>,
enabledButtons: ImmutableSet<String>,
// SY <--
backgroundColor: Color,
readingMode: ReadingMode,
@@ -61,7 +63,7 @@ fun BottomReaderBar(
IconButton(onClick = onClickChapterList) {
Icon(
imageVector = Icons.Outlined.FormatListNumbered,
contentDescription = localize(MR.strings.chapters),
contentDescription = stringResource(MR.strings.chapters),
)
}
}
@@ -70,7 +72,7 @@ fun BottomReaderBar(
IconButton(onClick = onClickWebView) {
Icon(
imageVector = Icons.Outlined.Public,
contentDescription = localize(MR.strings.action_open_in_web_view),
contentDescription = stringResource(MR.strings.action_open_in_web_view),
)
}
}
@@ -79,7 +81,7 @@ fun BottomReaderBar(
IconButton(onClick = onClickShare) {
Icon(
imageVector = Icons.Outlined.Share,
contentDescription = localize(MR.strings.action_share),
contentDescription = stringResource(MR.strings.action_share),
)
}
}
@@ -88,7 +90,7 @@ fun BottomReaderBar(
IconButton(onClick = onClickReadingMode) {
Icon(
painter = painterResource(readingMode.iconRes),
contentDescription = localize(MR.strings.viewer),
contentDescription = stringResource(MR.strings.viewer),
)
}
}
@@ -97,7 +99,7 @@ fun BottomReaderBar(
IconButton(onClick = onClickOrientation) {
Icon(
painter = painterResource(orientation.iconRes),
contentDescription = localize(MR.strings.pref_rotation_type),
contentDescription = stringResource(MR.strings.pref_rotation_type),
)
}
}
@@ -111,7 +113,7 @@ fun BottomReaderBar(
IconButton(onClick = onClickCropBorder) {
Icon(
painter = painterResource(if (cropEnabled) R.drawable.ic_crop_24dp else R.drawable.ic_crop_off_24dp),
contentDescription = localize(MR.strings.pref_crop_borders),
contentDescription = stringResource(MR.strings.pref_crop_borders),
)
}
}
@@ -124,7 +126,7 @@ fun BottomReaderBar(
IconButton(onClick = onClickPageLayout) {
Icon(
painter = painterResource(R.drawable.ic_book_open_variant_24dp),
contentDescription = localize(MR.strings.page_layout),
contentDescription = stringResource(SYMR.strings.page_layout),
)
}
}
@@ -133,7 +135,7 @@ fun BottomReaderBar(
IconButton(onClick = onClickShiftPage) {
Icon(
painter = painterResource(R.drawable.ic_page_next_outline_24dp),
contentDescription = localize(MR.strings.shift_double_pages),
contentDescription = stringResource(SYMR.strings.shift_double_pages),
)
}
}
@@ -141,7 +143,7 @@ fun BottomReaderBar(
IconButton(onClick = onClickSettings) {
Icon(
imageVector = Icons.Outlined.Settings,
contentDescription = localize(MR.stringss.action_settings),
contentDescription = stringResource(MR.strings.action_settings),
)
}
// SY <--
@@ -32,18 +32,17 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.tooling.preview.PreviewLightDark
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import eu.kanade.tachiyomi.R
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.i18n.stringResource
@Composable
fun ExhUtils(
modifier: Modifier = Modifier,
isVisible: Boolean,
onSetExhUtilsVisibility: (Boolean) -> Unit,
backgroundColor: Color,
@@ -57,6 +56,7 @@ fun ExhUtils(
onClickRetryAllHelp: () -> Unit,
onClickBoostPage: () -> Unit,
onClickBoostPageHelp: () -> Unit,
modifier: Modifier = Modifier,
) {
Column(
modifier
@@ -80,7 +80,7 @@ fun ExhUtils(
verticalAlignment = Alignment.CenterVertically,
) {
Text(
text = stringResource(R.string.eh_autoscroll),
text = stringResource(SYMR.strings.eh_autoscroll),
color = MaterialTheme.colorScheme.onSurface,
fontSize = 13.sp,
fontFamily = FontFamily.SansSerif,
@@ -123,7 +123,7 @@ fun ExhUtils(
)
AnimatedVisibility(!isAutoScrollEnabled) {
Text(
text = stringResource(R.string.eh_autoscroll_freq_invalid),
text = stringResource(SYMR.strings.eh_autoscroll_freq_invalid),
color = MaterialTheme.colorScheme.error,
style = MaterialTheme.typography.labelSmall,
)
@@ -156,7 +156,7 @@ fun ExhUtils(
modifier = Modifier.weight(3f),
) {
Text(
text = stringResource(R.string.eh_retry_all),
text = stringResource(SYMR.strings.eh_retry_all),
color = MaterialTheme.colorScheme.onSurface,
fontSize = 13.sp,
fontFamily = FontFamily.SansSerif,
@@ -184,7 +184,7 @@ fun ExhUtils(
modifier = Modifier.weight(3f),
) {
Text(
text = stringResource(R.string.eh_boost_page),
text = stringResource(SYMR.strings.eh_boost_page),
color = MaterialTheme.colorScheme.onSurface,
fontSize = 13.sp,
fontFamily = FontFamily.SansSerif,
@@ -33,7 +33,7 @@ import eu.kanade.tachiyomi.ui.reader.setting.ReaderOrientation
import eu.kanade.tachiyomi.ui.reader.setting.ReadingMode
import eu.kanade.tachiyomi.ui.reader.viewer.Viewer
import eu.kanade.tachiyomi.ui.reader.viewer.pager.R2LPagerViewer
import kotlinx.collections.immutable.persistentListOf
import kotlinx.collections.immutable.ImmutableSet
private val animationSpec = tween<IntOffset>(200)
@@ -106,7 +106,7 @@ fun ReaderAppBars(
onClickBoostPageHelp: () -> Unit,
navBarType: NavBarType,
currentPageText: String,
enabledButtons: Set<String>,
enabledButtons: ImmutableSet<String>,
dualPageSplitEnabled: Boolean,
doublePages: Boolean,
onClickChapterList: () -> Unit,
@@ -215,20 +215,20 @@ fun ReaderAppBars(
listOfNotNull(
AppBar.Action(
title = stringResource(
if (bookmarked) R.string.action_remove_bookmark else R.string.action_bookmark
if (bookmarked) MR.strings.action_remove_bookmark else MR.strings.action_bookmark
),
icon = if (bookmarked) Icons.Outlined.Bookmark else Icons.Outlined.BookmarkBorder,
onClick = onToggleBookmarked,
),
onOpenInWebView?.let {
AppBar.OverflowAction(
title = stringResource(R.string.action_open_in_web_view),
title = stringResource(MR.strings.action_open_in_web_view),
onClick = it,
)
},
onShare?.let {
AppBar.OverflowAction(
title = stringResource(R.string.action_share),
title = stringResource(MR.strings.action_share),
onClick = it,
)
},
@@ -36,12 +36,12 @@ import androidx.compose.ui.hapticfeedback.HapticFeedbackType
import androidx.compose.ui.layout.layout
import androidx.compose.ui.platform.LocalHapticFeedback
import androidx.compose.ui.platform.LocalLayoutDirection
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.Constraints
import androidx.compose.ui.unit.LayoutDirection
import androidx.compose.ui.unit.dp
import eu.kanade.presentation.util.isTabletUi
import eu.kanade.tachiyomi.R
import tachiyomi.i18n.MR
import tachiyomi.presentation.core.i18n.stringResource
import kotlin.math.roundToInt
@Composable
@@ -104,7 +104,7 @@ fun ChapterNavigator(
Icon(
imageVector = Icons.Outlined.SkipPrevious,
contentDescription = stringResource(
if (isRtl) R.string.action_next_chapter else R.string.action_previous_chapter,
if (isRtl) MR.strings.action_next_chapter else MR.strings.action_previous_chapter,
),
)
}
@@ -158,7 +158,7 @@ fun ChapterNavigator(
Icon(
imageVector = Icons.Outlined.SkipNext,
contentDescription = stringResource(
if (isRtl) R.string.action_previous_chapter else R.string.action_next_chapter,
if (isRtl) MR.strings.action_previous_chapter else MR.strings.action_next_chapter,
),
)
}
@@ -206,7 +206,7 @@ fun ChapterNavigatorVert(
) {
Icon(
imageVector = Icons.Outlined.SkipPrevious,
contentDescription = stringResource(R.string.action_previous_chapter),
contentDescription = stringResource(MR.strings.action_previous_chapter),
modifier = Modifier.rotate(90f),
)
}
@@ -274,7 +274,7 @@ fun ChapterNavigatorVert(
) {
Icon(
imageVector = Icons.Outlined.SkipNext,
contentDescription = stringResource(R.string.action_next_chapter),
contentDescription = stringResource(MR.strings.action_next_chapter),
modifier = Modifier.rotate(90f),
)
}
@@ -5,24 +5,25 @@ import androidx.compose.material3.FilterChip
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.res.stringResource
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.ui.reader.setting.ReaderSettingsScreenModel
import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.components.CheckboxItem
import tachiyomi.presentation.core.components.SettingsChipRow
import tachiyomi.presentation.core.i18n.stringResource
import tachiyomi.presentation.core.util.collectAsState
private val themes = listOf(
R.string.black_background to 1,
R.string.gray_background to 2,
R.string.white_background to 0,
R.string.automatic_background to 3,
MR.strings.black_background to 1,
MR.strings.gray_background to 2,
MR.strings.white_background to 0,
MR.strings.automatic_background to 3,
)
@Composable
internal fun ColumnScope.GeneralPage(screenModel: ReaderSettingsScreenModel) {
val readerTheme by screenModel.preferences.readerTheme().collectAsState()
SettingsChipRow(R.string.pref_reader_theme) {
SettingsChipRow(MR.strings.pref_reader_theme) {
themes.map { (labelRes, value) ->
FilterChip(
selected = readerTheme == value,
@@ -33,71 +34,71 @@ internal fun ColumnScope.GeneralPage(screenModel: ReaderSettingsScreenModel) {
}
CheckboxItem(
label = stringResource(R.string.pref_show_page_number),
label = stringResource(MR.strings.pref_show_page_number),
pref = screenModel.preferences.showPageNumber(),
)
// SY -->
val forceHorizontalSeekbar by screenModel.preferences.forceHorizontalSeekbar().collectAsState()
CheckboxItem(
label = stringResource(R.string.pref_force_horz_seekbar),
label = stringResource(SYMR.strings.pref_force_horz_seekbar),
pref = screenModel.preferences.forceHorizontalSeekbar(),
)
if (!forceHorizontalSeekbar) {
CheckboxItem(
label = stringResource(R.string.pref_show_vert_seekbar_landscape),
label = stringResource(SYMR.strings.pref_show_vert_seekbar_landscape),
pref = screenModel.preferences.landscapeVerticalSeekbar(),
)
CheckboxItem(
label = stringResource(R.string.pref_left_handed_vertical_seekbar),
label = stringResource(SYMR.strings.pref_left_handed_vertical_seekbar),
pref = screenModel.preferences.leftVerticalSeekbar(),
)
}
// SY <--
CheckboxItem(
label = stringResource(R.string.pref_fullscreen),
label = stringResource(MR.strings.pref_fullscreen),
pref = screenModel.preferences.fullscreen(),
)
if (screenModel.hasDisplayCutout) {
CheckboxItem(
label = stringResource(R.string.pref_cutout_short),
label = stringResource(MR.strings.pref_cutout_short),
pref = screenModel.preferences.cutoutShort(),
)
}
CheckboxItem(
label = stringResource(R.string.pref_keep_screen_on),
label = stringResource(MR.strings.pref_keep_screen_on),
pref = screenModel.preferences.keepScreenOn(),
)
CheckboxItem(
label = stringResource(R.string.pref_read_with_long_tap),
label = stringResource(MR.strings.pref_read_with_long_tap),
pref = screenModel.preferences.readWithLongTap(),
)
CheckboxItem(
label = stringResource(R.string.pref_always_show_chapter_transition),
label = stringResource(MR.strings.pref_always_show_chapter_transition),
pref = screenModel.preferences.alwaysShowChapterTransition(),
)
// SY -->
/*CheckboxItem(
label = stringResource(R.string.pref_page_transitions),
label = stringResource(MR.strings.pref_page_transitions),
pref = screenModel.preferences.pageTransitions(),
) SY <-- */
CheckboxItem(
label = stringResource(R.string.pref_flash_page),
label = stringResource(MR.strings.pref_flash_page),
pref = screenModel.preferences.flashOnPageChange(),
)
// SY -->
CheckboxItem(
label = stringResource(R.string.auto_webtoon_mode),
label = stringResource(SYMR.strings.auto_webtoon_mode),
pref = screenModel.preferences.useAutoWebtoon(),
)
// SY <--
@@ -15,6 +15,7 @@ import eu.kanade.tachiyomi.ui.reader.setting.ReaderSettingsScreenModel
import eu.kanade.tachiyomi.ui.reader.setting.ReadingMode
import eu.kanade.tachiyomi.ui.reader.viewer.webtoon.WebtoonViewer
import tachiyomi.i18n.MR
import tachiyomi.i18n.sy.SYMR
import tachiyomi.presentation.core.components.CheckboxItem
import tachiyomi.presentation.core.components.HeadingItem
import tachiyomi.presentation.core.components.SettingsChipRow
@@ -98,7 +99,7 @@ private fun ColumnScope.PagerViewerSettings(screenModel: ReaderSettingsScreenMod
// SY -->
val pageLayout by screenModel.preferences.pageLayout().collectAsState()
SettingsChipRow(R.string.page_layout) {
SettingsChipRow(SYMR.strings.page_layout) {
ReaderPreferences.PageLayouts.mapIndexed { index, it ->
FilterChip(
selected = pageLayout == index,
@@ -152,17 +153,17 @@ private fun ColumnScope.PagerViewerSettings(screenModel: ReaderSettingsScreenMod
// SY -->
CheckboxItem(
label = stringResource(R.string.pref_page_transitions),
label = stringResource(MR.strings.pref_page_transitions),
pref = screenModel.preferences.pageTransitionsPager(),
)
CheckboxItem(
label = stringResource(R.string.invert_double_pages),
label = stringResource(SYMR.strings.invert_double_pages),
pref = screenModel.preferences.invertDoublePages(),
)
val centerMarginType by screenModel.preferences.centerMarginType().collectAsState()
SettingsChipRow(R.string.pref_center_margin) {
SettingsChipRow(SYMR.strings.pref_center_margin) {
ReaderPreferences.CenterMarginTypes.mapIndexed { index, it ->
FilterChip(
selected = centerMarginType == index,
@@ -208,17 +209,17 @@ private fun ColumnScope.WebtoonViewerSettings(screenModel: ReaderSettingsScreenM
// SY -->
CheckboxItem(
label = stringResource(R.string.pref_smooth_scroll),
label = stringResource(SYMR.strings.pref_smooth_scroll),
pref = screenModel.preferences.smoothAutoScroll(),
)
CheckboxItem(
label = stringResource(R.string.pref_page_transitions),
label = stringResource(MR.strings.pref_page_transitions),
pref = screenModel.preferences.pageTransitionsWebtoon(),
)
CheckboxItem(
label = stringResource(R.string.enable_zoom_out),
label = stringResource(SYMR.strings.enable_zoom_out),
pref = screenModel.preferences.webtoonEnableZoomOut(),
)
// SY <--
@@ -245,10 +246,10 @@ private fun ColumnScope.WebtoonViewerSettings(screenModel: ReaderSettingsScreenM
// SY -->
@Composable
private fun ColumnScope.WebtoonWithGapsViewerSettings(screenModel: ReaderSettingsScreenModel) {
HeadingItem(R.string.vertical_plus_viewer)
HeadingItem(MR.strings.vertical_plus_viewer)
CheckboxItem(
label = stringResource(R.string.pref_crop_borders),
label = stringResource(MR.strings.pref_crop_borders),
pref = screenModel.preferences.cropBordersContinuousVertical(),
)
}