Use system APIs to localize percentage numbers
(cherry picked from commit 8775596a822e8de217a07ed82d1ac49e552607d1)
This commit is contained in:
parent
0877853ea9
commit
d2bd0055e0
@ -20,6 +20,7 @@ import eu.kanade.tachiyomi.ui.reader.viewer.pager.PagerConfig
|
||||
import eu.kanade.tachiyomi.util.system.isReleaseBuildType
|
||||
import uy.kohesive.injekt.Injekt
|
||||
import uy.kohesive.injekt.api.get
|
||||
import java.text.NumberFormat
|
||||
|
||||
object SettingsReaderScreen : SearchableSettings {
|
||||
|
||||
@ -287,6 +288,8 @@ object SettingsReaderScreen : SearchableSettings {
|
||||
|
||||
@Composable
|
||||
private fun getWebtoonGroup(readerPreferences: ReaderPreferences): Preference.PreferenceGroup {
|
||||
val numberFormat = remember { NumberFormat.getPercentInstance() }
|
||||
|
||||
val navModePref = readerPreferences.navigationModeWebtoon()
|
||||
val dualPageSplitPref = readerPreferences.dualPageSplitWebtoon()
|
||||
val webtoonSidePaddingPref = readerPreferences.webtoonSidePadding()
|
||||
@ -319,7 +322,7 @@ object SettingsReaderScreen : SearchableSettings {
|
||||
Preference.PreferenceItem.SliderPreference(
|
||||
value = webtoonSidePadding,
|
||||
title = stringResource(R.string.pref_webtoon_side_padding),
|
||||
subtitle = stringResource(R.string.percentage, webtoonSidePadding),
|
||||
subtitle = numberFormat.format(webtoonSidePadding / 100f),
|
||||
min = ReaderPreferences.WEBTOON_PADDING_MIN,
|
||||
max = ReaderPreferences.WEBTOON_PADDING_MAX,
|
||||
onValueChanged = {
|
||||
|
@ -3,6 +3,7 @@ package eu.kanade.presentation.reader.settings
|
||||
import androidx.compose.foundation.layout.ColumnScope
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import eu.kanade.presentation.util.collectAsState
|
||||
import eu.kanade.tachiyomi.R
|
||||
@ -12,6 +13,7 @@ import eu.kanade.tachiyomi.util.system.isReleaseBuildType
|
||||
import tachiyomi.presentation.core.components.CheckboxItem
|
||||
import tachiyomi.presentation.core.components.HeadingItem
|
||||
import tachiyomi.presentation.core.components.SliderItem
|
||||
import java.text.NumberFormat
|
||||
|
||||
@Composable
|
||||
internal fun ColumnScope.ReadingModePage(screenModel: ReaderSettingsScreenModel) {
|
||||
@ -130,6 +132,8 @@ private fun ColumnScope.PagerViewerSettings(screenModel: ReaderSettingsScreenMod
|
||||
|
||||
@Composable
|
||||
private fun ColumnScope.WebtoonViewerSettings(screenModel: ReaderSettingsScreenModel) {
|
||||
val numberFormat = remember { NumberFormat.getPercentInstance() }
|
||||
|
||||
HeadingItem(R.string.webtoon_viewer)
|
||||
|
||||
// TODO: Tap zones
|
||||
@ -141,7 +145,7 @@ private fun ColumnScope.WebtoonViewerSettings(screenModel: ReaderSettingsScreenM
|
||||
min = ReaderPreferences.WEBTOON_PADDING_MIN,
|
||||
max = ReaderPreferences.WEBTOON_PADDING_MAX,
|
||||
value = webtoonSidePadding,
|
||||
valueText = stringResource(R.string.percentage, webtoonSidePadding),
|
||||
valueText = numberFormat.format(webtoonSidePadding / 100f),
|
||||
onChange = {
|
||||
screenModel.preferences.webtoonSidePadding().set(it)
|
||||
},
|
||||
|
@ -434,8 +434,6 @@
|
||||
<string name="pref_category_reading_mode">Reading mode</string>
|
||||
<string name="pref_category_reading">Reading</string>
|
||||
<string name="pref_webtoon_side_padding">Side padding</string>
|
||||
<!-- A percentage amount like "12%". "%1$d" is the number and "\%%" is the "%" sign. -->
|
||||
<string name="percentage">%1$d\%%</string>
|
||||
<string name="pref_hide_threshold">Sensitivity for hiding menu on scroll</string>
|
||||
<string name="pref_highest">Highest</string>
|
||||
<string name="pref_high">High</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user