From 99af43928dd36ab117b62754d3fb38642b3a2d08 Mon Sep 17 00:00:00 2001 From: Artem Chepurnoy Date: Mon, 19 Feb 2024 15:28:44 +0200 Subject: [PATCH] Set the maximum width of mostly empty list screens to a lower value --- .../keyguard/feature/duplicates/DuplicatesScreen.kt | 6 +++++- .../keyguard/feature/generator/wordlist/WordlistsScreen.kt | 6 +++++- .../keyguard/feature/home/settings/SettingsScreen.kt | 6 +++++- .../feature/home/settings/accounts/AccountsScreen.kt | 6 +++++- .../justdeleteme/directory/JustDeleteMeServicesScreen.kt | 6 +++++- .../justgetdata/directory/JustGetMyDataServicesScreen.kt | 6 +++++- .../feature/passkeys/directory/PasskeysServicesScreen.kt | 6 +++++- .../keyguard/feature/tfa/directory/TwoFaServicesScreen.kt | 6 +++++- .../keyguard/feature/twopane/TwoPaneNavigation.kt | 7 ++++++- .../kotlin/com/artemchep/keyguard/ui/Scaffold.kt | 1 + 10 files changed, 47 insertions(+), 9 deletions(-) diff --git a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/duplicates/DuplicatesScreen.kt b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/duplicates/DuplicatesScreen.kt index bfb17ef..6b97264 100644 --- a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/duplicates/DuplicatesScreen.kt +++ b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/duplicates/DuplicatesScreen.kt @@ -5,6 +5,7 @@ import androidx.compose.runtime.remember import com.artemchep.keyguard.feature.duplicates.list.DuplicatesListRoute import com.artemchep.keyguard.feature.navigation.NavigationRouter import com.artemchep.keyguard.feature.twopane.TwoPaneNavigationContent +import com.artemchep.keyguard.ui.screenMaxWidthCompact @Composable fun DuplicatesScreen( @@ -19,6 +20,9 @@ fun DuplicatesScreen( id = DuplicatesRoute.ROUTER_NAME, initial = initialRoute, ) { backStack -> - TwoPaneNavigationContent(backStack) + TwoPaneNavigationContent( + backStack, + detailPaneMaxWidth = screenMaxWidthCompact, + ) } } diff --git a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/generator/wordlist/WordlistsScreen.kt b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/generator/wordlist/WordlistsScreen.kt index d221a1e..ef86003 100644 --- a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/generator/wordlist/WordlistsScreen.kt +++ b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/generator/wordlist/WordlistsScreen.kt @@ -4,6 +4,7 @@ import androidx.compose.runtime.Composable import com.artemchep.keyguard.feature.generator.wordlist.list.WordlistListRoute import com.artemchep.keyguard.feature.navigation.NavigationRouter import com.artemchep.keyguard.feature.twopane.TwoPaneNavigationContent +import com.artemchep.keyguard.ui.screenMaxWidthCompact @Composable fun WordlistsScreen() { @@ -11,6 +12,9 @@ fun WordlistsScreen() { id = WordlistsRoute.ROUTER_NAME, initial = WordlistListRoute, ) { backStack -> - TwoPaneNavigationContent(backStack) + TwoPaneNavigationContent( + backStack, + detailPaneMaxWidth = screenMaxWidthCompact, + ) } } diff --git a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/home/settings/SettingsScreen.kt b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/home/settings/SettingsScreen.kt index 22a787e..ce466c3 100644 --- a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/home/settings/SettingsScreen.kt +++ b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/home/settings/SettingsScreen.kt @@ -5,6 +5,7 @@ import androidx.compose.runtime.CompositionLocalProvider import com.artemchep.keyguard.feature.navigation.LocalNavigationNodeVisualStack import com.artemchep.keyguard.feature.navigation.NavigationRouter import com.artemchep.keyguard.feature.twopane.TwoPaneNavigationContent +import com.artemchep.keyguard.ui.screenMaxWidthCompact @Composable fun SettingsScreen() { @@ -21,7 +22,10 @@ fun SettingsScreen() { id = SettingsRoute.ROUTER_NAME, initial = SettingListRoute, ) { backStack -> - TwoPaneNavigationContent(backStack) + TwoPaneNavigationContent( + backStack, + detailPaneMaxWidth = screenMaxWidthCompact, + ) } } } diff --git a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/home/settings/accounts/AccountsScreen.kt b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/home/settings/accounts/AccountsScreen.kt index 3536dd6..222845d 100644 --- a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/home/settings/accounts/AccountsScreen.kt +++ b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/home/settings/accounts/AccountsScreen.kt @@ -4,6 +4,7 @@ import androidx.compose.runtime.Composable import com.artemchep.keyguard.feature.navigation.LocalNavigationNodeVisualStack import com.artemchep.keyguard.feature.navigation.NavigationRouter import com.artemchep.keyguard.feature.twopane.TwoPaneNavigationContent +import com.artemchep.keyguard.ui.screenMaxWidthCompact @Composable fun AccountsScreen() { @@ -20,7 +21,10 @@ fun AccountsScreen() { id = "accounts", initial = AccountListRoute, ) { backStack -> - TwoPaneNavigationContent(backStack) + TwoPaneNavigationContent( + backStack, + detailPaneMaxWidth = screenMaxWidthCompact, + ) } // } } diff --git a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/justdeleteme/directory/JustDeleteMeServicesScreen.kt b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/justdeleteme/directory/JustDeleteMeServicesScreen.kt index 3064e31..1ca9693 100644 --- a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/justdeleteme/directory/JustDeleteMeServicesScreen.kt +++ b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/justdeleteme/directory/JustDeleteMeServicesScreen.kt @@ -3,6 +3,7 @@ package com.artemchep.keyguard.feature.justdeleteme.directory import androidx.compose.runtime.Composable import com.artemchep.keyguard.feature.navigation.NavigationRouter import com.artemchep.keyguard.feature.twopane.TwoPaneNavigationContent +import com.artemchep.keyguard.ui.screenMaxWidthCompact @Composable fun TwoFaServicesScreen() { @@ -10,6 +11,9 @@ fun TwoFaServicesScreen() { id = JustDeleteMeServicesRoute.ROUTER_NAME, initial = JustDeleteMeServiceListRoute, ) { backStack -> - TwoPaneNavigationContent(backStack) + TwoPaneNavigationContent( + backStack, + detailPaneMaxWidth = screenMaxWidthCompact, + ) } } diff --git a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/justgetdata/directory/JustGetMyDataServicesScreen.kt b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/justgetdata/directory/JustGetMyDataServicesScreen.kt index 7624ade..c192679 100644 --- a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/justgetdata/directory/JustGetMyDataServicesScreen.kt +++ b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/justgetdata/directory/JustGetMyDataServicesScreen.kt @@ -3,6 +3,7 @@ package com.artemchep.keyguard.feature.justgetdata.directory import androidx.compose.runtime.Composable import com.artemchep.keyguard.feature.navigation.NavigationRouter import com.artemchep.keyguard.feature.twopane.TwoPaneNavigationContent +import com.artemchep.keyguard.ui.screenMaxWidthCompact @Composable fun JustGetMyDataServicesScreen() { @@ -10,6 +11,9 @@ fun JustGetMyDataServicesScreen() { id = JustGetMyDataServicesRoute.ROUTER_NAME, initial = JustGetMyDataListRoute, ) { backStack -> - TwoPaneNavigationContent(backStack) + TwoPaneNavigationContent( + backStack, + detailPaneMaxWidth = screenMaxWidthCompact, + ) } } diff --git a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/passkeys/directory/PasskeysServicesScreen.kt b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/passkeys/directory/PasskeysServicesScreen.kt index 808b500..cb1424f 100644 --- a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/passkeys/directory/PasskeysServicesScreen.kt +++ b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/passkeys/directory/PasskeysServicesScreen.kt @@ -3,6 +3,7 @@ package com.artemchep.keyguard.feature.passkeys.directory import androidx.compose.runtime.Composable import com.artemchep.keyguard.feature.navigation.NavigationRouter import com.artemchep.keyguard.feature.twopane.TwoPaneNavigationContent +import com.artemchep.keyguard.ui.screenMaxWidthCompact @Composable fun TwoFaServicesScreen() { @@ -10,6 +11,9 @@ fun TwoFaServicesScreen() { id = PasskeysServicesRoute.ROUTER_NAME, initial = PasskeysServiceListRoute, ) { backStack -> - TwoPaneNavigationContent(backStack) + TwoPaneNavigationContent( + backStack, + detailPaneMaxWidth = screenMaxWidthCompact, + ) } } diff --git a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/tfa/directory/TwoFaServicesScreen.kt b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/tfa/directory/TwoFaServicesScreen.kt index ec2b365..131f9d1 100644 --- a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/tfa/directory/TwoFaServicesScreen.kt +++ b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/tfa/directory/TwoFaServicesScreen.kt @@ -3,6 +3,7 @@ package com.artemchep.keyguard.feature.tfa.directory import androidx.compose.runtime.Composable import com.artemchep.keyguard.feature.navigation.NavigationRouter import com.artemchep.keyguard.feature.twopane.TwoPaneNavigationContent +import com.artemchep.keyguard.ui.screenMaxWidthCompact @Composable fun TwoFaServicesScreen() { @@ -10,6 +11,9 @@ fun TwoFaServicesScreen() { id = TwoFaServicesRoute.ROUTER_NAME, initial = TwoFaServiceListRoute, ) { backStack -> - TwoPaneNavigationContent(backStack) + TwoPaneNavigationContent( + backStack, + detailPaneMaxWidth = screenMaxWidthCompact, + ) } } diff --git a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/twopane/TwoPaneNavigation.kt b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/twopane/TwoPaneNavigation.kt index 984776e..9778406 100644 --- a/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/twopane/TwoPaneNavigation.kt +++ b/common/src/commonMain/kotlin/com/artemchep/keyguard/feature/twopane/TwoPaneNavigation.kt @@ -2,17 +2,22 @@ package com.artemchep.keyguard.feature.twopane import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider +import androidx.compose.ui.unit.Dp import com.artemchep.keyguard.feature.navigation.LocalNavigationNodeVisualStack import com.artemchep.keyguard.feature.navigation.NavigationEntry import com.artemchep.keyguard.feature.navigation.NavigationNode +import com.artemchep.keyguard.ui.screenMaxWidth import kotlinx.collections.immutable.PersistentList import kotlinx.collections.immutable.persistentListOf @Composable fun TwoPaneNavigationContent( backStack: PersistentList, + detailPaneMaxWidth: Dp = screenMaxWidth, ) { - TwoPaneScaffold { + TwoPaneScaffold( + detailPaneMaxWidth = detailPaneMaxWidth, + ) { if (backStack.isEmpty()) { // Nothing to draw, the back stack is empty. return@TwoPaneScaffold diff --git a/common/src/commonMain/kotlin/com/artemchep/keyguard/ui/Scaffold.kt b/common/src/commonMain/kotlin/com/artemchep/keyguard/ui/Scaffold.kt index 835902a..fb2fe24 100644 --- a/common/src/commonMain/kotlin/com/artemchep/keyguard/ui/Scaffold.kt +++ b/common/src/commonMain/kotlin/com/artemchep/keyguard/ui/Scaffold.kt @@ -84,6 +84,7 @@ import kotlinx.collections.immutable.ImmutableList import kotlin.math.log10 val screenMaxWidth = 768.dp +val screenMaxWidthCompact = 480.dp private val screenPaddingTop = 8.dp private val screenPaddingBottom = 8.dp