🚀 Add "Padding" subcategory
* Created new tab in ReaderSettingsBottomSheet * Moved "Side Padding" in "Padding" subcategory
This commit is contained in:
parent
19dd345b5c
commit
64069afa95
7 changed files with 94 additions and 11 deletions
|
|
@ -5,6 +5,7 @@ import androidx.compose.animation.animateColorAsState
|
|||
import androidx.compose.animation.core.animateFloatAsState
|
||||
import androidx.compose.animation.core.tween
|
||||
import androidx.compose.foundation.layout.fillMaxHeight
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.pager.HorizontalPager
|
||||
|
|
@ -23,7 +24,10 @@ import ua.acclorite.book_story.presentation.core.components.LocalReaderViewModel
|
|||
import ua.acclorite.book_story.presentation.core.components.custom_bottom_sheet.CustomBottomSheet
|
||||
import ua.acclorite.book_story.presentation.screens.reader.data.ReaderEvent
|
||||
import ua.acclorite.book_story.presentation.screens.settings.nested.appearance.components.subcategories.ColorsSubcategory
|
||||
import ua.acclorite.book_story.presentation.screens.settings.nested.reader.components.ReaderSettingsCategory
|
||||
import ua.acclorite.book_story.presentation.screens.settings.nested.reader.components.subcategories.FontSubcategory
|
||||
import ua.acclorite.book_story.presentation.screens.settings.nested.reader.components.subcategories.PaddingSubcategory
|
||||
import ua.acclorite.book_story.presentation.screens.settings.nested.reader.components.subcategories.TextSubcategory
|
||||
import ua.acclorite.book_story.presentation.screens.settings.nested.reader.components.subcategories.TranslatorSubcategory
|
||||
|
||||
/**
|
||||
* Settings bottom sheet. Has General and Colors categories.
|
||||
|
|
@ -77,23 +81,37 @@ fun ReaderSettingsBottomSheet() {
|
|||
|
||||
HorizontalPager(state = pagerState) { page ->
|
||||
if (page == 0) {
|
||||
LazyColumn {
|
||||
|
||||
LazyColumn(Modifier.fillMaxSize()) {
|
||||
PaddingSubcategory(
|
||||
titleColor = { MaterialTheme.colorScheme.onSurface },
|
||||
topPadding = 22.dp,
|
||||
bottomPadding = 0.dp
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
if (page == 1) {
|
||||
LazyColumn {
|
||||
ReaderSettingsCategory(
|
||||
LazyColumn(Modifier.fillMaxSize()) {
|
||||
FontSubcategory(
|
||||
titleColor = { MaterialTheme.colorScheme.onSurface },
|
||||
topPadding = 16.dp,
|
||||
bottomPadding = 0.dp
|
||||
)
|
||||
TextSubcategory(
|
||||
titleColor = { MaterialTheme.colorScheme.onSurface },
|
||||
topPadding = 22.dp,
|
||||
bottomPadding = 0.dp
|
||||
)
|
||||
TranslatorSubcategory(
|
||||
titleColor = { MaterialTheme.colorScheme.onSurface },
|
||||
topPadding = 22.dp,
|
||||
bottomPadding = 8.dp + it
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
if (page == 2) {
|
||||
LazyColumn {
|
||||
LazyColumn(Modifier.fillMaxSize()) {
|
||||
ColorsSubcategory(
|
||||
showTitle = false,
|
||||
backgroundColor = { MaterialTheme.colorScheme.surfaceContainer },
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ fun ReaderSettingsBottomSheetTabRow(pagerState: PagerState) {
|
|||
|
||||
val tabItems = listOf(
|
||||
stringResource(id = R.string.general_tab),
|
||||
stringResource(id = R.string.reader_tab),
|
||||
stringResource(id = R.string.color_tab)
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import androidx.compose.ui.unit.Dp
|
|||
import androidx.compose.ui.unit.dp
|
||||
import ua.acclorite.book_story.presentation.core.components.CategoryTitle
|
||||
import ua.acclorite.book_story.presentation.screens.settings.nested.reader.components.subcategories.FontSubcategory
|
||||
import ua.acclorite.book_story.presentation.screens.settings.nested.reader.components.subcategories.PaddingSubcategory
|
||||
import ua.acclorite.book_story.presentation.screens.settings.nested.reader.components.subcategories.TextSubcategory
|
||||
import ua.acclorite.book_story.presentation.screens.settings.nested.reader.components.subcategories.TranslatorSubcategory
|
||||
|
||||
|
|
@ -36,6 +37,11 @@ fun LazyListScope.ReaderSettingsCategory(
|
|||
topPadding = 22.dp,
|
||||
bottomPadding = 0.dp
|
||||
)
|
||||
PaddingSubcategory(
|
||||
titleColor = titleColor,
|
||||
topPadding = 22.dp,
|
||||
bottomPadding = 0.dp
|
||||
)
|
||||
TranslatorSubcategory(
|
||||
titleColor = titleColor,
|
||||
topPadding = 22.dp,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,59 @@
|
|||
@file:Suppress("FunctionName")
|
||||
|
||||
package ua.acclorite.book_story.presentation.screens.settings.nested.reader.components.subcategories
|
||||
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.lazy.LazyListScope
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.coerceAtLeast
|
||||
import androidx.compose.ui.unit.dp
|
||||
import ua.acclorite.book_story.R
|
||||
import ua.acclorite.book_story.presentation.core.components.CategoryTitle
|
||||
import ua.acclorite.book_story.presentation.screens.settings.nested.reader.components.settings.SidePaddingSetting
|
||||
|
||||
/**
|
||||
* Padding subcategory.
|
||||
* Contains all settings related to padding.
|
||||
*/
|
||||
fun LazyListScope.PaddingSubcategory(
|
||||
titleColor: @Composable () -> Color = { MaterialTheme.colorScheme.primary },
|
||||
title: @Composable () -> String = { stringResource(id = R.string.padding_reader_settings) },
|
||||
showTitle: Boolean = true,
|
||||
topPadding: Dp,
|
||||
bottomPadding: Dp
|
||||
) {
|
||||
item {
|
||||
if (showTitle) {
|
||||
CategoryTitle(
|
||||
title = title.invoke(),
|
||||
color = titleColor.invoke(),
|
||||
modifier = Modifier
|
||||
.padding(
|
||||
top = topPadding,
|
||||
bottom = 8.dp
|
||||
)
|
||||
)
|
||||
} else {
|
||||
Spacer(
|
||||
modifier = Modifier.height((topPadding - 8.dp).coerceAtLeast(0.dp))
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
item {
|
||||
SidePaddingSetting()
|
||||
}
|
||||
|
||||
item {
|
||||
Spacer(
|
||||
modifier = Modifier.height(bottomPadding)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
@ -19,7 +19,6 @@ import ua.acclorite.book_story.presentation.core.components.CategoryTitle
|
|||
import ua.acclorite.book_story.presentation.screens.settings.nested.reader.components.settings.LineHeightSetting
|
||||
import ua.acclorite.book_story.presentation.screens.settings.nested.reader.components.settings.ParagraphHeightSetting
|
||||
import ua.acclorite.book_story.presentation.screens.settings.nested.reader.components.settings.ParagraphIndentationSetting
|
||||
import ua.acclorite.book_story.presentation.screens.settings.nested.reader.components.settings.SidePaddingSetting
|
||||
import ua.acclorite.book_story.presentation.screens.settings.nested.reader.components.settings.TextAlignmentSetting
|
||||
|
||||
/**
|
||||
|
|
@ -55,10 +54,6 @@ fun LazyListScope.TextSubcategory(
|
|||
TextAlignmentSetting()
|
||||
}
|
||||
|
||||
item {
|
||||
SidePaddingSetting()
|
||||
}
|
||||
|
||||
item {
|
||||
LineHeightSetting()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -183,6 +183,7 @@
|
|||
<string name="color_tab">Кольори</string>
|
||||
<string name="filter_tab">Фільтр</string>
|
||||
<string name="sort_tab">Сортування</string>
|
||||
<string name="reader_tab">Читач</string>
|
||||
|
||||
<!-- Settings categories -->
|
||||
<string name="general_settings">Головні</string>
|
||||
|
|
@ -198,6 +199,7 @@
|
|||
<string name="font_reader_settings">Шрифт</string>
|
||||
<string name="text_reader_settings">Текст</string>
|
||||
<string name="translator_reader_settings">Перекладач</string>
|
||||
<string name="padding_reader_settings">Відступи</string>
|
||||
<string name="theme_appearance_settings">Налаштування теми</string>
|
||||
<string name="colors_appearance_settings">Кольори</string>
|
||||
<string name="general_browse_settings">Головні</string>
|
||||
|
|
|
|||
|
|
@ -200,6 +200,7 @@
|
|||
<string name="color_tab">Colors</string>
|
||||
<string name="filter_tab">Filter</string>
|
||||
<string name="sort_tab">Sort</string>
|
||||
<string name="reader_tab">Reader</string>
|
||||
|
||||
<!-- Settings categories -->
|
||||
<string name="general_settings">General</string>
|
||||
|
|
@ -215,6 +216,7 @@
|
|||
<string name="font_reader_settings">Font</string>
|
||||
<string name="text_reader_settings">Text</string>
|
||||
<string name="translator_reader_settings">Translator</string>
|
||||
<string name="padding_reader_settings">Padding</string>
|
||||
<string name="theme_appearance_settings">Theme preferences</string>
|
||||
<string name="colors_appearance_settings">Colors</string>
|
||||
<string name="general_browse_settings">General</string>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue