Use icon for Spaces and update label and navigation bar design and behavior.

This commit is contained in:
Benoit Marty 2025-07-07 13:39:03 +02:00 committed by Benoit Marty
parent 0dec35b838
commit 08d55b7fde
4 changed files with 19 additions and 12 deletions

View file

@ -16,18 +16,18 @@ enum class HomeNavigationBarItem(
val labelRes: Int, val labelRes: Int,
) { ) {
Chats( Chats(
labelRes = R.string.screen_roomlist_main_space_title labelRes = R.string.screen_home_tab_chats
), ),
Spaces( Spaces(
// TODO Create a new entry in Localazy labelRes = R.string.screen_home_tab_spaces
labelRes = R.string.screen_roomlist_main_space_title
); );
@Composable @Composable
fun icon() = when (this) { fun icon(
Chats -> CompoundIcons.ChatSolid() isSelected: Boolean,
// TODO Spaces -> CompoundIcons.Workspace() ) = when (this) {
Spaces -> CompoundIcons.Code() Chats -> if (isSelected) CompoundIcons.ChatSolid() else CompoundIcons.Chat()
Spaces -> if (isSelected) CompoundIcons.WorkspaceSolid() else CompoundIcons.Workspace()
} }
companion object { companion object {

View file

@ -56,7 +56,9 @@ import io.element.android.libraries.designsystem.preview.PreviewsDayNight
import io.element.android.libraries.designsystem.theme.components.FloatingActionButton import io.element.android.libraries.designsystem.theme.components.FloatingActionButton
import io.element.android.libraries.designsystem.theme.components.Icon import io.element.android.libraries.designsystem.theme.components.Icon
import io.element.android.libraries.designsystem.theme.components.NavigationBar import io.element.android.libraries.designsystem.theme.components.NavigationBar
import io.element.android.libraries.designsystem.theme.components.NavigationBarIcon
import io.element.android.libraries.designsystem.theme.components.NavigationBarItem import io.element.android.libraries.designsystem.theme.components.NavigationBarItem
import io.element.android.libraries.designsystem.theme.components.NavigationBarText
import io.element.android.libraries.designsystem.theme.components.Scaffold import io.element.android.libraries.designsystem.theme.components.Scaffold
import io.element.android.libraries.designsystem.theme.components.Text import io.element.android.libraries.designsystem.theme.components.Text
import io.element.android.libraries.designsystem.utils.snackbar.SnackbarHost import io.element.android.libraries.designsystem.utils.snackbar.SnackbarHost
@ -192,19 +194,21 @@ private fun HomeScaffold(
) )
) { ) {
HomeNavigationBarItem.entries.forEach { item -> HomeNavigationBarItem.entries.forEach { item ->
val isSelected = state.currentHomeNavigationBarItem == item
NavigationBarItem( NavigationBarItem(
selected = state.currentHomeNavigationBarItem == item, selected = isSelected,
onClick = { onClick = {
state.eventSink(HomeEvents.SelectHomeNavigationBarItem(item)) state.eventSink(HomeEvents.SelectHomeNavigationBarItem(item))
}, },
icon = { icon = {
Icon( NavigationBarIcon(
imageVector = item.icon(), imageVector = item.icon(isSelected),
contentDescription = null
) )
}, },
label = { label = {
Text(stringResource(item.labelRes)) NavigationBarText(
text = stringResource(item.labelRes),
)
} }
) )
} }

View file

@ -12,6 +12,8 @@
<string name="confirm_recovery_key_banner_title">"Your key storage is out of sync"</string> <string name="confirm_recovery_key_banner_title">"Your key storage is out of sync"</string>
<string name="full_screen_intent_banner_message">"To ensure you never miss an important call, please change your settings to allow full-screen notifications when your phone is locked."</string> <string name="full_screen_intent_banner_message">"To ensure you never miss an important call, please change your settings to allow full-screen notifications when your phone is locked."</string>
<string name="full_screen_intent_banner_title">"Enhance your call experience"</string> <string name="full_screen_intent_banner_title">"Enhance your call experience"</string>
<string name="screen_home_tab_chats">"Chats"</string>
<string name="screen_home_tab_spaces">"Spaces"</string>
<string name="screen_invites_decline_chat_message">"Are you sure you want to decline the invitation to join %1$s?"</string> <string name="screen_invites_decline_chat_message">"Are you sure you want to decline the invitation to join %1$s?"</string>
<string name="screen_invites_decline_chat_title">"Decline invite"</string> <string name="screen_invites_decline_chat_title">"Decline invite"</string>
<string name="screen_invites_decline_direct_chat_message">"Are you sure you want to decline this private chat with %1$s?"</string> <string name="screen_invites_decline_direct_chat_message">"Are you sure you want to decline this private chat with %1$s?"</string>

View file

@ -164,6 +164,7 @@
{ {
"name" : ":features:home:impl", "name" : ":features:home:impl",
"includeRegex" : [ "includeRegex" : [
"screen\\.home\\..*",
"screen_roomlist_.*", "screen_roomlist_.*",
"screen\\.roomlist\\..*", "screen\\.roomlist\\..*",
"session_verification_banner_.*", "session_verification_banner_.*",