From 0ec23f943dd3e421e61b68093ef3f25d7a2a3b28 Mon Sep 17 00:00:00 2001 From: Diego Beraldin Date: Fri, 29 Dec 2023 13:17:16 +0100 Subject: [PATCH] feat: edge to edge contents (#398) * chore: setup * feat: update post list * feat: update community detail * feat: update multi-community * feat: update user detail * feat: update profile * feat: add option in settings * feat: persistence and db migration * chore: add translations closes #311 --- .../core/persistence/data/SettingsModel.kt | 1 + .../repository/DefaultSettingsRepository.kt | 6 ++ .../core/persistence/settings.sq | 9 ++- .../commonMain/sqldelight/migrations/19.sqm | 2 + .../feature/profile/main/ProfileMainScreen.kt | 19 +++++- .../feature/settings/main/SettingsMviModel.kt | 2 + .../feature/settings/main/SettingsScreen.kt | 11 ++++ .../settings/main/SettingsViewModel.kt | 15 +++++ .../commonMain/resources/MR/ar/strings.xml | 1 + .../commonMain/resources/MR/base/strings.xml | 1 + .../commonMain/resources/MR/bg/strings.xml | 1 + .../commonMain/resources/MR/cs/strings.xml | 1 + .../commonMain/resources/MR/da/strings.xml | 1 + .../commonMain/resources/MR/de/strings.xml | 1 + .../commonMain/resources/MR/el/strings.xml | 1 + .../commonMain/resources/MR/eo/strings.xml | 1 + .../commonMain/resources/MR/es/strings.xml | 1 + .../commonMain/resources/MR/et/strings.xml | 1 + .../commonMain/resources/MR/fi/strings.xml | 1 + .../commonMain/resources/MR/fr/strings.xml | 1 + .../commonMain/resources/MR/ga/strings.xml | 1 + .../commonMain/resources/MR/hr/strings.xml | 1 + .../commonMain/resources/MR/hu/strings.xml | 1 + .../commonMain/resources/MR/it/strings.xml | 1 + .../commonMain/resources/MR/lt/strings.xml | 1 + .../commonMain/resources/MR/lv/strings.xml | 1 + .../commonMain/resources/MR/mt/strings.xml | 1 + .../commonMain/resources/MR/nl/strings.xml | 1 + .../commonMain/resources/MR/no/strings.xml | 1 + .../commonMain/resources/MR/pl/strings.xml | 1 + .../commonMain/resources/MR/pt/strings.xml | 1 + .../commonMain/resources/MR/ro/strings.xml | 1 + .../commonMain/resources/MR/ru/strings.xml | 1 + .../commonMain/resources/MR/se/strings.xml | 1 + .../commonMain/resources/MR/sk/strings.xml | 1 + .../commonMain/resources/MR/sl/strings.xml | 1 + .../commonMain/resources/MR/sq/strings.xml | 1 + .../commonMain/resources/MR/tr/strings.xml | 1 + .../commonMain/resources/MR/uk/strings.xml | 1 + .../diegoberaldin/raccoonforlemmy/App.kt | 1 + .../raccoonforlemmy/MainScreen.kt | 8 ++- .../communitydetail/CommunityDetailScreen.kt | 14 +++++ .../detail/MultiCommunityScreen.kt | 17 ++++++ .../unit/postlist/PostListScreen.kt | 4 +- .../unit/postlist/PostsTopBar.kt | 59 ++++++++++++++----- .../unit/userdetail/UserDetailScreen.kt | 14 +++++ 46 files changed, 193 insertions(+), 20 deletions(-) create mode 100644 core/persistence/src/commonMain/sqldelight/migrations/19.sqm diff --git a/core/persistence/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/persistence/data/SettingsModel.kt b/core/persistence/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/persistence/data/SettingsModel.kt index 782d362c0..1d60ea416 100644 --- a/core/persistence/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/persistence/data/SettingsModel.kt +++ b/core/persistence/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/persistence/data/SettingsModel.kt @@ -39,4 +39,5 @@ data class SettingsModel( val commentBarTheme: Int = 0, val replyColor: Int? = null, val searchPostTitleOnly: Boolean = false, + val edgeToEdge: Boolean = true, ) : JavaSerializable diff --git a/core/persistence/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/persistence/repository/DefaultSettingsRepository.kt b/core/persistence/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/persistence/repository/DefaultSettingsRepository.kt index 8f47d594e..c3fd0b91c 100644 --- a/core/persistence/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/persistence/repository/DefaultSettingsRepository.kt +++ b/core/persistence/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/core/persistence/repository/DefaultSettingsRepository.kt @@ -45,6 +45,7 @@ private object KeyStoreKeys { const val ReplyColor = "replyColor" const val SearchPostTitleOnly = "searchPostTitleOnly" const val ContentFontFamily = "contentFontFamily" + const val EdgeToEdge = "edgeToEdge" } internal class DefaultSettingsRepository( @@ -92,6 +93,7 @@ internal class DefaultSettingsRepository( replyColor = settings.replyColor?.toLong(), searchPostTitleOnly = if (settings.searchPostTitleOnly) 1 else 0, contentFontFamily = settings.contentFontFamily.toLong(), + edgeToEdge = if (settings.edgeToEdge) 1 else 0, ) } @@ -134,6 +136,7 @@ internal class DefaultSettingsRepository( replyColor = if (!keyStore.containsKey(KeyStoreKeys.ReplyColor)) null else keyStore[KeyStoreKeys.ReplyColor, 0], searchPostTitleOnly = keyStore[KeyStoreKeys.SearchPostTitleOnly, false], contentFontFamily = keyStore[KeyStoreKeys.ContentFontFamily, 0], + edgeToEdge = keyStore[KeyStoreKeys.EdgeToEdge, true], ) } else { val entity = db.settingsQueries.getBy(accountId).executeAsOneOrNull() @@ -220,6 +223,7 @@ internal class DefaultSettingsRepository( settings.searchPostTitleOnly, ) keyStore.save(KeyStoreKeys.ContentFontFamily, settings.contentFontFamily) + keyStore.save(KeyStoreKeys.EdgeToEdge, settings.edgeToEdge) } else { db.settingsQueries.update( theme = settings.theme?.toLong(), @@ -255,6 +259,7 @@ internal class DefaultSettingsRepository( replyColor = settings.replyColor?.toLong(), searchPostTitleOnly = if (settings.searchPostTitleOnly) 1L else 0L, contentFontFamily = settings.contentFontFamily.toLong(), + edgeToEdge = if (settings.edgeToEdge) 1L else 0L, ) } } @@ -298,4 +303,5 @@ private fun GetBy.toModel() = SettingsModel( replyColor = replyColor?.toInt(), searchPostTitleOnly = searchPostTitleOnly != 0L, contentFontFamily = contentFontFamily.toInt(), + edgeToEdge = edgeToEdge != 0L, ) diff --git a/core/persistence/src/commonMain/sqldelight/com/github/diegoberaldin/raccoonforlemmy/core/persistence/settings.sq b/core/persistence/src/commonMain/sqldelight/com/github/diegoberaldin/raccoonforlemmy/core/persistence/settings.sq index fa2481235..e15cbdbe0 100644 --- a/core/persistence/src/commonMain/sqldelight/com/github/diegoberaldin/raccoonforlemmy/core/persistence/settings.sq +++ b/core/persistence/src/commonMain/sqldelight/com/github/diegoberaldin/raccoonforlemmy/core/persistence/settings.sq @@ -32,6 +32,7 @@ CREATE TABLE SettingsEntity ( replyColor INTEGER DEFAULT NULL, searchPostTitleOnly INTEGER NOT NULL DEFAULT 0, contentFontFamily INTEGER NOT NULL DEFAULT 0, + edgeToEdge INTEGER NOT NULL DEFAULT 1, account_id INTEGER, FOREIGN KEY (account_id) REFERENCES AccountEntity(id) ON DELETE CASCADE, UNIQUE(account_id) @@ -71,6 +72,7 @@ INSERT OR IGNORE INTO SettingsEntity ( replyColor, searchPostTitleOnly, contentFontFamily, + edgeToEdge, account_id ) VALUES ( ?, @@ -105,6 +107,7 @@ INSERT OR IGNORE INTO SettingsEntity ( ?, ?, ?, + ?, ? ); @@ -141,7 +144,8 @@ SET theme = ?, commentBarTheme = ?, replyColor = ?, searchPostTitleOnly = ?, - contentFontFamily = ? + contentFontFamily = ?, + edgeToEdge = ? WHERE account_id = ?; getBy: @@ -178,6 +182,7 @@ SELECT commentBarTheme, replyColor, searchPostTitleOnly, - contentFontFamily + contentFontFamily, + edgeToEdge FROM SettingsEntity WHERE account_id = ?; \ No newline at end of file diff --git a/core/persistence/src/commonMain/sqldelight/migrations/19.sqm b/core/persistence/src/commonMain/sqldelight/migrations/19.sqm new file mode 100644 index 000000000..19f1a9758 --- /dev/null +++ b/core/persistence/src/commonMain/sqldelight/migrations/19.sqm @@ -0,0 +1,2 @@ +ALTER TABLE SettingsEntity +ADD COLUMN edgeToEdge INTEGER NOT NULL DEFAULT 1; \ No newline at end of file diff --git a/feature/profile/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/feature/profile/main/ProfileMainScreen.kt b/feature/profile/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/feature/profile/main/ProfileMainScreen.kt index b88b0f8c2..34a2e83c4 100644 --- a/feature/profile/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/feature/profile/main/ProfileMainScreen.kt +++ b/feature/profile/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/feature/profile/main/ProfileMainScreen.kt @@ -3,6 +3,7 @@ package com.github.diegoberaldin.raccoonforlemmy.feature.profile.main import androidx.compose.foundation.Image import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.width import androidx.compose.material.icons.Icons @@ -15,6 +16,7 @@ import androidx.compose.material3.Scaffold import androidx.compose.material3.Text import androidx.compose.material3.TopAppBar import androidx.compose.material3.TopAppBarDefaults +import androidx.compose.material3.rememberTopAppBarState import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.collectAsState @@ -22,6 +24,8 @@ import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope +import androidx.compose.runtime.setValue +import androidx.compose.runtime.snapshotFlow import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.ColorFilter @@ -32,6 +36,7 @@ import cafe.adriel.voyager.navigator.tab.LocalTabNavigator import cafe.adriel.voyager.navigator.tab.Tab import cafe.adriel.voyager.navigator.tab.TabNavigator import cafe.adriel.voyager.navigator.tab.TabOptions +import com.github.diegoberaldin.raccoonforlemmy.core.appearance.theme.Dimensions import com.github.diegoberaldin.raccoonforlemmy.core.appearance.theme.Spacing import com.github.diegoberaldin.raccoonforlemmy.core.architecture.bindToLifecycle import com.github.diegoberaldin.raccoonforlemmy.core.navigation.di.getDrawerCoordinator @@ -65,7 +70,8 @@ internal object ProfileMainScreen : Tab { val model = getScreenModel() model.bindToLifecycle(key) val uiState by model.uiState.collectAsState() - val scrollBehavior = TopAppBarDefaults.enterAlwaysScrollBehavior() + val topAppBarState = rememberTopAppBarState() + val scrollBehavior = TopAppBarDefaults.enterAlwaysScrollBehavior(topAppBarState) val drawerCoordinator = remember { getDrawerCoordinator() } val navigationCoordinator = remember { getNavigationCoordinator() } val settingsRepository = remember { getSettingsRepository() } @@ -80,7 +86,18 @@ internal object ProfileMainScreen : Tab { val title by remember(lang) { mutableStateOf(staticString(MR.strings.navigation_profile.desc())) } + val maxTopInset = Dimensions.topBarHeight.value.toInt() + var topInset by remember { mutableStateOf(maxTopInset) } + snapshotFlow { topAppBarState.collapsedFraction }.onEach { + topInset = (maxTopInset * (1 - it)).toInt() + }.launchIn(scope) + TopAppBar( + windowInsets = if (settings.edgeToEdge) { + WindowInsets(0, topInset, 0, 0) + } else { + TopAppBarDefaults.windowInsets + }, scrollBehavior = scrollBehavior, navigationIcon = { Image( diff --git a/feature/settings/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/feature/settings/main/SettingsMviModel.kt b/feature/settings/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/feature/settings/main/SettingsMviModel.kt index b366d20d2..fc78d28b9 100644 --- a/feature/settings/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/feature/settings/main/SettingsMviModel.kt +++ b/feature/settings/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/feature/settings/main/SettingsMviModel.kt @@ -51,6 +51,7 @@ interface SettingsMviModel : data class ChangeMarkAsReadWhileScrolling(val value: Boolean) : Intent data class ChangeDefaultInboxUnreadOnly(val value: Boolean) : Intent data class ChangeSearchPostTitleOnly(val value: Boolean) : Intent + data class ChangeEdgeToEdge(val value: Boolean) : Intent } data class UiState( @@ -91,6 +92,7 @@ interface SettingsMviModel : val availableSortTypesForComments: List = emptyList(), val commentBarTheme: CommentBarTheme = CommentBarTheme.Blue, val searchPostTitleOnly: Boolean = false, + val edgeToEdge: Boolean = true, ) sealed interface Effect diff --git a/feature/settings/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/feature/settings/main/SettingsScreen.kt b/feature/settings/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/feature/settings/main/SettingsScreen.kt index e0760cb2f..c17ed2931 100644 --- a/feature/settings/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/feature/settings/main/SettingsScreen.kt +++ b/feature/settings/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/feature/settings/main/SettingsScreen.kt @@ -442,6 +442,17 @@ class SettingsScreen : Screen { title = stringResource(MR.strings.settings_section_behaviour), ) + // edge to edge + SettingsSwitchRow( + title = stringResource(MR.strings.settings_edge_to_edge), + value = uiState.edgeToEdge, + onValueChanged = rememberCallbackArgs(model) { value -> + model.reduce( + SettingsMviModel.Intent.ChangeEdgeToEdge(value) + ) + }, + ) + // mark as read while scrolling SettingsSwitchRow( title = stringResource(MR.strings.settings_mark_as_read_while_scrolling), diff --git a/feature/settings/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/feature/settings/main/SettingsViewModel.kt b/feature/settings/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/feature/settings/main/SettingsViewModel.kt index f68e9f83b..f53a65165 100644 --- a/feature/settings/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/feature/settings/main/SettingsViewModel.kt +++ b/feature/settings/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/feature/settings/main/SettingsViewModel.kt @@ -212,6 +212,7 @@ class SettingsViewModel( zombieModeScrollAmount = settings.zombieModeScrollAmount, markAsReadWhileScrolling = settings.markAsReadWhileScrolling, searchPostTitleOnly = settings.searchPostTitleOnly, + edgeToEdge = settings.edgeToEdge, ) } } @@ -345,6 +346,10 @@ class SettingsViewModel( is SettingsMviModel.Intent.ChangeSearchPostTitleOnly -> { changeSearchPostTitleOnly(intent.value) } + + is SettingsMviModel.Intent.ChangeEdgeToEdge -> { + changeEdgeToEdge(intent.value) + } } } @@ -678,6 +683,16 @@ class SettingsViewModel( } } + private fun changeEdgeToEdge(value: Boolean) { + mvi.updateState { it.copy(edgeToEdge = value) } + mvi.scope?.launch(Dispatchers.IO) { + val settings = settingsRepository.currentSettings.value.copy( + edgeToEdge = value + ) + saveSettings(settings) + } + } + private suspend fun saveSettings(settings: SettingsModel) { val accountId = accountRepository.getActive()?.id settingsRepository.updateSettings(settings, accountId) diff --git a/resources/src/commonMain/resources/MR/ar/strings.xml b/resources/src/commonMain/resources/MR/ar/strings.xml index 79b0b8f31..f4d8a3087 100644 --- a/resources/src/commonMain/resources/MR/ar/strings.xml +++ b/resources/src/commonMain/resources/MR/ar/strings.xml @@ -303,4 +303,5 @@ الحظر والمرشحات إزالة الحظر المثيلات + محتويات الحافة إلى الحافة \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/base/strings.xml b/resources/src/commonMain/resources/MR/base/strings.xml index a10eded86..d557df19c 100755 --- a/resources/src/commonMain/resources/MR/base/strings.xml +++ b/resources/src/commonMain/resources/MR/base/strings.xml @@ -334,4 +334,5 @@ Bans and filters Unban Instances + Edge to edge contents \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/bg/strings.xml b/resources/src/commonMain/resources/MR/bg/strings.xml index f8a49bfc7..c7265b0f0 100644 --- a/resources/src/commonMain/resources/MR/bg/strings.xml +++ b/resources/src/commonMain/resources/MR/bg/strings.xml @@ -313,4 +313,5 @@ Забрани и филтри Премахване на забраната Инстанции + Съдържание от край до край \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/cs/strings.xml b/resources/src/commonMain/resources/MR/cs/strings.xml index 3ab2a3921..476d8ef4d 100644 --- a/resources/src/commonMain/resources/MR/cs/strings.xml +++ b/resources/src/commonMain/resources/MR/cs/strings.xml @@ -305,4 +305,5 @@ Zákazy a filtry Odstranit zákaz Instance + Obsah od okraje k okraji \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/da/strings.xml b/resources/src/commonMain/resources/MR/da/strings.xml index fd2645c08..aaf4dfc22 100644 --- a/resources/src/commonMain/resources/MR/da/strings.xml +++ b/resources/src/commonMain/resources/MR/da/strings.xml @@ -305,4 +305,5 @@ Forbud og filtre Fjern forbuddet Forekomster + Indhold fra kant til kant \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/de/strings.xml b/resources/src/commonMain/resources/MR/de/strings.xml index 1b01fc75d..2fd0d8b2d 100755 --- a/resources/src/commonMain/resources/MR/de/strings.xml +++ b/resources/src/commonMain/resources/MR/de/strings.xml @@ -313,4 +313,5 @@ Verbote und Filter Verbot aufheben Instanzen + Rand-zu-Rand-Inhalte \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/el/strings.xml b/resources/src/commonMain/resources/MR/el/strings.xml index 521f4f916..e8411868f 100644 --- a/resources/src/commonMain/resources/MR/el/strings.xml +++ b/resources/src/commonMain/resources/MR/el/strings.xml @@ -316,4 +316,5 @@ Απαγορεύσεις και φίλτρα Κατάργηση απαγόρευσης Περιπτώσεις + Περιεχόμενα από άκρη σε άκρη \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/eo/strings.xml b/resources/src/commonMain/resources/MR/eo/strings.xml index b0c9dcc56..ba9832ffc 100644 --- a/resources/src/commonMain/resources/MR/eo/strings.xml +++ b/resources/src/commonMain/resources/MR/eo/strings.xml @@ -304,4 +304,5 @@ Malpermesoj kaj filtriloj Forigi malpermeson Ekzemploj + Enhavo de rando al rando \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/es/strings.xml b/resources/src/commonMain/resources/MR/es/strings.xml index 10e04de97..061d43ad9 100755 --- a/resources/src/commonMain/resources/MR/es/strings.xml +++ b/resources/src/commonMain/resources/MR/es/strings.xml @@ -310,4 +310,5 @@ Prohibiciones y filtros Eliminar prohibición Instancias + Contenidos de borde a borde \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/et/strings.xml b/resources/src/commonMain/resources/MR/et/strings.xml index 7bb56e074..9eedde812 100644 --- a/resources/src/commonMain/resources/MR/et/strings.xml +++ b/resources/src/commonMain/resources/MR/et/strings.xml @@ -305,4 +305,5 @@ Keelud ja filtrid Eemalda keeld Juhtumid + Servast servani sisu \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/fi/strings.xml b/resources/src/commonMain/resources/MR/fi/strings.xml index 7e554a883..1e170fe0c 100644 --- a/resources/src/commonMain/resources/MR/fi/strings.xml +++ b/resources/src/commonMain/resources/MR/fi/strings.xml @@ -305,4 +305,5 @@ Kiellot ja suodattimet Poista kielto Esineet + Reunasta reunaan sisältö \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/fr/strings.xml b/resources/src/commonMain/resources/MR/fr/strings.xml index e0d287194..6e2787c2c 100755 --- a/resources/src/commonMain/resources/MR/fr/strings.xml +++ b/resources/src/commonMain/resources/MR/fr/strings.xml @@ -310,4 +310,5 @@ Interdictions et filtres Supprimer interdiction Instances + Contenu bord à bord \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/ga/strings.xml b/resources/src/commonMain/resources/MR/ga/strings.xml index 5fdfa58a0..9a27dfcfe 100644 --- a/resources/src/commonMain/resources/MR/ga/strings.xml +++ b/resources/src/commonMain/resources/MR/ga/strings.xml @@ -314,4 +314,5 @@ Toirmisc agus scagairí Bain toirmeasc Cásanna + Ábhar imeall go himeall \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/hr/strings.xml b/resources/src/commonMain/resources/MR/hr/strings.xml index 1c77f9930..b1fb23900 100644 --- a/resources/src/commonMain/resources/MR/hr/strings.xml +++ b/resources/src/commonMain/resources/MR/hr/strings.xml @@ -310,4 +310,5 @@ Zabrane i filteri Ukloni zabranu Instance + Sadržaj od ruba do ruba \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/hu/strings.xml b/resources/src/commonMain/resources/MR/hu/strings.xml index 0a2269255..d0784b0aa 100644 --- a/resources/src/commonMain/resources/MR/hu/strings.xml +++ b/resources/src/commonMain/resources/MR/hu/strings.xml @@ -309,4 +309,5 @@ Tiltások és szűrők Távolítsa el a tiltást Példányok + Éltől szélig tartalom \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/it/strings.xml b/resources/src/commonMain/resources/MR/it/strings.xml index 9ac0a69f0..0beb4b86e 100755 --- a/resources/src/commonMain/resources/MR/it/strings.xml +++ b/resources/src/commonMain/resources/MR/it/strings.xml @@ -309,4 +309,5 @@ Ban e filtri Rimuovi ban Istanze + Contenuti da margine a margine \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/lt/strings.xml b/resources/src/commonMain/resources/MR/lt/strings.xml index 0f490f5f1..ddb8d668e 100644 --- a/resources/src/commonMain/resources/MR/lt/strings.xml +++ b/resources/src/commonMain/resources/MR/lt/strings.xml @@ -307,4 +307,5 @@ Draudimai ir filtrai Pašalinti draudimą Atvejai + Turinys nuo krašto iki krašto \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/lv/strings.xml b/resources/src/commonMain/resources/MR/lv/strings.xml index ad3825c6a..306e5a8a2 100644 --- a/resources/src/commonMain/resources/MR/lv/strings.xml +++ b/resources/src/commonMain/resources/MR/lv/strings.xml @@ -309,4 +309,5 @@ Aizliegumi un filtri Noņemt aizliegumu Gadījumi + Saturs no malas līdz malai \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/mt/strings.xml b/resources/src/commonMain/resources/MR/mt/strings.xml index 213ee67c6..3f134f7b1 100644 --- a/resources/src/commonMain/resources/MR/mt/strings.xml +++ b/resources/src/commonMain/resources/MR/mt/strings.xml @@ -310,4 +310,5 @@ Projbizzjonijiet u filtri Neħħi l-projbizzjoni Każijiet + Kontenut tarf sa tarf \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/nl/strings.xml b/resources/src/commonMain/resources/MR/nl/strings.xml index 4346d106d..410a15ca6 100644 --- a/resources/src/commonMain/resources/MR/nl/strings.xml +++ b/resources/src/commonMain/resources/MR/nl/strings.xml @@ -308,4 +308,5 @@ Verboden en filters Verwijder verbod Instanties + Inhoud van rand tot rand \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/no/strings.xml b/resources/src/commonMain/resources/MR/no/strings.xml index 2d57e7490..0cb08c59f 100644 --- a/resources/src/commonMain/resources/MR/no/strings.xml +++ b/resources/src/commonMain/resources/MR/no/strings.xml @@ -307,4 +307,5 @@ Forbud og filtre Fjern forbudet Forekomster + Kant til kant innhold \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/pl/strings.xml b/resources/src/commonMain/resources/MR/pl/strings.xml index 8f54773ed..d35488d81 100644 --- a/resources/src/commonMain/resources/MR/pl/strings.xml +++ b/resources/src/commonMain/resources/MR/pl/strings.xml @@ -308,4 +308,5 @@ Zakazy i filtry Usuń zakaz Instancje + Zawartość od krawędzi do krawędzi \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/pt/strings.xml b/resources/src/commonMain/resources/MR/pt/strings.xml index b055ab46e..ab1c504b7 100755 --- a/resources/src/commonMain/resources/MR/pt/strings.xml +++ b/resources/src/commonMain/resources/MR/pt/strings.xml @@ -307,4 +307,5 @@ Proibições e filtros Remover proibição Instâncias + Conteúdo de ponta a ponta \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/ro/strings.xml b/resources/src/commonMain/resources/MR/ro/strings.xml index e10e42d4a..f5a61df27 100755 --- a/resources/src/commonMain/resources/MR/ro/strings.xml +++ b/resources/src/commonMain/resources/MR/ro/strings.xml @@ -306,4 +306,5 @@ Interdicții și filtre Elimină interdicția Instanțe + Conținut de la margine la margine \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/ru/strings.xml b/resources/src/commonMain/resources/MR/ru/strings.xml index 622735871..98fdf7823 100644 --- a/resources/src/commonMain/resources/MR/ru/strings.xml +++ b/resources/src/commonMain/resources/MR/ru/strings.xml @@ -309,4 +309,5 @@ Баны и фильтры Снять бан Экземпляры + Содержимое от края до края \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/se/strings.xml b/resources/src/commonMain/resources/MR/se/strings.xml index 13a7aab53..09c372d0b 100644 --- a/resources/src/commonMain/resources/MR/se/strings.xml +++ b/resources/src/commonMain/resources/MR/se/strings.xml @@ -306,4 +306,5 @@ Förbud och filter Ta bort förbudet Instanser + Kant till kant innehåll \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/sk/strings.xml b/resources/src/commonMain/resources/MR/sk/strings.xml index d6b8a28cd..437f704d0 100644 --- a/resources/src/commonMain/resources/MR/sk/strings.xml +++ b/resources/src/commonMain/resources/MR/sk/strings.xml @@ -307,4 +307,5 @@ Zákazy a filtre Odstrániť zákaz Inštancie + Obsah od okraja k okraju \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/sl/strings.xml b/resources/src/commonMain/resources/MR/sl/strings.xml index ea68b5509..4f73f9e9a 100644 --- a/resources/src/commonMain/resources/MR/sl/strings.xml +++ b/resources/src/commonMain/resources/MR/sl/strings.xml @@ -305,4 +305,5 @@ Prepovedi in filtri Odstrani prepoved Primerki + Vsebina od roba do roba \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/sq/strings.xml b/resources/src/commonMain/resources/MR/sq/strings.xml index 4b4badfb6..6309f616b 100644 --- a/resources/src/commonMain/resources/MR/sq/strings.xml +++ b/resources/src/commonMain/resources/MR/sq/strings.xml @@ -311,4 +311,5 @@ Ndalimet dhe filtrat Hiq ndalimin Instancat + Përmbajtja buzë në skaj \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/tr/strings.xml b/resources/src/commonMain/resources/MR/tr/strings.xml index 870609743..5ee06c012 100644 --- a/resources/src/commonMain/resources/MR/tr/strings.xml +++ b/resources/src/commonMain/resources/MR/tr/strings.xml @@ -308,4 +308,5 @@ Yasaklar ve filtreler Yasağı kaldır Örnekler + Uçtan uca içerikler \ No newline at end of file diff --git a/resources/src/commonMain/resources/MR/uk/strings.xml b/resources/src/commonMain/resources/MR/uk/strings.xml index 88ee5fa7c..64004a5a2 100644 --- a/resources/src/commonMain/resources/MR/uk/strings.xml +++ b/resources/src/commonMain/resources/MR/uk/strings.xml @@ -307,4 +307,5 @@ Заборони та фільтри Зняти бан Примірники + Вміст від краю до краю \ No newline at end of file diff --git a/shared/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/App.kt b/shared/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/App.kt index a9ea49a17..38ba95979 100644 --- a/shared/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/App.kt +++ b/shared/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/App.kt @@ -223,6 +223,7 @@ fun App(onLoadingFinished: () -> Unit = {}) { theme = currentTheme, contentFontScale = fontScale, useDynamicColors = useDynamicColors, + transparent = true, ) { val lang by languageRepository.currentLanguage.collectAsState() LaunchedEffect(lang) {} diff --git a/shared/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/MainScreen.kt b/shared/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/MainScreen.kt index 4c2824375..da1c661c1 100644 --- a/shared/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/MainScreen.kt +++ b/shared/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/MainScreen.kt @@ -32,6 +32,7 @@ import cafe.adriel.voyager.koin.getScreenModel import cafe.adriel.voyager.navigator.tab.CurrentTab import cafe.adriel.voyager.navigator.tab.TabNavigator import com.github.diegoberaldin.raccoonforlemmy.core.appearance.di.getThemeRepository +import com.github.diegoberaldin.raccoonforlemmy.core.appearance.theme.Spacing import com.github.diegoberaldin.raccoonforlemmy.core.architecture.bindToLifecycle import com.github.diegoberaldin.raccoonforlemmy.core.navigation.DrawerEvent import com.github.diegoberaldin.raccoonforlemmy.core.navigation.TabNavigationSection @@ -188,7 +189,12 @@ internal object MainScreen : Screen { y = -uiState.bottomBarOffsetHeightPx.roundToInt() ) }, - contentPadding = PaddingValues(0.dp), + contentPadding = PaddingValues( + start = 0.dp, + top = 0.dp, + end = 0.dp, + bottom = Spacing.m, + ), backgroundColor = MaterialTheme.colorScheme.background, ) { TabNavigationItem(HomeTab, withText = titleVisible) diff --git a/unit/communitydetail/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/communitydetail/CommunityDetailScreen.kt b/unit/communitydetail/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/communitydetail/CommunityDetailScreen.kt index f795e6c10..83f5df742 100644 --- a/unit/communitydetail/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/communitydetail/CommunityDetailScreen.kt +++ b/unit/communitydetail/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/communitydetail/CommunityDetailScreen.kt @@ -10,6 +10,7 @@ import androidx.compose.foundation.gestures.animateScrollBy import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding @@ -57,6 +58,7 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.setValue +import androidx.compose.runtime.snapshotFlow import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.geometry.Offset @@ -72,6 +74,7 @@ import cafe.adriel.voyager.core.screen.Screen import cafe.adriel.voyager.core.screen.ScreenKey import com.github.diegoberaldin.raccoonforlemmy.core.appearance.data.PostLayout import com.github.diegoberaldin.raccoonforlemmy.core.appearance.di.getThemeRepository +import com.github.diegoberaldin.raccoonforlemmy.core.appearance.theme.Dimensions import com.github.diegoberaldin.raccoonforlemmy.core.appearance.theme.Spacing import com.github.diegoberaldin.raccoonforlemmy.core.architecture.bindToLifecycle import com.github.diegoberaldin.raccoonforlemmy.core.commonui.components.CustomDropDown @@ -208,7 +211,18 @@ class CommunityDetailScreen( .background(MaterialTheme.colorScheme.background) .padding(Spacing.xs), topBar = { + val maxTopInset = Dimensions.topBarHeight.value.toInt() + var topInset by remember { mutableStateOf(maxTopInset) } + snapshotFlow { topAppBarState.collapsedFraction }.onEach { + topInset = (maxTopInset * (1 - it)).toInt() + }.launchIn(scope) + TopAppBar( + windowInsets = if (settings.edgeToEdge) { + WindowInsets(0, topInset, 0, 0) + } else { + TopAppBarDefaults.windowInsets + }, scrollBehavior = scrollBehavior, title = { Text( diff --git a/unit/multicommunity/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/multicommunity/detail/MultiCommunityScreen.kt b/unit/multicommunity/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/multicommunity/detail/MultiCommunityScreen.kt index a85be9387..f518f94b1 100644 --- a/unit/multicommunity/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/multicommunity/detail/MultiCommunityScreen.kt +++ b/unit/multicommunity/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/multicommunity/detail/MultiCommunityScreen.kt @@ -7,6 +7,7 @@ import androidx.compose.foundation.Image import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding @@ -42,8 +43,11 @@ import androidx.compose.runtime.Composable import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope +import androidx.compose.runtime.setValue +import androidx.compose.runtime.snapshotFlow import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color @@ -56,6 +60,7 @@ import cafe.adriel.voyager.core.screen.Screen import cafe.adriel.voyager.koin.getScreenModel import com.github.diegoberaldin.raccoonforlemmy.core.appearance.data.PostLayout import com.github.diegoberaldin.raccoonforlemmy.core.appearance.di.getThemeRepository +import com.github.diegoberaldin.raccoonforlemmy.core.appearance.theme.Dimensions import com.github.diegoberaldin.raccoonforlemmy.core.appearance.theme.Spacing import com.github.diegoberaldin.raccoonforlemmy.core.architecture.bindToLifecycle import com.github.diegoberaldin.raccoonforlemmy.core.commonui.components.FloatingActionButtonMenu @@ -83,6 +88,8 @@ import com.github.diegoberaldin.raccoonforlemmy.unit.createreport.CreateReportSc import com.github.diegoberaldin.raccoonforlemmy.unit.web.WebViewScreen import com.github.diegoberaldin.raccoonforlemmy.unit.zoomableimage.ZoomableImageScreen import dev.icerock.moko.resources.compose.stringResource +import kotlinx.coroutines.flow.launchIn +import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.launch class MultiCommunityScreen( @@ -116,7 +123,17 @@ class MultiCommunityScreen( Scaffold( topBar = { val sortType = uiState.sortType + val maxTopInset = Dimensions.topBarHeight.value.toInt() + var topInset by remember { mutableStateOf(maxTopInset) } + snapshotFlow { topAppBarState.collapsedFraction }.onEach { + topInset = (maxTopInset * (1 - it)).toInt() + }.launchIn(scope) TopAppBar( + windowInsets = if (settings.edgeToEdge) { + WindowInsets(0, topInset, 0, 0) + } else { + TopAppBarDefaults.windowInsets + }, title = { Text( text = community.name, diff --git a/unit/postlist/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/postlist/PostListScreen.kt b/unit/postlist/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/postlist/PostListScreen.kt index 3dd20ab15..d23a4fc78 100644 --- a/unit/postlist/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/postlist/PostListScreen.kt +++ b/unit/postlist/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/postlist/PostListScreen.kt @@ -69,7 +69,6 @@ import com.github.diegoberaldin.raccoonforlemmy.core.commonui.lemmyui.PostCardPl import com.github.diegoberaldin.raccoonforlemmy.core.commonui.lemmyui.di.getFabNestedScrollConnection import com.github.diegoberaldin.raccoonforlemmy.core.commonui.modals.BlockBottomSheet import com.github.diegoberaldin.raccoonforlemmy.core.commonui.modals.ListingTypeBottomSheet -import com.github.diegoberaldin.raccoonforlemmy.unit.rawcontent.RawContentDialog import com.github.diegoberaldin.raccoonforlemmy.core.commonui.modals.ShareBottomSheet import com.github.diegoberaldin.raccoonforlemmy.core.commonui.modals.SortBottomSheet import com.github.diegoberaldin.raccoonforlemmy.core.navigation.TabNavigationSection @@ -84,6 +83,7 @@ import com.github.diegoberaldin.raccoonforlemmy.resources.MR import com.github.diegoberaldin.raccoonforlemmy.unit.createcomment.CreateCommentScreen import com.github.diegoberaldin.raccoonforlemmy.unit.createpost.CreatePostScreen import com.github.diegoberaldin.raccoonforlemmy.unit.createreport.CreateReportScreen +import com.github.diegoberaldin.raccoonforlemmy.unit.rawcontent.RawContentDialog import com.github.diegoberaldin.raccoonforlemmy.unit.web.WebViewScreen import com.github.diegoberaldin.raccoonforlemmy.unit.zoomableimage.ZoomableImageScreen import dev.icerock.moko.resources.compose.stringResource @@ -165,6 +165,8 @@ class PostListScreen : Screen { listingType = uiState.listingType, sortType = uiState.sortType, scrollBehavior = scrollBehavior, + topAppBarState = topAppBarState, + edgeToEdge = settings.edgeToEdge, onHamburgerTapped = rememberCallback { scope.launch { drawerCoordinator.toggleDrawer() diff --git a/unit/postlist/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/postlist/PostsTopBar.kt b/unit/postlist/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/postlist/PostsTopBar.kt index 42cead828..c58b64f96 100644 --- a/unit/postlist/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/postlist/PostsTopBar.kt +++ b/unit/postlist/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/postlist/PostsTopBar.kt @@ -4,6 +4,7 @@ import androidx.compose.foundation.Image import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size @@ -14,10 +15,19 @@ import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.material3.TopAppBar +import androidx.compose.material3.TopAppBarDefaults import androidx.compose.material3.TopAppBarScrollBehavior +import androidx.compose.material3.TopAppBarState import androidx.compose.runtime.Composable +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.rememberCoroutineScope +import androidx.compose.runtime.setValue +import androidx.compose.runtime.snapshotFlow import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.ColorFilter +import com.github.diegoberaldin.raccoonforlemmy.core.appearance.theme.Dimensions import com.github.diegoberaldin.raccoonforlemmy.core.appearance.theme.IconSize import com.github.diegoberaldin.raccoonforlemmy.core.appearance.theme.Spacing import com.github.diegoberaldin.raccoonforlemmy.core.utils.compose.onClick @@ -29,29 +39,46 @@ import com.github.diegoberaldin.raccoonforlemmy.domain.lemmy.data.toIcon import com.github.diegoberaldin.raccoonforlemmy.domain.lemmy.data.toReadableName import com.github.diegoberaldin.raccoonforlemmy.resources.MR import dev.icerock.moko.resources.compose.stringResource +import kotlinx.coroutines.flow.launchIn +import kotlinx.coroutines.flow.onEach @OptIn(ExperimentalMaterial3Api::class) @Composable internal fun PostsTopBar( scrollBehavior: TopAppBarScrollBehavior? = null, + topAppBarState: TopAppBarState, currentInstance: String, listingType: ListingType?, sortType: SortType?, + edgeToEdge: Boolean = true, onSelectListingType: (() -> Unit)? = null, onSelectSortType: (() -> Unit)? = null, onHamburgerTapped: (() -> Unit)? = null, ) { + val scope = rememberCoroutineScope() + val maxTopInset = Dimensions.topBarHeight.value.toInt() + var topInset by remember { mutableStateOf(maxTopInset) } + snapshotFlow { topAppBarState.collapsedFraction }.onEach { + topInset = (maxTopInset * (1 - it)).toInt() + }.launchIn(scope) + TopAppBar( + windowInsets = if (edgeToEdge) { + WindowInsets(0, topInset, 0, 0) + } else { + TopAppBarDefaults.windowInsets + }, scrollBehavior = scrollBehavior, navigationIcon = { when { onHamburgerTapped != null -> { Image( - modifier = Modifier.onClick( - onClick = rememberCallback { - onHamburgerTapped() - }, - ), + modifier = Modifier + .onClick( + onClick = rememberCallback { + onHamburgerTapped() + }, + ), imageVector = Icons.Default.Menu, contentDescription = null, colorFilter = ColorFilter.tint(MaterialTheme.colorScheme.onBackground), @@ -60,11 +87,12 @@ internal fun PostsTopBar( listingType != null -> { Image( - modifier = Modifier.onClick( - onClick = rememberCallback { - onSelectListingType?.invoke() - }, - ), + modifier = Modifier + .onClick( + onClick = rememberCallback { + onSelectListingType?.invoke() + }, + ), imageVector = listingType.toIcon(), contentDescription = null, colorFilter = ColorFilter.tint(MaterialTheme.colorScheme.onBackground), @@ -116,11 +144,12 @@ internal fun PostsTopBar( } if (sortType != null) { Image( - modifier = Modifier.onClick( - onClick = rememberCallback { - onSelectSortType?.invoke() - }, - ), + modifier = Modifier + .onClick( + onClick = rememberCallback { + onSelectSortType?.invoke() + }, + ), imageVector = sortType.toIcon(), contentDescription = null, colorFilter = ColorFilter.tint(MaterialTheme.colorScheme.onBackground), diff --git a/unit/userdetail/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/userdetail/UserDetailScreen.kt b/unit/userdetail/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/userdetail/UserDetailScreen.kt index 7c70f91cd..631b257d5 100644 --- a/unit/userdetail/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/userdetail/UserDetailScreen.kt +++ b/unit/userdetail/src/commonMain/kotlin/com/github/diegoberaldin/raccoonforlemmy/unit/userdetail/UserDetailScreen.kt @@ -9,6 +9,7 @@ import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding @@ -51,6 +52,7 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.setValue +import androidx.compose.runtime.snapshotFlow import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.geometry.Offset @@ -67,6 +69,7 @@ import cafe.adriel.voyager.core.screen.Screen import cafe.adriel.voyager.core.screen.ScreenKey import com.github.diegoberaldin.raccoonforlemmy.core.appearance.data.PostLayout import com.github.diegoberaldin.raccoonforlemmy.core.appearance.di.getThemeRepository +import com.github.diegoberaldin.raccoonforlemmy.core.appearance.theme.Dimensions import com.github.diegoberaldin.raccoonforlemmy.core.appearance.theme.Spacing import com.github.diegoberaldin.raccoonforlemmy.core.architecture.bindToLifecycle import com.github.diegoberaldin.raccoonforlemmy.core.commonui.components.CustomDropDown @@ -185,7 +188,18 @@ class UserDetailScreen( topBar = { val userName = user.name val userHost = user.host + val maxTopInset = Dimensions.topBarHeight.value.toInt() + var topInset by remember { mutableStateOf(maxTopInset) } + snapshotFlow { topAppBarState.collapsedFraction }.onEach { + topInset = (maxTopInset * (1 - it)).toInt() + }.launchIn(scope) + TopAppBar( + windowInsets = if (settings.edgeToEdge) { + WindowInsets(0, topInset, 0, 0) + } else { + TopAppBarDefaults.windowInsets + }, scrollBehavior = scrollBehavior, title = { Text(