🚀 Font thickness option
* Changes default font thickness Resolves: #150
This commit is contained in:
parent
bd6d64a3cd
commit
fe269fd8a0
15 changed files with 131 additions and 2 deletions
|
|
@ -0,0 +1,17 @@
|
||||||
|
package ua.acclorite.book_story.domain.reader
|
||||||
|
|
||||||
|
import androidx.compose.runtime.Immutable
|
||||||
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
|
|
||||||
|
@Immutable
|
||||||
|
enum class ReaderFontThickness(val thickness: FontWeight) {
|
||||||
|
THIN(FontWeight.Thin),
|
||||||
|
EXTRA_LIGHT(FontWeight.ExtraLight),
|
||||||
|
LIGHT(FontWeight.Light),
|
||||||
|
NORMAL(FontWeight.Normal),
|
||||||
|
MEDIUM(FontWeight.Medium)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun String.toFontThickness(): ReaderFontThickness {
|
||||||
|
return ReaderFontThickness.valueOf(this)
|
||||||
|
}
|
||||||
|
|
@ -24,6 +24,7 @@ object DataStoreConstants {
|
||||||
val SIDE_PADDING = intPreferencesKey("side_padding")
|
val SIDE_PADDING = intPreferencesKey("side_padding")
|
||||||
val VERTICAL_PADDING = intPreferencesKey("vertical_padding")
|
val VERTICAL_PADDING = intPreferencesKey("vertical_padding")
|
||||||
val FONT = stringPreferencesKey("font")
|
val FONT = stringPreferencesKey("font")
|
||||||
|
val FONT_THICKNESS = stringPreferencesKey("font_thickness")
|
||||||
val IS_ITALIC = booleanPreferencesKey("font_style")
|
val IS_ITALIC = booleanPreferencesKey("font_style")
|
||||||
val FONT_SIZE = intPreferencesKey("font_size")
|
val FONT_SIZE = intPreferencesKey("font_size")
|
||||||
val LINE_HEIGHT = intPreferencesKey("line_height")
|
val LINE_HEIGHT = intPreferencesKey("line_height")
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ import androidx.compose.ui.unit.TextUnit
|
||||||
import ua.acclorite.book_story.domain.library.book.Book
|
import ua.acclorite.book_story.domain.library.book.Book
|
||||||
import ua.acclorite.book_story.domain.reader.Checkpoint
|
import ua.acclorite.book_story.domain.reader.Checkpoint
|
||||||
import ua.acclorite.book_story.domain.reader.FontWithName
|
import ua.acclorite.book_story.domain.reader.FontWithName
|
||||||
|
import ua.acclorite.book_story.domain.reader.ReaderFontThickness
|
||||||
import ua.acclorite.book_story.domain.reader.ReaderHorizontalGesture
|
import ua.acclorite.book_story.domain.reader.ReaderHorizontalGesture
|
||||||
import ua.acclorite.book_story.domain.reader.ReaderText
|
import ua.acclorite.book_story.domain.reader.ReaderText
|
||||||
import ua.acclorite.book_story.domain.reader.ReaderText.Chapter
|
import ua.acclorite.book_story.domain.reader.ReaderText.Chapter
|
||||||
|
|
@ -69,6 +70,7 @@ fun ReaderContent(
|
||||||
imagesColorEffects: ColorFilter?,
|
imagesColorEffects: ColorFilter?,
|
||||||
fontFamily: FontWithName,
|
fontFamily: FontWithName,
|
||||||
lineHeight: TextUnit,
|
lineHeight: TextUnit,
|
||||||
|
fontThickness: ReaderFontThickness,
|
||||||
fontStyle: FontStyle,
|
fontStyle: FontStyle,
|
||||||
chapterTitleAlignment: ReaderTextAlignment,
|
chapterTitleAlignment: ReaderTextAlignment,
|
||||||
textAlignment: ReaderTextAlignment,
|
textAlignment: ReaderTextAlignment,
|
||||||
|
|
@ -144,6 +146,7 @@ fun ReaderContent(
|
||||||
imagesColorEffects = imagesColorEffects,
|
imagesColorEffects = imagesColorEffects,
|
||||||
fontFamily = fontFamily,
|
fontFamily = fontFamily,
|
||||||
lineHeight = lineHeight,
|
lineHeight = lineHeight,
|
||||||
|
fontThickness = fontThickness,
|
||||||
fontStyle = fontStyle,
|
fontStyle = fontStyle,
|
||||||
chapterTitleAlignment = chapterTitleAlignment,
|
chapterTitleAlignment = chapterTitleAlignment,
|
||||||
textAlignment = textAlignment,
|
textAlignment = textAlignment,
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ import androidx.compose.ui.unit.coerceAtLeast
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import ua.acclorite.book_story.R
|
import ua.acclorite.book_story.R
|
||||||
import ua.acclorite.book_story.domain.reader.FontWithName
|
import ua.acclorite.book_story.domain.reader.FontWithName
|
||||||
|
import ua.acclorite.book_story.domain.reader.ReaderFontThickness
|
||||||
import ua.acclorite.book_story.domain.reader.ReaderHorizontalGesture
|
import ua.acclorite.book_story.domain.reader.ReaderHorizontalGesture
|
||||||
import ua.acclorite.book_story.domain.reader.ReaderText
|
import ua.acclorite.book_story.domain.reader.ReaderText
|
||||||
import ua.acclorite.book_story.domain.reader.ReaderTextAlignment
|
import ua.acclorite.book_story.domain.reader.ReaderTextAlignment
|
||||||
|
|
@ -68,6 +69,7 @@ fun ReaderLayout(
|
||||||
imagesColorEffects: ColorFilter?,
|
imagesColorEffects: ColorFilter?,
|
||||||
fontFamily: FontWithName,
|
fontFamily: FontWithName,
|
||||||
lineHeight: TextUnit,
|
lineHeight: TextUnit,
|
||||||
|
fontThickness: ReaderFontThickness,
|
||||||
fontStyle: FontStyle,
|
fontStyle: FontStyle,
|
||||||
chapterTitleAlignment: ReaderTextAlignment,
|
chapterTitleAlignment: ReaderTextAlignment,
|
||||||
textAlignment: ReaderTextAlignment,
|
textAlignment: ReaderTextAlignment,
|
||||||
|
|
@ -193,6 +195,7 @@ fun ReaderLayout(
|
||||||
fontFamily = fontFamily,
|
fontFamily = fontFamily,
|
||||||
fontColor = fontColor,
|
fontColor = fontColor,
|
||||||
lineHeight = lineHeight,
|
lineHeight = lineHeight,
|
||||||
|
fontThickness = fontThickness,
|
||||||
fontStyle = fontStyle,
|
fontStyle = fontStyle,
|
||||||
chapterTitleAlignment = chapterTitleAlignment,
|
chapterTitleAlignment = chapterTitleAlignment,
|
||||||
textAlignment = textAlignment,
|
textAlignment = textAlignment,
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.unit.Dp
|
import androidx.compose.ui.unit.Dp
|
||||||
import androidx.compose.ui.unit.TextUnit
|
import androidx.compose.ui.unit.TextUnit
|
||||||
import ua.acclorite.book_story.domain.reader.FontWithName
|
import ua.acclorite.book_story.domain.reader.FontWithName
|
||||||
|
import ua.acclorite.book_story.domain.reader.ReaderFontThickness
|
||||||
import ua.acclorite.book_story.domain.reader.ReaderText
|
import ua.acclorite.book_story.domain.reader.ReaderText
|
||||||
import ua.acclorite.book_story.domain.reader.ReaderTextAlignment
|
import ua.acclorite.book_story.domain.reader.ReaderTextAlignment
|
||||||
import ua.acclorite.book_story.domain.util.HorizontalAlignment
|
import ua.acclorite.book_story.domain.util.HorizontalAlignment
|
||||||
|
|
@ -28,6 +29,7 @@ fun LazyItemScope.ReaderLayoutText(
|
||||||
fontFamily: FontWithName,
|
fontFamily: FontWithName,
|
||||||
fontColor: Color,
|
fontColor: Color,
|
||||||
lineHeight: TextUnit,
|
lineHeight: TextUnit,
|
||||||
|
fontThickness: ReaderFontThickness,
|
||||||
fontStyle: FontStyle,
|
fontStyle: FontStyle,
|
||||||
chapterTitleAlignment: ReaderTextAlignment,
|
chapterTitleAlignment: ReaderTextAlignment,
|
||||||
textAlignment: ReaderTextAlignment,
|
textAlignment: ReaderTextAlignment,
|
||||||
|
|
@ -82,6 +84,7 @@ fun LazyItemScope.ReaderLayoutText(
|
||||||
fontFamily = fontFamily,
|
fontFamily = fontFamily,
|
||||||
fontColor = fontColor,
|
fontColor = fontColor,
|
||||||
lineHeight = lineHeight,
|
lineHeight = lineHeight,
|
||||||
|
fontThickness = fontThickness,
|
||||||
fontStyle = fontStyle,
|
fontStyle = fontStyle,
|
||||||
textAlignment = textAlignment,
|
textAlignment = textAlignment,
|
||||||
horizontalAlignment = horizontalAlignment,
|
horizontalAlignment = horizontalAlignment,
|
||||||
|
|
|
||||||
|
|
@ -13,13 +13,13 @@ import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.text.TextStyle
|
import androidx.compose.ui.text.TextStyle
|
||||||
import androidx.compose.ui.text.font.FontStyle
|
import androidx.compose.ui.text.font.FontStyle
|
||||||
import androidx.compose.ui.text.font.FontSynthesis
|
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.text.style.LineBreak
|
import androidx.compose.ui.text.style.LineBreak
|
||||||
import androidx.compose.ui.text.style.TextIndent
|
import androidx.compose.ui.text.style.TextIndent
|
||||||
import androidx.compose.ui.unit.Dp
|
import androidx.compose.ui.unit.Dp
|
||||||
import androidx.compose.ui.unit.TextUnit
|
import androidx.compose.ui.unit.TextUnit
|
||||||
import ua.acclorite.book_story.domain.reader.FontWithName
|
import ua.acclorite.book_story.domain.reader.FontWithName
|
||||||
|
import ua.acclorite.book_story.domain.reader.ReaderFontThickness
|
||||||
import ua.acclorite.book_story.domain.reader.ReaderText.Text
|
import ua.acclorite.book_story.domain.reader.ReaderText.Text
|
||||||
import ua.acclorite.book_story.domain.reader.ReaderTextAlignment
|
import ua.acclorite.book_story.domain.reader.ReaderTextAlignment
|
||||||
import ua.acclorite.book_story.presentation.core.components.common.HighlightedText
|
import ua.acclorite.book_story.presentation.core.components.common.HighlightedText
|
||||||
|
|
@ -34,6 +34,7 @@ fun LazyItemScope.ReaderLayoutTextParagraph(
|
||||||
fontFamily: FontWithName,
|
fontFamily: FontWithName,
|
||||||
fontColor: Color,
|
fontColor: Color,
|
||||||
lineHeight: TextUnit,
|
lineHeight: TextUnit,
|
||||||
|
fontThickness: ReaderFontThickness,
|
||||||
fontStyle: FontStyle,
|
fontStyle: FontStyle,
|
||||||
textAlignment: ReaderTextAlignment,
|
textAlignment: ReaderTextAlignment,
|
||||||
horizontalAlignment: Alignment.Horizontal,
|
horizontalAlignment: Alignment.Horizontal,
|
||||||
|
|
@ -88,7 +89,7 @@ fun LazyItemScope.ReaderLayoutTextParagraph(
|
||||||
),
|
),
|
||||||
style = TextStyle(
|
style = TextStyle(
|
||||||
fontFamily = fontFamily.font,
|
fontFamily = fontFamily.font,
|
||||||
fontSynthesis = FontSynthesis.All,
|
fontWeight = fontThickness.thickness,
|
||||||
textAlign = textAlignment.textAlignment,
|
textAlign = textAlignment.textAlignment,
|
||||||
textIndent = TextIndent(firstLine = paragraphIndentation),
|
textIndent = TextIndent(firstLine = paragraphIndentation),
|
||||||
fontStyle = fontStyle,
|
fontStyle = fontStyle,
|
||||||
|
|
@ -129,6 +130,7 @@ fun LazyItemScope.ReaderLayoutTextParagraph(
|
||||||
),
|
),
|
||||||
style = TextStyle(
|
style = TextStyle(
|
||||||
fontFamily = fontFamily.font,
|
fontFamily = fontFamily.font,
|
||||||
|
fontWeight = fontThickness.thickness,
|
||||||
textAlign = textAlignment.textAlignment,
|
textAlign = textAlignment.textAlignment,
|
||||||
textIndent = TextIndent(firstLine = paragraphIndentation),
|
textIndent = TextIndent(firstLine = paragraphIndentation),
|
||||||
fontStyle = fontStyle,
|
fontStyle = fontStyle,
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ import androidx.compose.ui.unit.TextUnit
|
||||||
import ua.acclorite.book_story.domain.library.book.Book
|
import ua.acclorite.book_story.domain.library.book.Book
|
||||||
import ua.acclorite.book_story.domain.reader.Checkpoint
|
import ua.acclorite.book_story.domain.reader.Checkpoint
|
||||||
import ua.acclorite.book_story.domain.reader.FontWithName
|
import ua.acclorite.book_story.domain.reader.FontWithName
|
||||||
|
import ua.acclorite.book_story.domain.reader.ReaderFontThickness
|
||||||
import ua.acclorite.book_story.domain.reader.ReaderHorizontalGesture
|
import ua.acclorite.book_story.domain.reader.ReaderHorizontalGesture
|
||||||
import ua.acclorite.book_story.domain.reader.ReaderText
|
import ua.acclorite.book_story.domain.reader.ReaderText
|
||||||
import ua.acclorite.book_story.domain.reader.ReaderText.Chapter
|
import ua.acclorite.book_story.domain.reader.ReaderText.Chapter
|
||||||
|
|
@ -73,6 +74,7 @@ fun ReaderScaffold(
|
||||||
imagesColorEffects: ColorFilter?,
|
imagesColorEffects: ColorFilter?,
|
||||||
fontFamily: FontWithName,
|
fontFamily: FontWithName,
|
||||||
lineHeight: TextUnit,
|
lineHeight: TextUnit,
|
||||||
|
fontThickness: ReaderFontThickness,
|
||||||
fontStyle: FontStyle,
|
fontStyle: FontStyle,
|
||||||
chapterTitleAlignment: ReaderTextAlignment,
|
chapterTitleAlignment: ReaderTextAlignment,
|
||||||
textAlignment: ReaderTextAlignment,
|
textAlignment: ReaderTextAlignment,
|
||||||
|
|
@ -174,6 +176,7 @@ fun ReaderScaffold(
|
||||||
imagesColorEffects = imagesColorEffects,
|
imagesColorEffects = imagesColorEffects,
|
||||||
fontFamily = fontFamily,
|
fontFamily = fontFamily,
|
||||||
lineHeight = lineHeight,
|
lineHeight = lineHeight,
|
||||||
|
fontThickness = fontThickness,
|
||||||
fontStyle = fontStyle,
|
fontStyle = fontStyle,
|
||||||
chapterTitleAlignment = chapterTitleAlignment,
|
chapterTitleAlignment = chapterTitleAlignment,
|
||||||
textAlignment = textAlignment,
|
textAlignment = textAlignment,
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ import ua.acclorite.book_story.presentation.settings.components.SettingsSubcateg
|
||||||
import ua.acclorite.book_story.presentation.settings.reader.font.components.FontFamilyOption
|
import ua.acclorite.book_story.presentation.settings.reader.font.components.FontFamilyOption
|
||||||
import ua.acclorite.book_story.presentation.settings.reader.font.components.FontSizeOption
|
import ua.acclorite.book_story.presentation.settings.reader.font.components.FontSizeOption
|
||||||
import ua.acclorite.book_story.presentation.settings.reader.font.components.FontStyleOption
|
import ua.acclorite.book_story.presentation.settings.reader.font.components.FontStyleOption
|
||||||
|
import ua.acclorite.book_story.presentation.settings.reader.font.components.FontThicknessOption
|
||||||
import ua.acclorite.book_story.presentation.settings.reader.font.components.LetterSpacingOption
|
import ua.acclorite.book_story.presentation.settings.reader.font.components.LetterSpacingOption
|
||||||
|
|
||||||
fun LazyListScope.FontSubcategory(
|
fun LazyListScope.FontSubcategory(
|
||||||
|
|
@ -30,6 +31,10 @@ fun LazyListScope.FontSubcategory(
|
||||||
FontFamilyOption()
|
FontFamilyOption()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
item {
|
||||||
|
FontThicknessOption()
|
||||||
|
}
|
||||||
|
|
||||||
item {
|
item {
|
||||||
FontStyleOption()
|
FontStyleOption()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,58 @@
|
||||||
|
package ua.acclorite.book_story.presentation.settings.reader.font.components
|
||||||
|
|
||||||
|
import androidx.compose.material3.MaterialTheme
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.remember
|
||||||
|
import androidx.compose.ui.res.stringResource
|
||||||
|
import androidx.hilt.navigation.compose.hiltViewModel
|
||||||
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||||
|
import ua.acclorite.book_story.R
|
||||||
|
import ua.acclorite.book_story.domain.reader.ReaderFontThickness
|
||||||
|
import ua.acclorite.book_story.domain.ui.ButtonItem
|
||||||
|
import ua.acclorite.book_story.presentation.core.components.settings.ChipsWithTitle
|
||||||
|
import ua.acclorite.book_story.presentation.core.constants.Constants
|
||||||
|
import ua.acclorite.book_story.presentation.core.constants.provideFonts
|
||||||
|
import ua.acclorite.book_story.ui.main.MainEvent
|
||||||
|
import ua.acclorite.book_story.ui.main.MainModel
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun FontThicknessOption() {
|
||||||
|
val mainModel = hiltViewModel<MainModel>()
|
||||||
|
val state = mainModel.state.collectAsStateWithLifecycle()
|
||||||
|
|
||||||
|
val fontFamily = remember(state.value.fontFamily) {
|
||||||
|
Constants.provideFonts().run {
|
||||||
|
find {
|
||||||
|
it.id == state.value.fontFamily
|
||||||
|
} ?: get(0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ChipsWithTitle(
|
||||||
|
title = stringResource(id = R.string.font_thickness_option),
|
||||||
|
chips = ReaderFontThickness.entries.map {
|
||||||
|
ButtonItem(
|
||||||
|
id = it.toString(),
|
||||||
|
title = when (it) {
|
||||||
|
ReaderFontThickness.THIN -> stringResource(id = R.string.font_thickness_thin)
|
||||||
|
ReaderFontThickness.EXTRA_LIGHT -> stringResource(id = R.string.font_thickness_extra_light)
|
||||||
|
ReaderFontThickness.LIGHT -> stringResource(id = R.string.font_thickness_light)
|
||||||
|
ReaderFontThickness.NORMAL -> stringResource(id = R.string.font_thickness_normal)
|
||||||
|
ReaderFontThickness.MEDIUM -> stringResource(id = R.string.font_thickness_medium)
|
||||||
|
},
|
||||||
|
textStyle = MaterialTheme.typography.labelLarge.copy(
|
||||||
|
fontFamily = fontFamily.font,
|
||||||
|
fontWeight = it.thickness
|
||||||
|
),
|
||||||
|
selected = it == state.value.fontThickness
|
||||||
|
)
|
||||||
|
},
|
||||||
|
onClick = {
|
||||||
|
mainModel.onEvent(
|
||||||
|
MainEvent.OnChangeFontThickness(
|
||||||
|
it.id
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
@ -58,4 +58,5 @@ sealed class MainEvent {
|
||||||
data class OnChangeProgressBarAlignment(val value: String) : MainEvent()
|
data class OnChangeProgressBarAlignment(val value: String) : MainEvent()
|
||||||
data class OnChangeProgressBarFontSize(val value: Int) : MainEvent()
|
data class OnChangeProgressBarFontSize(val value: Int) : MainEvent()
|
||||||
data class OnChangeBrowsePinnedPaths(val value: String) : MainEvent()
|
data class OnChangeBrowsePinnedPaths(val value: String) : MainEvent()
|
||||||
|
data class OnChangeFontThickness(val value: String) : MainEvent()
|
||||||
}
|
}
|
||||||
|
|
@ -19,6 +19,7 @@ import kotlinx.coroutines.yield
|
||||||
import ua.acclorite.book_story.domain.browse.toBrowseLayout
|
import ua.acclorite.book_story.domain.browse.toBrowseLayout
|
||||||
import ua.acclorite.book_story.domain.browse.toBrowseSortOrder
|
import ua.acclorite.book_story.domain.browse.toBrowseSortOrder
|
||||||
import ua.acclorite.book_story.domain.reader.toColorEffects
|
import ua.acclorite.book_story.domain.reader.toColorEffects
|
||||||
|
import ua.acclorite.book_story.domain.reader.toFontThickness
|
||||||
import ua.acclorite.book_story.domain.reader.toHorizontalGesture
|
import ua.acclorite.book_story.domain.reader.toHorizontalGesture
|
||||||
import ua.acclorite.book_story.domain.reader.toReaderScreenOrientation
|
import ua.acclorite.book_story.domain.reader.toReaderScreenOrientation
|
||||||
import ua.acclorite.book_story.domain.reader.toTextAlignment
|
import ua.acclorite.book_story.domain.reader.toTextAlignment
|
||||||
|
|
@ -485,6 +486,14 @@ class MainModel @Inject constructor(
|
||||||
is MainEvent.OnChangeBrowsePinnedPaths -> handleBrowsePinnedPathsUpdate(
|
is MainEvent.OnChangeBrowsePinnedPaths -> handleBrowsePinnedPathsUpdate(
|
||||||
event = event
|
event = event
|
||||||
)
|
)
|
||||||
|
|
||||||
|
is MainEvent.OnChangeFontThickness -> handleDatastoreUpdate(
|
||||||
|
key = DataStoreConstants.FONT_THICKNESS,
|
||||||
|
value = event.value,
|
||||||
|
updateState = {
|
||||||
|
it.copy(fontThickness = this.toFontThickness())
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,10 +12,12 @@ import ua.acclorite.book_story.domain.browse.BrowseSortOrder
|
||||||
import ua.acclorite.book_story.domain.browse.toBrowseLayout
|
import ua.acclorite.book_story.domain.browse.toBrowseLayout
|
||||||
import ua.acclorite.book_story.domain.browse.toBrowseSortOrder
|
import ua.acclorite.book_story.domain.browse.toBrowseSortOrder
|
||||||
import ua.acclorite.book_story.domain.reader.ReaderColorEffects
|
import ua.acclorite.book_story.domain.reader.ReaderColorEffects
|
||||||
|
import ua.acclorite.book_story.domain.reader.ReaderFontThickness
|
||||||
import ua.acclorite.book_story.domain.reader.ReaderHorizontalGesture
|
import ua.acclorite.book_story.domain.reader.ReaderHorizontalGesture
|
||||||
import ua.acclorite.book_story.domain.reader.ReaderScreenOrientation
|
import ua.acclorite.book_story.domain.reader.ReaderScreenOrientation
|
||||||
import ua.acclorite.book_story.domain.reader.ReaderTextAlignment
|
import ua.acclorite.book_story.domain.reader.ReaderTextAlignment
|
||||||
import ua.acclorite.book_story.domain.reader.toColorEffects
|
import ua.acclorite.book_story.domain.reader.toColorEffects
|
||||||
|
import ua.acclorite.book_story.domain.reader.toFontThickness
|
||||||
import ua.acclorite.book_story.domain.reader.toHorizontalGesture
|
import ua.acclorite.book_story.domain.reader.toHorizontalGesture
|
||||||
import ua.acclorite.book_story.domain.reader.toReaderScreenOrientation
|
import ua.acclorite.book_story.domain.reader.toReaderScreenOrientation
|
||||||
import ua.acclorite.book_story.domain.reader.toTextAlignment
|
import ua.acclorite.book_story.domain.reader.toTextAlignment
|
||||||
|
|
@ -63,6 +65,7 @@ data class MainState(
|
||||||
|
|
||||||
// Reader Settings
|
// Reader Settings
|
||||||
val fontFamily: String = provideDefaultValue { Constants.provideFonts()[0].id },
|
val fontFamily: String = provideDefaultValue { Constants.provideFonts()[0].id },
|
||||||
|
val fontThickness: ReaderFontThickness = provideDefaultValue { ReaderFontThickness.NORMAL },
|
||||||
val isItalic: Boolean = provideDefaultValue { false },
|
val isItalic: Boolean = provideDefaultValue { false },
|
||||||
val fontSize: Int = provideDefaultValue { 16 },
|
val fontSize: Int = provideDefaultValue { 16 },
|
||||||
val lineHeight: Int = provideDefaultValue { 4 },
|
val lineHeight: Int = provideDefaultValue { 4 },
|
||||||
|
|
@ -350,6 +353,10 @@ data class MainState(
|
||||||
browsePinnedPaths = provideValue(
|
browsePinnedPaths = provideValue(
|
||||||
BROWSE_PINNED_PATHS, convert = { toList() }
|
BROWSE_PINNED_PATHS, convert = { toList() }
|
||||||
) { browsePinnedPaths },
|
) { browsePinnedPaths },
|
||||||
|
|
||||||
|
fontThickness = provideValue(
|
||||||
|
FONT_THICKNESS, convert = { toFontThickness() }
|
||||||
|
) { fontThickness },
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -414,6 +414,7 @@ data class ReaderScreen(val bookId: Int) : Screen, Parcelable {
|
||||||
imagesColorEffects = imagesColorEffects,
|
imagesColorEffects = imagesColorEffects,
|
||||||
fontFamily = fontFamily,
|
fontFamily = fontFamily,
|
||||||
lineHeight = lineHeight,
|
lineHeight = lineHeight,
|
||||||
|
fontThickness = mainState.value.fontThickness,
|
||||||
fontStyle = fontStyle,
|
fontStyle = fontStyle,
|
||||||
chapterTitleAlignment = mainState.value.chapterTitleAlignment,
|
chapterTitleAlignment = mainState.value.chapterTitleAlignment,
|
||||||
textAlignment = mainState.value.textAlignment,
|
textAlignment = mainState.value.textAlignment,
|
||||||
|
|
|
||||||
|
|
@ -159,6 +159,7 @@
|
||||||
|
|
||||||
<!-- Reader -->
|
<!-- Reader -->
|
||||||
<string name="font_family_option">Сімейство шрифтів</string>
|
<string name="font_family_option">Сімейство шрифтів</string>
|
||||||
|
<string name="font_thickness_option">Товщина шрифта</string>
|
||||||
<string name="font_style_option">Стиль шрифта</string>
|
<string name="font_style_option">Стиль шрифта</string>
|
||||||
<string name="font_size_option">Розмір шрифта</string>
|
<string name="font_size_option">Розмір шрифта</string>
|
||||||
<string name="line_height_option">Висота рядка</string>
|
<string name="line_height_option">Висота рядка</string>
|
||||||
|
|
@ -278,6 +279,13 @@
|
||||||
<string name="color_effects_font">Колір шрифта</string>
|
<string name="color_effects_font">Колір шрифта</string>
|
||||||
<string name="color_effects_background">Колір фона</string>
|
<string name="color_effects_background">Колір фона</string>
|
||||||
|
|
||||||
|
<!-- Font Thickness properties -->
|
||||||
|
<string name="font_thickness_thin">Тонка</string>
|
||||||
|
<string name="font_thickness_extra_light">Дуже мала</string>
|
||||||
|
<string name="font_thickness_light">Мала</string>
|
||||||
|
<string name="font_thickness_normal">Звичайна</string>
|
||||||
|
<string name="font_thickness_medium">Середня</string>
|
||||||
|
|
||||||
<!-- Themes -->
|
<!-- Themes -->
|
||||||
<string name="dynamic_theme">Меркурій</string>
|
<string name="dynamic_theme">Меркурій</string>
|
||||||
<string name="blue_theme">Нептун</string>
|
<string name="blue_theme">Нептун</string>
|
||||||
|
|
|
||||||
|
|
@ -214,6 +214,7 @@
|
||||||
|
|
||||||
<!-- Reader -->
|
<!-- Reader -->
|
||||||
<string name="font_family_option">Font family</string>
|
<string name="font_family_option">Font family</string>
|
||||||
|
<string name="font_thickness_option">Font thickness</string>
|
||||||
<string name="font_style_option">Font style</string>
|
<string name="font_style_option">Font style</string>
|
||||||
<string name="font_size_option">Font size</string>
|
<string name="font_size_option">Font size</string>
|
||||||
<string name="line_height_option">Line height</string>
|
<string name="line_height_option">Line height</string>
|
||||||
|
|
@ -335,6 +336,13 @@
|
||||||
<string name="color_effects_font">Font color</string>
|
<string name="color_effects_font">Font color</string>
|
||||||
<string name="color_effects_background">Background color</string>
|
<string name="color_effects_background">Background color</string>
|
||||||
|
|
||||||
|
<!-- Font Thickness properties -->
|
||||||
|
<string name="font_thickness_thin">Thin</string>
|
||||||
|
<string name="font_thickness_extra_light">Extra light</string>
|
||||||
|
<string name="font_thickness_light">Light</string>
|
||||||
|
<string name="font_thickness_normal">Normal</string>
|
||||||
|
<string name="font_thickness_medium">Medium</string>
|
||||||
|
|
||||||
<!-- Themes -->
|
<!-- Themes -->
|
||||||
<string name="dynamic_theme">Mercury</string>
|
<string name="dynamic_theme">Mercury</string>
|
||||||
<string name="blue_theme">Neptune</string>
|
<string name="blue_theme">Neptune</string>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue