android: expanded width - two-column Connect, 640dp settings
This commit is contained in:
1 parent
0e5e28b4da
commit
3c7c121c7d
2 files changed
+43
-10
No files matched your search
+40
-9
@@ -113,6 +113,9 @@ import androidx.compose.ui.unit.dp
|
|||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
import androidx.lifecycle.compose.collectAsStateWithLifecycle
|
||||||
import kotlinx.coroutines.flow.StateFlow
|
import kotlinx.coroutines.flow.StateFlow
|
||||||
|
import androidx.compose.foundation.lazy.LazyListScope
|
||||||
|
import androidx.compose.ui.platform.LocalConfiguration
|
||||||
|
import androidx.compose.foundation.layout.fillMaxHeight
|
||||||
import org.strongswan.android.R
|
import org.strongswan.android.R
|
||||||
import org.strongswan.android.data.VpnProfile
|
import org.strongswan.android.data.VpnProfile
|
||||||
import org.strongswan.android.logic.VpnStateService.ErrorState
|
import org.strongswan.android.logic.VpnStateService.ErrorState
|
||||||
@@ -221,15 +224,8 @@ fun HomeScreen(
|
|||||||
Box(Modifier.fillMaxSize())
|
Box(Modifier.fillMaxSize())
|
||||||
{
|
{
|
||||||
StatusGlowBackground(color = statusColor, active = connected || connecting)
|
StatusGlowBackground(color = statusColor, active = connected || connecting)
|
||||||
LazyColumn(
|
val wide = LocalConfiguration.current.screenWidthDp >= 840
|
||||||
state = listState,
|
val leftItems: LazyListScope.() -> Unit = {
|
||||||
/* the adaptive navigation scaffold no longer pads the content area,
|
|
||||||
* so the hero offsets itself below the status bar */
|
|
||||||
modifier = Modifier.fillMaxSize().statusBarsPadding(),
|
|
||||||
horizontalAlignment = Alignment.CenterHorizontally,
|
|
||||||
verticalArrangement = Arrangement.spacedBy(ShxSpacing.lg),
|
|
||||||
)
|
|
||||||
{
|
|
||||||
item(key = "hero") {
|
item(key = "hero") {
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
@@ -304,6 +300,8 @@ fun HomeScreen(
|
|||||||
TrafficTiles(traffic = traffic, onClick = { viewModel.openDetails(true) })
|
TrafficTiles(traffic = traffic, onClick = { viewModel.openDetails(true) })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
val rightItems: LazyListScope.() -> Unit = {
|
||||||
item(key = "banner") {
|
item(key = "banner") {
|
||||||
HomeBannerSlot(
|
HomeBannerSlot(
|
||||||
error = hasError,
|
error = hasError,
|
||||||
@@ -329,6 +327,39 @@ fun HomeScreen(
|
|||||||
}
|
}
|
||||||
item(key = "space") { Spacer(Modifier.height(ShxSpacing.xl)) }
|
item(key = "space") { Spacer(Modifier.height(ShxSpacing.xl)) }
|
||||||
}
|
}
|
||||||
|
if (wide)
|
||||||
|
{
|
||||||
|
/* expanded width: hero and profile on the left, status blocks on the right */
|
||||||
|
Row(Modifier.fillMaxSize().statusBarsPadding())
|
||||||
|
{
|
||||||
|
LazyColumn(
|
||||||
|
state = listState,
|
||||||
|
modifier = Modifier.weight(1f).fillMaxHeight(),
|
||||||
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
|
verticalArrangement = Arrangement.spacedBy(ShxSpacing.lg),
|
||||||
|
) { leftItems() }
|
||||||
|
LazyColumn(
|
||||||
|
modifier = Modifier.weight(1f).fillMaxHeight().padding(top = ShxSpacing.xl),
|
||||||
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
|
verticalArrangement = Arrangement.spacedBy(ShxSpacing.lg),
|
||||||
|
) { rightItems() }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LazyColumn(
|
||||||
|
state = listState,
|
||||||
|
/* the adaptive navigation scaffold no longer pads the content area,
|
||||||
|
* so the hero offsets itself below the status bar */
|
||||||
|
modifier = Modifier.fillMaxSize().statusBarsPadding(),
|
||||||
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
|
verticalArrangement = Arrangement.spacedBy(ShxSpacing.lg),
|
||||||
|
)
|
||||||
|
{
|
||||||
|
leftItems()
|
||||||
|
rightItems()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pickerOpen)
|
if (pickerOpen)
|
||||||
|
|||||||
+3
-1
@@ -95,6 +95,7 @@ import org.strongswan.android.ui.compose.theme.ThemeMode
|
|||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.height
|
import androidx.compose.foundation.layout.height
|
||||||
|
import androidx.compose.foundation.layout.widthIn
|
||||||
import org.strongswan.android.R
|
import org.strongswan.android.R
|
||||||
import org.strongswan.android.data.VpnProfile
|
import org.strongswan.android.data.VpnProfile
|
||||||
import org.strongswan.android.logic.StrongSwanApplication
|
import org.strongswan.android.logic.StrongSwanApplication
|
||||||
@@ -181,9 +182,10 @@ fun SettingsScreen(profiles: List<VpnProfile>, showTitle: Boolean = true)
|
|||||||
val effects = MaterialTheme.motionScheme.defaultEffectsSpec<Float>()
|
val effects = MaterialTheme.motionScheme.defaultEffectsSpec<Float>()
|
||||||
val spatial = MaterialTheme.motionScheme.defaultSpatialSpec<androidx.compose.ui.unit.IntOffset>()
|
val spatial = MaterialTheme.motionScheme.defaultSpatialSpec<androidx.compose.ui.unit.IntOffset>()
|
||||||
|
|
||||||
Box(Modifier.fillMaxSize())
|
Box(Modifier.fillMaxSize(), contentAlignment = Alignment.TopCenter)
|
||||||
{
|
{
|
||||||
AnimatedContent(
|
AnimatedContent(
|
||||||
|
modifier = Modifier.widthIn(max = 640.dp),
|
||||||
targetState = pageState,
|
targetState = pageState,
|
||||||
transitionSpec = {
|
transitionSpec = {
|
||||||
val forward = targetState != SettingsPage.ROOT
|
val forward = targetState != SettingsPage.ROOT
|
||||||
|
|||||||
Reference in new issue
Block a user