mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-22 02:01:48 +01:00
Use system APIs to localize percentage numbers
This commit is contained in:
parent
2f0133986a
commit
8775596a82
@ -18,6 +18,7 @@ import eu.kanade.tachiyomi.ui.reader.setting.ReadingModeType
|
|||||||
import eu.kanade.tachiyomi.util.system.isReleaseBuildType
|
import eu.kanade.tachiyomi.util.system.isReleaseBuildType
|
||||||
import uy.kohesive.injekt.Injekt
|
import uy.kohesive.injekt.Injekt
|
||||||
import uy.kohesive.injekt.api.get
|
import uy.kohesive.injekt.api.get
|
||||||
|
import java.text.NumberFormat
|
||||||
|
|
||||||
object SettingsReaderScreen : SearchableSettings {
|
object SettingsReaderScreen : SearchableSettings {
|
||||||
|
|
||||||
@ -248,6 +249,8 @@ object SettingsReaderScreen : SearchableSettings {
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun getWebtoonGroup(readerPreferences: ReaderPreferences): Preference.PreferenceGroup {
|
private fun getWebtoonGroup(readerPreferences: ReaderPreferences): Preference.PreferenceGroup {
|
||||||
|
val numberFormat = remember { NumberFormat.getPercentInstance() }
|
||||||
|
|
||||||
val navModePref = readerPreferences.navigationModeWebtoon()
|
val navModePref = readerPreferences.navigationModeWebtoon()
|
||||||
val dualPageSplitPref = readerPreferences.dualPageSplitWebtoon()
|
val dualPageSplitPref = readerPreferences.dualPageSplitWebtoon()
|
||||||
val webtoonSidePaddingPref = readerPreferences.webtoonSidePadding()
|
val webtoonSidePaddingPref = readerPreferences.webtoonSidePadding()
|
||||||
@ -280,7 +283,7 @@ object SettingsReaderScreen : SearchableSettings {
|
|||||||
Preference.PreferenceItem.SliderPreference(
|
Preference.PreferenceItem.SliderPreference(
|
||||||
value = webtoonSidePadding,
|
value = webtoonSidePadding,
|
||||||
title = stringResource(R.string.pref_webtoon_side_padding),
|
title = stringResource(R.string.pref_webtoon_side_padding),
|
||||||
subtitle = stringResource(R.string.percentage, webtoonSidePadding),
|
subtitle = numberFormat.format(webtoonSidePadding / 100f),
|
||||||
min = ReaderPreferences.WEBTOON_PADDING_MIN,
|
min = ReaderPreferences.WEBTOON_PADDING_MIN,
|
||||||
max = ReaderPreferences.WEBTOON_PADDING_MAX,
|
max = ReaderPreferences.WEBTOON_PADDING_MAX,
|
||||||
onValueChanged = {
|
onValueChanged = {
|
||||||
|
@ -3,6 +3,7 @@ package eu.kanade.presentation.reader.settings
|
|||||||
import androidx.compose.foundation.layout.ColumnScope
|
import androidx.compose.foundation.layout.ColumnScope
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import eu.kanade.presentation.util.collectAsState
|
import eu.kanade.presentation.util.collectAsState
|
||||||
import eu.kanade.tachiyomi.R
|
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.CheckboxItem
|
||||||
import tachiyomi.presentation.core.components.HeadingItem
|
import tachiyomi.presentation.core.components.HeadingItem
|
||||||
import tachiyomi.presentation.core.components.SliderItem
|
import tachiyomi.presentation.core.components.SliderItem
|
||||||
|
import java.text.NumberFormat
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
internal fun ColumnScope.ReadingModePage(screenModel: ReaderSettingsScreenModel) {
|
internal fun ColumnScope.ReadingModePage(screenModel: ReaderSettingsScreenModel) {
|
||||||
@ -105,6 +107,8 @@ private fun ColumnScope.PagerViewerSettings(screenModel: ReaderSettingsScreenMod
|
|||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun ColumnScope.WebtoonViewerSettings(screenModel: ReaderSettingsScreenModel) {
|
private fun ColumnScope.WebtoonViewerSettings(screenModel: ReaderSettingsScreenModel) {
|
||||||
|
val numberFormat = remember { NumberFormat.getPercentInstance() }
|
||||||
|
|
||||||
HeadingItem(R.string.webtoon_viewer)
|
HeadingItem(R.string.webtoon_viewer)
|
||||||
|
|
||||||
// TODO: Tap zones
|
// TODO: Tap zones
|
||||||
@ -116,7 +120,7 @@ private fun ColumnScope.WebtoonViewerSettings(screenModel: ReaderSettingsScreenM
|
|||||||
min = ReaderPreferences.WEBTOON_PADDING_MIN,
|
min = ReaderPreferences.WEBTOON_PADDING_MIN,
|
||||||
max = ReaderPreferences.WEBTOON_PADDING_MAX,
|
max = ReaderPreferences.WEBTOON_PADDING_MAX,
|
||||||
value = webtoonSidePadding,
|
value = webtoonSidePadding,
|
||||||
valueText = stringResource(R.string.percentage, webtoonSidePadding),
|
valueText = numberFormat.format(webtoonSidePadding / 100f),
|
||||||
onChange = {
|
onChange = {
|
||||||
screenModel.preferences.webtoonSidePadding().set(it)
|
screenModel.preferences.webtoonSidePadding().set(it)
|
||||||
},
|
},
|
||||||
|
@ -434,8 +434,6 @@
|
|||||||
<string name="pref_category_reading_mode">Reading mode</string>
|
<string name="pref_category_reading_mode">Reading mode</string>
|
||||||
<string name="pref_category_reading">Reading</string>
|
<string name="pref_category_reading">Reading</string>
|
||||||
<string name="pref_webtoon_side_padding">Side padding</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_hide_threshold">Sensitivity for hiding menu on scroll</string>
|
||||||
<string name="pref_highest">Highest</string>
|
<string name="pref_highest">Highest</string>
|
||||||
<string name="pref_high">High</string>
|
<string name="pref_high">High</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user