From eff21c4f8fe5a0537dfa144a7af870eff0b0fbb3 Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Thu, 6 Jul 2023 10:22:44 -0400 Subject: [PATCH] Minimizes the height of the tabs --- .../com/vitorpamplona/amethyst/ui/navigation/AppBottomBar.kt | 3 ++- .../com/vitorpamplona/amethyst/ui/navigation/AppTopBar.kt | 3 ++- .../amethyst/ui/screen/loggedIn/BookmarkListScreen.kt | 4 +++- .../amethyst/ui/screen/loggedIn/ChatroomListScreen.kt | 5 +++-- .../amethyst/ui/screen/loggedIn/DiscoverScreen.kt | 5 +++-- .../amethyst/ui/screen/loggedIn/HiddenUsersScreen.kt | 4 +++- .../vitorpamplona/amethyst/ui/screen/loggedIn/HomeScreen.kt | 4 +++- .../main/java/com/vitorpamplona/amethyst/ui/theme/Shape.kt | 3 +++ app/src/main/res/values/strings.xml | 2 +- 9 files changed, 23 insertions(+), 10 deletions(-) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/navigation/AppBottomBar.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/navigation/AppBottomBar.kt index 9fce69507..75d47cead 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/navigation/AppBottomBar.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/navigation/AppBottomBar.kt @@ -41,6 +41,7 @@ import androidx.compose.ui.unit.sp import androidx.navigation.NavBackStackEntry import com.vitorpamplona.amethyst.model.LocalCache import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel +import com.vitorpamplona.amethyst.ui.theme.BottomTopHeight import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch @@ -101,7 +102,7 @@ private fun RenderBottomMenu( navEntryState: State, nav: (Route, Boolean) -> Unit ) { - Column(modifier = Modifier.height(50.dp)) { + Column(modifier = BottomTopHeight) { Divider( thickness = 0.25.dp ) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/navigation/AppTopBar.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/navigation/AppTopBar.kt index 223173a13..0975dfa2c 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/navigation/AppTopBar.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/navigation/AppTopBar.kt @@ -76,6 +76,7 @@ import com.vitorpamplona.amethyst.ui.components.RobohashAsyncImageProxy import com.vitorpamplona.amethyst.ui.screen.equalImmutableLists import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.screen.loggedIn.SpinnerSelectionDialog +import com.vitorpamplona.amethyst.ui.theme.BottomTopHeight import com.vitorpamplona.amethyst.ui.theme.placeholderText import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.toImmutableList @@ -208,7 +209,7 @@ fun MainTopBar(scaffoldState: ScaffoldState, accountViewModel: AccountViewModel, fun GenericTopBar(scaffoldState: ScaffoldState, accountViewModel: AccountViewModel, nav: (String) -> Unit, content: @Composable (AccountViewModel) -> Unit) { val coroutineScope = rememberCoroutineScope() - Column(modifier = Modifier.height(50.dp)) { + Column(modifier = BottomTopHeight) { TopAppBar( elevation = 0.dp, backgroundColor = MaterialTheme.colors.surface, diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/BookmarkListScreen.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/BookmarkListScreen.kt index 8bea955cc..46f65e75c 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/BookmarkListScreen.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/BookmarkListScreen.kt @@ -25,6 +25,7 @@ import com.vitorpamplona.amethyst.ui.dal.BookmarkPublicFeedFilter import com.vitorpamplona.amethyst.ui.screen.NostrBookmarkPrivateFeedViewModel import com.vitorpamplona.amethyst.ui.screen.NostrBookmarkPublicFeedViewModel import com.vitorpamplona.amethyst.ui.screen.RefresheableFeedView +import com.vitorpamplona.amethyst.ui.theme.TabRowHeight import kotlinx.coroutines.launch @OptIn(ExperimentalFoundationApi::class) @@ -54,7 +55,8 @@ fun BookmarkListScreen(accountViewModel: AccountViewModel, nav: (String) -> Unit TabRow( backgroundColor = MaterialTheme.colors.background, - selectedTabIndex = pagerState.currentPage + selectedTabIndex = pagerState.currentPage, + modifier = TabRowHeight ) { Tab( selected = pagerState.currentPage == 0, diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/ChatroomListScreen.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/ChatroomListScreen.kt index 155fc7746..ccaf471da 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/ChatroomListScreen.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/ChatroomListScreen.kt @@ -38,13 +38,13 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.lifecycle.Lifecycle import androidx.lifecycle.LifecycleEventObserver -import androidx.lifecycle.viewmodel.compose.viewModel import com.vitorpamplona.amethyst.R import com.vitorpamplona.amethyst.service.NostrChatroomListDataSource import com.vitorpamplona.amethyst.ui.screen.ChatroomListFeedView import com.vitorpamplona.amethyst.ui.screen.FeedViewModel import com.vitorpamplona.amethyst.ui.screen.NostrChatroomListKnownFeedViewModel import com.vitorpamplona.amethyst.ui.screen.NostrChatroomListNewFeedViewModel +import com.vitorpamplona.amethyst.ui.theme.TabRowHeight import com.vitorpamplona.amethyst.ui.theme.placeholderText import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch @@ -97,7 +97,8 @@ fun ChatroomListScreen( Box(Modifier.fillMaxWidth()) { TabRow( backgroundColor = MaterialTheme.colors.background, - selectedTabIndex = pagerState.currentPage + selectedTabIndex = pagerState.currentPage, + modifier = TabRowHeight ) { tabs.forEachIndexed { index, tab -> Tab( diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/DiscoverScreen.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/DiscoverScreen.kt index 60e393739..1aa879918 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/DiscoverScreen.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/DiscoverScreen.kt @@ -27,7 +27,6 @@ import androidx.compose.runtime.livedata.observeAsState import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope -import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalLifecycleOwner import androidx.compose.ui.res.stringResource @@ -51,6 +50,7 @@ import com.vitorpamplona.amethyst.ui.screen.RefresheableView import com.vitorpamplona.amethyst.ui.screen.SaveableFeedState import com.vitorpamplona.amethyst.ui.screen.ScrollStateKeys import com.vitorpamplona.amethyst.ui.screen.rememberForeverPagerState +import com.vitorpamplona.amethyst.ui.theme.TabRowHeight import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.toImmutableList import kotlinx.coroutines.launch @@ -118,7 +118,8 @@ private fun DiscoverPages( ) { TabRow( backgroundColor = MaterialTheme.colors.background, - selectedTabIndex = pagerState.currentPage + selectedTabIndex = pagerState.currentPage, + modifier = TabRowHeight ) { val coroutineScope = rememberCoroutineScope() diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/HiddenUsersScreen.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/HiddenUsersScreen.kt index bacd226d5..11fecfe6b 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/HiddenUsersScreen.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/HiddenUsersScreen.kt @@ -33,6 +33,7 @@ import com.vitorpamplona.amethyst.LocalPreferences import com.vitorpamplona.amethyst.R import com.vitorpamplona.amethyst.ui.screen.NostrHiddenAccountsFeedViewModel import com.vitorpamplona.amethyst.ui.screen.RefreshingFeedUserFeedView +import com.vitorpamplona.amethyst.ui.theme.TabRowHeight import kotlinx.coroutines.launch @Composable @@ -105,7 +106,8 @@ fun HiddenUsersScreen( TabRow( backgroundColor = MaterialTheme.colors.background, - selectedTabIndex = pagerState.currentPage + selectedTabIndex = pagerState.currentPage, + modifier = TabRowHeight ) { Tab( selected = pagerState.currentPage == 0, diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/HomeScreen.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/HomeScreen.kt index 8ef1e2d59..df8b54b15 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/HomeScreen.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/HomeScreen.kt @@ -39,6 +39,7 @@ import com.vitorpamplona.amethyst.ui.screen.PagerStateKeys import com.vitorpamplona.amethyst.ui.screen.RefresheableFeedView import com.vitorpamplona.amethyst.ui.screen.ScrollStateKeys import com.vitorpamplona.amethyst.ui.screen.rememberForeverPagerState +import com.vitorpamplona.amethyst.ui.theme.TabRowHeight import kotlinx.collections.immutable.ImmutableList import kotlinx.collections.immutable.toImmutableList import kotlinx.coroutines.Dispatchers @@ -105,7 +106,8 @@ private fun HomePages( ) { TabRow( backgroundColor = MaterialTheme.colors.background, - selectedTabIndex = pagerState.currentPage + selectedTabIndex = pagerState.currentPage, + modifier = TabRowHeight ) { val coroutineScope = rememberCoroutineScope() diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/theme/Shape.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/theme/Shape.kt index ba076b54a..cd5f5eaff 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/theme/Shape.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/theme/Shape.kt @@ -23,6 +23,9 @@ val Shapes = Shapes( val RippleRadius45dp = 45.dp // Ripple should be +10.dp over the component size +val BottomTopHeight = Modifier.height(50.dp) +val TabRowHeight = Modifier.height(40.dp) + val SmallBorder = RoundedCornerShape(7.dp) val QuoteBorder = RoundedCornerShape(15.dp) val ButtonBorder = RoundedCornerShape(20.dp) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 8fa571bf0..6cd56098a 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -475,5 +475,5 @@ Live Communities - Chats Groups + Chat Groups