From f2d8042164ea6877f5e4c1c40f2770e2a70e08a8 Mon Sep 17 00:00:00 2001 From: Acclorite <140836141+Acclorite@users.noreply.github.com> Date: Fri, 20 Sep 2024 22:03:39 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=9B=A0=EF=B8=8F=20Replace=20if=20with=20w?= =?UTF-8?q?hen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Replaced if with when in ReaderSettingsBottomSheet --- .../ReaderSettingsBottomSheet.kt | 96 ++++++++++--------- 1 file changed, 49 insertions(+), 47 deletions(-) diff --git a/app/src/main/java/ua/acclorite/book_story/presentation/screens/reader/components/settings_bottom_sheet/ReaderSettingsBottomSheet.kt b/app/src/main/java/ua/acclorite/book_story/presentation/screens/reader/components/settings_bottom_sheet/ReaderSettingsBottomSheet.kt index 27b99e09..71ac80a3 100644 --- a/app/src/main/java/ua/acclorite/book_story/presentation/screens/reader/components/settings_bottom_sheet/ReaderSettingsBottomSheet.kt +++ b/app/src/main/java/ua/acclorite/book_story/presentation/screens/reader/components/settings_bottom_sheet/ReaderSettingsBottomSheet.kt @@ -86,57 +86,59 @@ fun ReaderSettingsBottomSheet() { ReaderSettingsBottomSheetTabRow(pagerState = pagerState) HorizontalPager(state = pagerState) { page -> - if (page == 0) { - CustomLazyColumn(Modifier.fillMaxSize()) { - PaddingSubcategory( - titleColor = { MaterialTheme.colorScheme.onSurface }, - topPadding = 22.dp, - bottomPadding = 0.dp - ) - ReadingSpeedSubcategory( - titleColor = { MaterialTheme.colorScheme.onSurface }, - topPadding = 22.dp, - bottomPadding = 0.dp - ) - MiscSubcategory( - titleColor = { MaterialTheme.colorScheme.onSurface }, - showDivider = false, - topPadding = 22.dp, - bottomPadding = 8.dp + it - ) + when (page) { + 0 -> { + CustomLazyColumn(Modifier.fillMaxSize()) { + PaddingSubcategory( + titleColor = { MaterialTheme.colorScheme.onSurface }, + topPadding = 22.dp, + bottomPadding = 0.dp + ) + ReadingSpeedSubcategory( + titleColor = { MaterialTheme.colorScheme.onSurface }, + topPadding = 22.dp, + bottomPadding = 0.dp + ) + MiscSubcategory( + titleColor = { MaterialTheme.colorScheme.onSurface }, + showDivider = false, + topPadding = 22.dp, + bottomPadding = 8.dp + it + ) + } } - } - if (page == 1) { - CustomLazyColumn(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 }, - showDivider = false, - topPadding = 22.dp, - bottomPadding = 8.dp + it - ) + 1 -> { + CustomLazyColumn(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 }, + showDivider = false, + topPadding = 22.dp, + bottomPadding = 8.dp + it + ) + } } - } - if (page == 2) { - CustomLazyColumn(Modifier.fillMaxSize()) { - ColorsSubcategory( - showTitle = false, - showDivider = false, - backgroundColor = { MaterialTheme.colorScheme.surfaceContainer }, - topPadding = 16.dp, - bottomPadding = 8.dp + it - ) + 2 -> { + CustomLazyColumn(Modifier.fillMaxSize()) { + ColorsSubcategory( + showTitle = false, + showDivider = false, + backgroundColor = { MaterialTheme.colorScheme.surfaceContainer }, + topPadding = 16.dp, + bottomPadding = 8.dp + it + ) + } } } }