Fixes the Messages layout on foldables.

This commit is contained in:
Vitor Pamplona
2024-09-05 10:30:58 -04:00
parent a34c763656
commit 3a3c0d74d2

View File

@@ -24,9 +24,12 @@ import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.consumeWindowInsets
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.systemBarsPadding
import androidx.compose.foundation.pager.HorizontalPager
import androidx.compose.foundation.pager.PagerState
import androidx.compose.foundation.pager.rememberPagerState
@@ -73,6 +76,7 @@ import com.vitorpamplona.amethyst.ui.navigation.Route
import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel
import com.vitorpamplona.amethyst.ui.screen.loggedIn.DisappearingScaffold
import com.vitorpamplona.amethyst.ui.stringRes
import com.vitorpamplona.amethyst.ui.theme.Size20dp
import com.vitorpamplona.amethyst.ui.theme.TabRowHeight
import com.vitorpamplona.amethyst.ui.theme.placeholderText
import kotlinx.coroutines.Dispatchers
@@ -183,14 +187,34 @@ fun ChatroomListTwoPane(
}
}
DisappearingScaffold(
isInvertedLayout = false,
topBar = {
Column {
MainTopBar(accountViewModel, nav)
}
},
bottomBar = {
AppBottomBar(Route.Message, accountViewModel) { route, _ ->
nav.newStack(route.base)
}
},
accountViewModel = accountViewModel,
) {
TwoPane(
first = {
Box(Modifier.fillMaxSize().systemBarsPadding(), contentAlignment = Alignment.BottomEnd) {
ChatroomListScreenOnlyList(
knownFeedContentState,
newFeedContentState,
accountViewModel,
twoPaneNav,
)
Box(Modifier.padding(Size20dp), contentAlignment = Alignment.Center) {
ChannelFabColumn(accountViewModel, nav)
}
}
},
second = {
twoPaneNav.innerNav.value?.let {
@@ -214,8 +238,9 @@ fun ChatroomListTwoPane(
strategy = strategy,
displayFeatures = accountViewModel.settings.displayFeatures.value,
foldAwareConfiguration = FoldAwareConfiguration.VerticalFoldsOnly,
modifier = Modifier.fillMaxSize(),
modifier = Modifier.padding(it).consumeWindowInsets(it).fillMaxSize(),
)
}
}
@OptIn(ExperimentalFoundationApi::class)
@@ -244,6 +269,7 @@ fun ChatroomListScreenOnlyList(
}
}
Column {
ChatroomListOnlyTabs(
pagerState,
tabs,
@@ -258,6 +284,7 @@ fun ChatroomListScreenOnlyList(
accountViewModel,
nav,
)
}
}
@OptIn(ExperimentalFoundationApi::class)