Merge pull request #4226 from element-hq/feature/bma/themeOverride

Theme override
This commit is contained in:
Benoit Marty 2025-02-06 16:48:16 +01:00 committed by GitHub
commit 98f793b02e
111 changed files with 293 additions and 275 deletions

View file

@ -14,7 +14,6 @@ import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.statusBarsPadding
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.material3.rememberTopAppBarState
import androidx.compose.runtime.Composable
@ -22,6 +21,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.PreviewParameter
import io.element.android.compound.theme.ElementTheme
import io.element.android.compound.tokens.generated.CompoundIcons
import io.element.android.features.leaveroom.api.LeaveRoomView
import io.element.android.features.networkmonitor.api.ui.ConnectivityIndicatorContainer
@ -90,7 +90,7 @@ fun RoomListView(
.statusBarsPadding()
.padding(top = topPadding)
.fillMaxSize()
.background(MaterialTheme.colorScheme.background)
.background(ElementTheme.colors.bgCanvasDefault)
)
acceptDeclineInviteView()
}
@ -152,14 +152,14 @@ private fun RoomListScaffold(
floatingActionButton = {
if (state.displayActions) {
FloatingActionButton(
// FIXME align on Design system theme
containerColor = MaterialTheme.colorScheme.primary,
containerColor = ElementTheme.colors.iconPrimary,
onClick = onCreateRoomClick
) {
Icon(
// Note cannot use Icons.Outlined.EditSquare, it does not exist :/
imageVector = CompoundIcons.Compose(),
contentDescription = stringResource(id = R.string.screen_roomlist_a11y_create_message)
contentDescription = stringResource(id = R.string.screen_roomlist_a11y_create_message),
tint = ElementTheme.colors.iconOnSolidPrimary,
)
}
}

View file

@ -162,7 +162,7 @@ private fun DefaultRoomListTopBar(
// Workaround to display a very subtle bloom for avatars with very soft colors
Color(0xFFF9F9F9)
} else {
ElementTheme.materialColors.background
ElementTheme.colors.bgCanvasDefault
},
blurSize = DpSize(avatarBloomSize, avatarBloomSize),
offset = DpOffset(24.dp, 24.dp + statusBarPadding),
@ -174,7 +174,7 @@ private fun DefaultRoomListTopBar(
} else {
DpSize.Unspecified
},
bottomSoftEdgeColor = ElementTheme.materialColors.background,
bottomSoftEdgeColor = ElementTheme.colors.bgCanvasDefault,
bottomSoftEdgeAlpha = if (displayFilters) {
1f
} else {
@ -233,7 +233,7 @@ private fun DefaultRoomListTopBar(
leadingIcon = {
Icon(
imageVector = CompoundIcons.ShareAndroid(),
tint = ElementTheme.materialColors.secondary,
tint = ElementTheme.colors.iconSecondary,
contentDescription = null,
)
}
@ -249,7 +249,7 @@ private fun DefaultRoomListTopBar(
leadingIcon = {
Icon(
imageVector = CompoundIcons.ChatProblem(),
tint = ElementTheme.materialColors.secondary,
tint = ElementTheme.colors.iconSecondary,
contentDescription = null,
)
}

View file

@ -24,7 +24,6 @@ import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.ripple
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
@ -212,7 +211,7 @@ private fun NameAndTimestampRow(
style = ElementTheme.typography.fontBodyLgMedium,
text = name ?: stringResource(id = CommonStrings.common_no_room_name),
fontStyle = FontStyle.Italic.takeIf { name == null },
color = MaterialTheme.roomListRoomName(),
color = ElementTheme.roomListRoomName(),
maxLines = 1,
overflow = TextOverflow.Ellipsis
)
@ -223,7 +222,7 @@ private fun NameAndTimestampRow(
color = if (isHighlighted) {
ElementTheme.colors.unreadIndicator
} else {
MaterialTheme.roomListRoomMessageDate()
ElementTheme.roomListRoomMessageDate()
},
)
}
@ -247,7 +246,7 @@ private fun InviteSubtitle(
maxLines = 1,
overflow = TextOverflow.Ellipsis,
style = ElementTheme.typography.fontBodyMdRegular,
color = MaterialTheme.roomListRoomMessage(),
color = ElementTheme.roomListRoomMessage(),
modifier = modifier,
)
}
@ -268,7 +267,7 @@ private fun LastMessageAndIndicatorRow(
Text(
modifier = Modifier.weight(1f),
text = attributedLastMessage,
color = MaterialTheme.roomListRoomMessage(),
color = ElementTheme.roomListRoomMessage(),
style = ElementTheme.typography.fontBodyMdRegular,
minLines = 2,
maxLines = 2,
@ -315,7 +314,7 @@ private fun InviteNameAndIndicatorRow(
style = ElementTheme.typography.fontBodyLgMedium,
text = name ?: stringResource(id = CommonStrings.common_no_room_name),
fontStyle = FontStyle.Italic.takeIf { name == null },
color = MaterialTheme.roomListRoomName(),
color = ElementTheme.roomListRoomName(),
maxLines = 1,
overflow = TextOverflow.Ellipsis
)