mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-10-10 15:42:53 +02:00
Fixes the Messages layout on foldables.
This commit is contained in:
@@ -24,9 +24,12 @@ import androidx.compose.foundation.ExperimentalFoundationApi
|
|||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.PaddingValues
|
import androidx.compose.foundation.layout.PaddingValues
|
||||||
|
import androidx.compose.foundation.layout.consumeWindowInsets
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
|
import androidx.compose.foundation.layout.systemBarsPadding
|
||||||
import androidx.compose.foundation.pager.HorizontalPager
|
import androidx.compose.foundation.pager.HorizontalPager
|
||||||
import androidx.compose.foundation.pager.PagerState
|
import androidx.compose.foundation.pager.PagerState
|
||||||
import androidx.compose.foundation.pager.rememberPagerState
|
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.AccountViewModel
|
||||||
import com.vitorpamplona.amethyst.ui.screen.loggedIn.DisappearingScaffold
|
import com.vitorpamplona.amethyst.ui.screen.loggedIn.DisappearingScaffold
|
||||||
import com.vitorpamplona.amethyst.ui.stringRes
|
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.TabRowHeight
|
||||||
import com.vitorpamplona.amethyst.ui.theme.placeholderText
|
import com.vitorpamplona.amethyst.ui.theme.placeholderText
|
||||||
import kotlinx.coroutines.Dispatchers
|
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(
|
TwoPane(
|
||||||
first = {
|
first = {
|
||||||
|
Box(Modifier.fillMaxSize().systemBarsPadding(), contentAlignment = Alignment.BottomEnd) {
|
||||||
ChatroomListScreenOnlyList(
|
ChatroomListScreenOnlyList(
|
||||||
knownFeedContentState,
|
knownFeedContentState,
|
||||||
newFeedContentState,
|
newFeedContentState,
|
||||||
accountViewModel,
|
accountViewModel,
|
||||||
twoPaneNav,
|
twoPaneNav,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Box(Modifier.padding(Size20dp), contentAlignment = Alignment.Center) {
|
||||||
|
ChannelFabColumn(accountViewModel, nav)
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
second = {
|
second = {
|
||||||
twoPaneNav.innerNav.value?.let {
|
twoPaneNav.innerNav.value?.let {
|
||||||
@@ -214,9 +238,10 @@ fun ChatroomListTwoPane(
|
|||||||
strategy = strategy,
|
strategy = strategy,
|
||||||
displayFeatures = accountViewModel.settings.displayFeatures.value,
|
displayFeatures = accountViewModel.settings.displayFeatures.value,
|
||||||
foldAwareConfiguration = FoldAwareConfiguration.VerticalFoldsOnly,
|
foldAwareConfiguration = FoldAwareConfiguration.VerticalFoldsOnly,
|
||||||
modifier = Modifier.fillMaxSize(),
|
modifier = Modifier.padding(it).consumeWindowInsets(it).fillMaxSize(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@OptIn(ExperimentalFoundationApi::class)
|
@OptIn(ExperimentalFoundationApi::class)
|
||||||
@Composable
|
@Composable
|
||||||
@@ -244,6 +269,7 @@ fun ChatroomListScreenOnlyList(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Column {
|
||||||
ChatroomListOnlyTabs(
|
ChatroomListOnlyTabs(
|
||||||
pagerState,
|
pagerState,
|
||||||
tabs,
|
tabs,
|
||||||
@@ -259,6 +285,7 @@ fun ChatroomListScreenOnlyList(
|
|||||||
nav,
|
nav,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@OptIn(ExperimentalFoundationApi::class)
|
@OptIn(ExperimentalFoundationApi::class)
|
||||||
@Composable
|
@Composable
|
||||||
|
Reference in New Issue
Block a user