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

@ -15,7 +15,6 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.imePadding
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.systemBarsPadding
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.BiasAlignment
@ -111,7 +110,7 @@ private fun AnalyticsOptInHeader(
.padding(8.dp),
style = ElementTheme.typography.fontBodyMdRegular
.copy(
color = MaterialTheme.colorScheme.secondary,
color = ElementTheme.colors.textSecondary,
textAlign = TextAlign.Center,
)
)

View file

@ -29,6 +29,7 @@ setupAnvil()
dependencies {
implementation(projects.appconfig)
implementation(projects.features.enterprise.api)
implementation(projects.libraries.architecture)
implementation(projects.libraries.core)
implementation(projects.libraries.designsystem)

View file

@ -44,6 +44,7 @@ import io.element.android.features.call.impl.pip.PictureInPictureState
import io.element.android.features.call.impl.pip.PipView
import io.element.android.features.call.impl.services.CallForegroundService
import io.element.android.features.call.impl.utils.CallIntentDataParser
import io.element.android.features.enterprise.api.EnterpriseService
import io.element.android.libraries.architecture.Presenter
import io.element.android.libraries.architecture.bindings
import io.element.android.libraries.core.log.logger.LoggerTag
@ -61,6 +62,7 @@ class ElementCallActivity :
@Inject lateinit var callIntentDataParser: CallIntentDataParser
@Inject lateinit var presenterFactory: CallScreenPresenter.Factory
@Inject lateinit var appPreferencesStore: AppPreferencesStore
@Inject lateinit var enterpriseService: EnterpriseService
@Inject lateinit var pictureInPicturePresenter: PictureInPicturePresenter
private lateinit var presenter: Presenter<CallScreenState>
@ -109,7 +111,10 @@ class ElementCallActivity :
setContent {
val pipState = pictureInPicturePresenter.present()
ListenToAndroidEvents(pipState)
ElementThemeApp(appPreferencesStore) {
ElementThemeApp(
appPreferencesStore = appPreferencesStore,
enterpriseService = enterpriseService,
) {
val state = presenter.present()
eventSink = state.eventSink
LaunchedEffect(state.isCallActive, state.isInWidgetMode) {

View file

@ -19,6 +19,7 @@ import io.element.android.features.call.impl.di.CallBindings
import io.element.android.features.call.impl.notifications.CallNotificationData
import io.element.android.features.call.impl.utils.ActiveCallManager
import io.element.android.features.call.impl.utils.CallState
import io.element.android.features.enterprise.api.EnterpriseService
import io.element.android.libraries.architecture.bindings
import io.element.android.libraries.designsystem.theme.ElementThemeApp
import io.element.android.libraries.preferences.api.store.AppPreferencesStore
@ -47,6 +48,9 @@ class IncomingCallActivity : AppCompatActivity() {
@Inject
lateinit var appPreferencesStore: AppPreferencesStore
@Inject
lateinit var enterpriseService: EnterpriseService
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@ -64,7 +68,10 @@ class IncomingCallActivity : AppCompatActivity() {
val notificationData = intent?.let { IntentCompat.getParcelableExtra(it, EXTRA_NOTIFICATION_DATA, CallNotificationData::class.java) }
if (notificationData != null) {
setContent {
ElementThemeApp(appPreferencesStore) {
ElementThemeApp(
appPreferencesStore = appPreferencesStore,
enterpriseService = enterpriseService,
) {
IncomingCallScreen(
notificationData = notificationData,
onAnswer = ::onAnswer,

View file

@ -19,7 +19,6 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
@ -211,7 +210,7 @@ private fun CreateRoomActionButton(
) {
Icon(
modifier = Modifier.size(24.dp),
tint = MaterialTheme.colorScheme.secondary,
tint = ElementTheme.colors.iconSecondary,
resourceId = iconRes,
contentDescription = null,
)

View file

@ -13,6 +13,7 @@ android {
}
dependencies {
implementation(libs.compound)
implementation(projects.libraries.architecture)
implementation(projects.libraries.matrix.api)
}

View file

@ -7,9 +7,13 @@
package io.element.android.features.enterprise.api
import io.element.android.compound.tokens.generated.SemanticColors
import io.element.android.libraries.matrix.api.core.SessionId
interface EnterpriseService {
val isEnterpriseBuild: Boolean
suspend fun isEnterpriseUser(sessionId: SessionId): Boolean
fun semanticColorsLight(): SemanticColors
fun semanticColorsDark(): SemanticColors
}

View file

@ -17,6 +17,7 @@ android {
setupAnvil()
dependencies {
implementation(libs.compound)
implementation(projects.anvilannotations)
api(projects.features.enterprise.api)
implementation(projects.libraries.architecture)

View file

@ -8,6 +8,9 @@
package io.element.android.features.enterprise.impl
import com.squareup.anvil.annotations.ContributesBinding
import io.element.android.compound.tokens.generated.SemanticColors
import io.element.android.compound.tokens.generated.compoundColorsDark
import io.element.android.compound.tokens.generated.compoundColorsLight
import io.element.android.features.enterprise.api.EnterpriseService
import io.element.android.libraries.di.AppScope
import io.element.android.libraries.matrix.api.core.SessionId
@ -18,4 +21,8 @@ class DefaultEnterpriseService @Inject constructor() : EnterpriseService {
override val isEnterpriseBuild = false
override suspend fun isEnterpriseUser(sessionId: SessionId) = false
override fun semanticColorsLight(): SemanticColors = compoundColorsLight
override fun semanticColorsDark(): SemanticColors = compoundColorsDark
}

View file

@ -24,7 +24,6 @@ import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
@ -308,7 +307,7 @@ private fun JoinRoomContent(
Text(
text = stringResource(id = CommonStrings.error_unknown),
textAlign = TextAlign.Center,
color = MaterialTheme.colorScheme.error,
color = ElementTheme.colors.textCriticalPrimary,
)
},
)
@ -380,13 +379,13 @@ private fun DefaultLoadedContent(
text = stringResource(R.string.screen_join_room_space_not_supported_title),
textAlign = TextAlign.Center,
style = ElementTheme.typography.fontBodyLgMedium,
color = MaterialTheme.colorScheme.primary,
color = ElementTheme.colors.textPrimary,
)
Text(
text = stringResource(R.string.screen_join_room_space_not_supported_description, applicationName),
textAlign = TextAlign.Center,
style = ElementTheme.typography.fontBodyMdRegular,
color = MaterialTheme.colorScheme.secondary,
color = ElementTheme.colors.textSecondary,
)
} else if (contentState.joinAuthorisationStatus is JoinAuthorisationStatus.CanKnock) {
Spacer(modifier = Modifier.height(24.dp))

View file

@ -128,14 +128,14 @@ private fun KnockRequestsBannerContent(
Text(
text = state.formattedTitle(),
style = ElementTheme.typography.fontBodyMdMedium,
color = MaterialTheme.colorScheme.primary,
color = ElementTheme.colors.textPrimary,
textAlign = TextAlign.Start,
)
if (state.subtitle != null) {
Text(
text = state.subtitle,
style = ElementTheme.typography.fontBodySmRegular,
color = MaterialTheme.colorScheme.secondary,
color = ElementTheme.colors.textSecondary,
textAlign = TextAlign.Start,
)
}

View file

@ -27,7 +27,6 @@ import androidx.compose.foundation.layout.width
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.itemsIndexed
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
@ -331,7 +330,7 @@ private fun KnockRequestItem(
text = knockRequest.getBestName(),
maxLines = 1,
overflow = TextOverflow.Ellipsis,
color = MaterialTheme.colorScheme.primary,
color = ElementTheme.colors.textPrimary,
style = ElementTheme.typography.fontBodyLgMedium,
)
val formattedDate = knockRequest.formattedDate
@ -339,7 +338,7 @@ private fun KnockRequestItem(
Spacer(modifier = Modifier.width(8.dp))
Text(
text = formattedDate,
color = MaterialTheme.colorScheme.secondary,
color = ElementTheme.colors.textSecondary,
style = ElementTheme.typography.fontBodySmRegular,
)
}
@ -348,7 +347,7 @@ private fun KnockRequestItem(
if (!knockRequest.displayName.isNullOrEmpty()) {
Text(
text = knockRequest.userId.value,
color = MaterialTheme.colorScheme.secondary,
color = ElementTheme.colors.textSecondary,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
style = ElementTheme.typography.fontBodyMdRegular,

View file

@ -21,6 +21,7 @@ setupAnvil()
dependencies {
api(projects.features.lockscreen.api)
implementation(projects.appconfig)
implementation(projects.features.enterprise.api)
implementation(projects.libraries.core)
implementation(projects.libraries.architecture)
implementation(projects.libraries.matrix.api)

View file

@ -27,7 +27,6 @@ import androidx.compose.foundation.layout.systemBarsPadding
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Lock
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
@ -316,7 +315,7 @@ private fun PinUnlockHeader(
.fillMaxWidth(),
textAlign = TextAlign.Center,
style = ElementTheme.typography.fontHeadingMdBold,
color = MaterialTheme.colorScheme.primary,
color = ElementTheme.colors.textPrimary,
)
Spacer(Modifier.height(8.dp))
val remainingAttempts = state.remainingAttempts.dataOrNull()
@ -330,9 +329,9 @@ private fun PinUnlockHeader(
""
}
val subtitleColor = if (state.showWrongPinTitle) {
MaterialTheme.colorScheme.error
ElementTheme.colors.textCriticalPrimary
} else {
MaterialTheme.colorScheme.secondary
ElementTheme.colors.textSecondary
}
Text(
text = subtitle,

View file

@ -16,6 +16,7 @@ import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.lifecycle.lifecycleScope
import io.element.android.compound.theme.ElementTheme
import io.element.android.features.enterprise.api.EnterpriseService
import io.element.android.features.lockscreen.api.LockScreenLockState
import io.element.android.features.lockscreen.api.LockScreenService
import io.element.android.features.lockscreen.impl.unlock.PinUnlockPresenter
@ -38,13 +39,17 @@ class PinUnlockActivity : AppCompatActivity() {
@Inject lateinit var presenter: PinUnlockPresenter
@Inject lateinit var lockScreenService: LockScreenService
@Inject lateinit var appPreferencesStore: AppPreferencesStore
@Inject lateinit var enterpriseService: EnterpriseService
override fun onCreate(savedInstanceState: Bundle?) {
enableEdgeToEdge()
super.onCreate(savedInstanceState)
bindings<PinUnlockBindings>().inject(this)
setContent {
ElementThemeApp(appPreferencesStore) {
ElementThemeApp(
appPreferencesStore = appPreferencesStore,
enterpriseService = enterpriseService,
) {
val state = presenter.present()
val isDark = ElementTheme.isLightTheme.not()
PinUnlockView(

View file

@ -14,7 +14,6 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.heightIn
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
@ -68,7 +67,7 @@ fun AccountProviderView(
RoundedIconAtom(
size = RoundedIconAtomSize.Medium,
imageVector = CompoundIcons.Search(),
tint = MaterialTheme.colorScheme.primary,
tint = ElementTheme.colors.iconPrimary,
)
}
Text(
@ -77,7 +76,7 @@ fun AccountProviderView(
.weight(1f),
text = item.title,
style = ElementTheme.typography.fontBodyLgMedium,
color = MaterialTheme.colorScheme.primary,
color = ElementTheme.colors.textPrimary,
)
if (item.isPublic) {
Icon(
@ -96,7 +95,7 @@ fun AccountProviderView(
.padding(start = 46.dp, bottom = 12.dp, end = 26.dp),
text = item.subtitle,
style = ElementTheme.typography.fontBodyMdRegular,
color = MaterialTheme.colorScheme.secondary,
color = ElementTheme.colors.textSecondary,
)
}
}

View file

@ -22,7 +22,6 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.progressSemantics
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
@ -138,7 +137,7 @@ private fun ColumnScope.Buttons(
) {
Icon(
imageVector = CompoundIcons.Error(),
tint = MaterialTheme.colorScheme.error,
tint = ElementTheme.colors.iconCriticalPrimary,
contentDescription = null,
modifier = Modifier.size(24.dp)
)
@ -151,7 +150,7 @@ private fun ColumnScope.Buttons(
else -> stringResource(R.string.screen_qr_code_login_invalid_scan_state_subtitle)
},
textAlign = TextAlign.Center,
color = MaterialTheme.colorScheme.error,
color = ElementTheme.colors.textCriticalPrimary,
style = ElementTheme.typography.fontBodySmMedium,
)
}

View file

@ -196,8 +196,8 @@ fun MessagesView(
MessagesViewContent(
state = state,
modifier = Modifier
.padding(padding)
.consumeWindowInsets(padding),
.padding(padding)
.consumeWindowInsets(padding),
onContentClick = ::onContentClick,
onMessageLongClick = ::onMessageLongClick,
onUserDataClick = { hidingKeyboard { onUserDataClick(it) } },
@ -290,9 +290,9 @@ private fun MessagesViewContent(
) {
Box(
modifier = modifier
.fillMaxSize()
.navigationBarsPadding()
.imePadding(),
.fillMaxSize()
.navigationBarsPadding()
.imePadding(),
) {
AttachmentsBottomSheet(
state = state.composerState,
@ -402,13 +402,13 @@ private fun MessagesViewComposerBottomSheetContents(
Column(modifier = Modifier.fillMaxWidth()) {
SuggestionsPickerView(
modifier = Modifier
.heightIn(max = 230.dp)
// Consume all scrolling, preventing the bottom sheet from being dragged when interacting with the list of suggestions
.nestedScroll(object : NestedScrollConnection {
override fun onPostScroll(consumed: Offset, available: Offset, source: NestedScrollSource): Offset {
return available
}
}),
.heightIn(max = 230.dp)
// Consume all scrolling, preventing the bottom sheet from being dragged when interacting with the list of suggestions
.nestedScroll(object : NestedScrollConnection {
override fun onPostScroll(consumed: Offset, available: Offset, source: NestedScrollSource): Offset {
return available
}
}),
roomId = state.roomId,
roomName = state.roomName.dataOrNull(),
roomAvatarData = state.roomAvatar.dataOrNull(),
@ -456,8 +456,8 @@ private fun MessagesViewTopBar(
title = {
val roundedCornerShape = RoundedCornerShape(8.dp)
val titleModifier = Modifier
.clip(roundedCornerShape)
.clickable { onRoomDetailsClick() }
.clip(roundedCornerShape)
.clickable { onRoomDetailsClick() }
if (roomName != null && roomAvatar != null) {
RoomAvatarAndNameRow(
roomName = roomName,
@ -512,15 +512,15 @@ private fun RoomAvatarAndNameRow(
private fun CantSendMessageBanner() {
Row(
modifier = Modifier
.fillMaxWidth()
.background(MaterialTheme.colorScheme.secondary)
.padding(16.dp),
.fillMaxWidth()
.background(ElementTheme.colors.bgSubtleSecondary)
.padding(16.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.Center
) {
Text(
text = stringResource(id = R.string.screen_room_timeline_no_permission_to_post),
color = MaterialTheme.colorScheme.onSecondary,
color = ElementTheme.colors.textSecondary,
style = MaterialTheme.typography.bodyMedium,
textAlign = TextAlign.Center,
fontStyle = FontStyle.Italic,

View file

@ -27,7 +27,6 @@ import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.ListItemDefaults
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.rememberModalBottomSheetState
import androidx.compose.material3.ripple
import androidx.compose.runtime.Composable
@ -253,7 +252,7 @@ private fun MessageSummary(
) {
val content: @Composable () -> Unit
val icon: @Composable () -> Unit = { Avatar(avatarData = event.senderAvatar.copy(size = AvatarSize.MessageActionSender)) }
val contentStyle = ElementTheme.typography.fontBodyMdRegular.copy(color = MaterialTheme.colorScheme.secondary)
val contentStyle = ElementTheme.typography.fontBodyMdRegular.copy(color = ElementTheme.colors.textSecondary)
@Composable
fun ContentForBody(body: String) {
@ -316,7 +315,7 @@ private fun MessageSummary(
Text(
text = sentTimeFull,
style = ElementTheme.typography.fontBodyXsRegular,
color = MaterialTheme.colorScheme.secondary,
color = ElementTheme.colors.textSecondary,
textAlign = TextAlign.End,
)
}
@ -358,7 +357,7 @@ private fun EmojiReactionsRow(
Icon(
imageVector = CompoundIcons.ReactionAdd(),
contentDescription = stringResource(id = CommonStrings.a11y_react_with_other_emojis),
tint = MaterialTheme.colorScheme.secondary,
tint = ElementTheme.colors.iconSecondary,
modifier = Modifier
.size(24.dp)
.clickable(

View file

@ -108,7 +108,7 @@ private fun PinnedMessagesBannerRow(
Icon(
imageVector = CompoundIcons.PinSolid(),
contentDescription = null,
tint = ElementTheme.materialColors.secondary,
tint = ElementTheme.colors.iconSecondary,
modifier = Modifier
.padding(horizontal = 10.dp)
.size(20.dp)

View file

@ -21,7 +21,6 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Switch
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
@ -113,7 +112,7 @@ fun ReportMessageView(
Text(
text = stringResource(R.string.screen_report_content_block_user_hint),
style = ElementTheme.typography.fontBodyMdRegular,
color = MaterialTheme.colorScheme.secondary,
color = ElementTheme.colors.textSecondary,
)
}
Switch(

View file

@ -23,7 +23,6 @@ import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.CornerSize
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Immutable
import androidx.compose.ui.Alignment
@ -76,7 +75,7 @@ fun MessagesReactionButton(
.background(Color.Transparent)
// Outer border, same colour as background
.border(
BorderStroke(2.dp, MaterialTheme.colorScheme.background),
BorderStroke(2.dp, ElementTheme.colors.bgCanvasDefault),
shape = RoundedCornerShape(corner = CornerSize(14.dp))
)
.padding(vertical = 2.dp, horizontal = 2.dp)
@ -122,7 +121,7 @@ private fun TextContent(
.height(REACTION_EMOJI_LINE_HEIGHT.toDp()),
text = text,
style = ElementTheme.typography.fontBodyMdRegular,
color = ElementTheme.materialColors.primary
color = ElementTheme.colors.textPrimary
)
@Composable
@ -131,7 +130,7 @@ private fun IconContent(
) = Icon(
resourceId = resourceId,
contentDescription = stringResource(id = R.string.screen_room_timeline_add_reaction),
tint = ElementTheme.materialColors.secondary,
tint = ElementTheme.colors.iconSecondary,
modifier = Modifier
.size(ADD_EMOJI_SIZE)
)
@ -164,7 +163,7 @@ private fun ReactionContent(
Spacer(modifier = Modifier.width(4.dp))
Text(
text = reaction.count.toString(),
color = if (reaction.isHighlighted) MaterialTheme.colorScheme.primary else MaterialTheme.colorScheme.secondary,
color = if (reaction.isHighlighted) ElementTheme.colors.textPrimary else ElementTheme.colors.textSecondary,
style = ElementTheme.typography.fontBodyMdRegular,
)
}

View file

@ -14,7 +14,6 @@ import androidx.compose.foundation.layout.Spacer
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.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
@ -45,7 +44,7 @@ fun TimelineEventTimestampView(
val hasError = event.localSendState is LocalEventSendState.Failed
val hasEncryptionCritical = event.messageShield?.isCritical.orFalse()
val isMessageEdited = event.content.isEdited()
val tint = if (hasError || hasEncryptionCritical) MaterialTheme.colorScheme.error else MaterialTheme.colorScheme.secondary
val tint = if (hasError || hasEncryptionCritical) ElementTheme.colors.textCriticalPrimary else ElementTheme.colors.textSecondary
Row(
modifier = Modifier
.padding(PaddingValues(start = TimelineEventTimestampViewDefaults.spacing))

View file

@ -169,7 +169,7 @@ private fun Modifier.focusedEvent(
val highlightedLineColor = ElementTheme.colors.textActionAccent
val gradientColors = listOf(
ElementTheme.colors.highlightedMessageBackgroundColor,
ElementTheme.materialColors.background
ElementTheme.colors.bgCanvasDefault,
)
val verticalOffset = focusedEventOffset.toPx()
val verticalRatio = 0.7f

View file

@ -77,7 +77,7 @@ private fun TimelineItemAttachmentHeaderView(
modifier = Modifier
.size(iconSize)
.clip(CircleShape)
.background(ElementTheme.materialColors.background),
.background(ElementTheme.colors.bgCanvasDefault),
contentAlignment = Alignment.Center,
) {
icon()
@ -86,14 +86,14 @@ private fun TimelineItemAttachmentHeaderView(
Column {
Text(
text = filename,
color = ElementTheme.materialColors.primary,
color = ElementTheme.colors.textPrimary,
maxLines = 2,
style = ElementTheme.typography.fontBodyLgRegular,
overflow = TextOverflow.Ellipsis
)
Text(
text = fileExtensionAndSize,
color = ElementTheme.materialColors.secondary,
color = ElementTheme.colors.textSecondary,
style = ElementTheme.typography.fontBodySmRegular,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
@ -119,7 +119,7 @@ private fun TimelineItemAttachmentCaptionView(
Text(
modifier = modifier,
text = caption,
color = ElementTheme.materialColors.primary,
color = ElementTheme.colors.textPrimary,
style = ElementTheme.typography.fontBodyLgRegular,
onTextLayout = ContentAvoidingLayout.measureLastTextLine(
onContentLayoutChange = onContentLayoutChange,

View file

@ -38,7 +38,7 @@ fun TimelineItemAudioView(
Icon(
imageVector = Icons.Outlined.GraphicEq,
contentDescription = null,
tint = ElementTheme.materialColors.primary,
tint = ElementTheme.colors.iconPrimary,
modifier = Modifier
.size(16.dp),
)

View file

@ -38,7 +38,7 @@ fun TimelineItemFileView(
Icon(
resourceId = CompoundDrawables.ic_compound_attachment,
contentDescription = null,
tint = ElementTheme.materialColors.primary,
tint = ElementTheme.colors.iconPrimary,
modifier = Modifier
.size(16.dp)
.rotate(-45f),

View file

@ -14,7 +14,6 @@ import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
@ -53,7 +52,7 @@ fun TimelineItemInformativeView(
) {
Icon(
resourceId = iconResourceId,
tint = MaterialTheme.colorScheme.secondary,
tint = ElementTheme.colors.iconSecondary,
contentDescription = iconDescription,
modifier = Modifier.size(16.dp)
)
@ -61,7 +60,7 @@ fun TimelineItemInformativeView(
Spacer(modifier = Modifier.width(4.dp))
Text(
fontStyle = FontStyle.Italic,
color = MaterialTheme.colorScheme.secondary,
color = ElementTheme.colors.textSecondary,
style = ElementTheme.typography.fontBodyMdRegular,
text = text
)

View file

@ -7,7 +7,6 @@
package io.element.android.features.messages.impl.timeline.components.event
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.style.TextAlign
@ -25,7 +24,7 @@ fun TimelineItemStateView(
) {
Text(
modifier = modifier,
color = MaterialTheme.colorScheme.secondary,
color = ElementTheme.colors.textSecondary,
style = ElementTheme.typography.fontBodyMdRegular,
text = content.body,
textAlign = TextAlign.Center,

View file

@ -91,7 +91,7 @@ fun TimelineItemVoiceView(
Spacer(Modifier.width(8.dp))
Text(
text = state.time,
color = ElementTheme.materialColors.secondary,
color = ElementTheme.colors.textSecondary,
style = ElementTheme.typography.fontBodySmMedium,
maxLines = 1,
overflow = TextOverflow.Ellipsis,

View file

@ -17,7 +17,6 @@ import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
@ -67,7 +66,7 @@ fun GroupHeaderView(
) {
Text(
text = text,
color = MaterialTheme.colorScheme.secondary,
color = ElementTheme.colors.textSecondary,
style = ElementTheme.typography.fontBodyMdRegular,
)
val rotation: Float by animateFloatAsState(
@ -82,7 +81,7 @@ fun GroupHeaderView(
modifier = Modifier.rotate(rotation),
imageVector = CompoundIcons.ChevronRight(),
contentDescription = null,
tint = MaterialTheme.colorScheme.secondary
tint = ElementTheme.colors.iconSecondary
)
}
}

View file

@ -172,7 +172,7 @@ private fun AggregatedReactionButton(
val textColor = if (isHighlighted) {
MaterialTheme.colorScheme.inversePrimary
} else {
MaterialTheme.colorScheme.primary
ElementTheme.colors.textPrimary
}
val roundedCornerShape = RoundedCornerShape(corner = CornerSize(percent = 50))
@ -250,12 +250,12 @@ private fun SenderRow(
text = name,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
color = MaterialTheme.colorScheme.primary,
color = ElementTheme.colors.textPrimary,
style = ElementTheme.typography.fontBodyMdRegular,
)
Text(
text = sentTime,
color = MaterialTheme.colorScheme.secondary,
color = ElementTheme.colors.textSecondary,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
style = ElementTheme.typography.fontBodySmRegular,
@ -263,7 +263,7 @@ private fun SenderRow(
}
Text(
text = userId,
color = MaterialTheme.colorScheme.secondary,
color = ElementTheme.colors.textSecondary,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
style = ElementTheme.typography.fontBodySmRegular,

View file

@ -18,7 +18,6 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
@ -131,7 +130,7 @@ private fun ReadReceiptsAvatars(
) {
val avatarSize = AvatarSize.TimelineReadReceipt.dp
val avatarStrokeSize = 1.dp
val avatarStrokeColor = MaterialTheme.colorScheme.background
val avatarStrokeColor = ElementTheme.colors.bgCanvasDefault
val receiptDescription = computeReceiptDescription(receipts)
Row(
modifier = modifier

View file

@ -11,7 +11,6 @@ import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.wrapContentHeight
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
@ -39,7 +38,7 @@ internal fun TimelineItemDaySeparatorView(
Text(
text = model.formattedDate,
style = ElementTheme.typography.fontBodyMdMedium,
color = MaterialTheme.colorScheme.primary,
color = ElementTheme.colors.textPrimary,
)
}
}

View file

@ -11,7 +11,6 @@ import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
@ -41,7 +40,7 @@ fun TimelineItemRoomBeginningView(
stringResource(id = R.string.screen_room_timeline_beginning_of_room, roomName)
}
Text(
color = MaterialTheme.colorScheme.secondary,
color = ElementTheme.colors.textSecondary,
style = ElementTheme.typography.fontBodyMdRegular,
text = text,
textAlign = TextAlign.Center,

View file

@ -16,7 +16,6 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.statusBarsPadding
import androidx.compose.foundation.layout.width
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
@ -25,6 +24,8 @@ import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import io.element.android.compound.theme.ElementTheme
import io.element.android.compound.tokens.generated.CompoundIcons
import io.element.android.libraries.designsystem.preview.ElementPreview
import io.element.android.libraries.designsystem.preview.PreviewsDayNight
import io.element.android.libraries.designsystem.text.toDp
import io.element.android.libraries.designsystem.theme.components.Icon
import io.element.android.libraries.designsystem.theme.components.Text
@ -37,24 +38,29 @@ internal fun Indicator(
Row(
modifier
.fillMaxWidth()
.background(MaterialTheme.colorScheme.secondaryContainer)
.background(ElementTheme.colors.bgSubtlePrimary)
.statusBarsPadding()
.padding(vertical = 6.dp),
horizontalArrangement = Arrangement.Center,
verticalAlignment = Alignment.CenterVertically,
) {
val tint = MaterialTheme.colorScheme.primary
Icon(
imageVector = CompoundIcons.Offline(),
contentDescription = null,
tint = tint,
tint = ElementTheme.colors.iconPrimary,
modifier = Modifier.size(16.sp.toDp()),
)
Spacer(modifier = Modifier.width(8.dp))
Text(
text = stringResource(CommonStrings.common_offline),
style = ElementTheme.typography.fontBodyMdMedium,
color = tint,
color = ElementTheme.colors.textPrimary,
)
}
}
@PreviewsDayNight
@Composable
internal fun IndicatorPreview() = ElementPreview {
Indicator()
}

View file

@ -103,14 +103,14 @@ private fun OnBoardingContent(state: OnBoardingState) {
) {
Text(
text = stringResource(id = R.string.screen_onboarding_welcome_title),
color = ElementTheme.materialColors.primary,
color = ElementTheme.colors.textPrimary,
style = ElementTheme.typography.fontHeadingLgBold,
textAlign = TextAlign.Center
)
Spacer(modifier = Modifier.height(8.dp))
Text(
text = stringResource(id = R.string.screen_onboarding_welcome_message, state.productionApplicationName),
color = ElementTheme.materialColors.secondary,
color = ElementTheme.colors.textSecondary,
style = ElementTheme.typography.fontBodyLgRegular.copy(fontSize = 17.sp),
textAlign = TextAlign.Center
)

View file

@ -24,7 +24,6 @@ import androidx.compose.foundation.pager.HorizontalPager
import androidx.compose.foundation.pager.rememberPagerState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.SingleChoiceSegmentedButtonRow
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
@ -236,7 +235,7 @@ private fun PollHistoryItemRow(
Column(modifier = Modifier.padding(16.dp)) {
Text(
text = pollHistoryItem.formattedDate,
color = MaterialTheme.colorScheme.secondary,
color = ElementTheme.colors.textSecondary,
style = ElementTheme.typography.fontBodySmRegular,
)
Spacer(modifier = Modifier.height(4.dp))

View file

@ -262,7 +262,7 @@ private fun ColumnScope.Footer(
textAlign = TextAlign.Center,
text = text,
style = ElementTheme.typography.fontBodySmRegular,
color = ElementTheme.materialColors.secondary,
color = ElementTheme.colors.textSecondary,
)
}

View file

@ -14,7 +14,6 @@ import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
@ -25,6 +24,7 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.PreviewParameter
import androidx.compose.ui.unit.dp
import io.element.android.compound.theme.ElementTheme
import io.element.android.libraries.architecture.AsyncData
import io.element.android.libraries.designsystem.atomic.atoms.PlaceholderAtom
import io.element.android.libraries.designsystem.atomic.atoms.RoomPreviewTitleAtom
@ -127,7 +127,7 @@ private fun RoomAliasResolverContent(
Text(
text = stringResource(id = R.string.screen_room_alias_resolver_resolve_alias_failure),
textAlign = TextAlign.Center,
color = MaterialTheme.colorScheme.error,
color = ElementTheme.colors.textCriticalPrimary,
)
}
},

View file

@ -424,7 +424,7 @@ private fun TitleAndSubtitle(
Text(
text = subtitle,
style = ElementTheme.typography.fontBodyLgRegular,
color = MaterialTheme.colorScheme.secondary,
color = ElementTheme.colors.textSecondary,
textAlign = TextAlign.Center,
)
}

View file

@ -26,7 +26,6 @@ import androidx.compose.foundation.lazy.LazyListScope
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.SingleChoiceSegmentedButtonRow
import androidx.compose.runtime.Composable
import androidx.compose.runtime.SideEffect
@ -278,7 +277,7 @@ private fun LazyListScope.roomMemberListSection(
modifier = Modifier.padding(horizontal = 16.dp, vertical = 12.dp),
text = it(),
style = ElementTheme.typography.fontBodyLgRegular,
color = MaterialTheme.colorScheme.secondary,
color = ElementTheme.colors.textSecondary,
)
}
}

View file

@ -13,7 +13,6 @@ import androidx.compose.foundation.layout.consumeWindowInsets
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
@ -111,7 +110,7 @@ private fun RoomSpecificNotificationSettingsView(
.padding(start = 16.dp, bottom = 16.dp, end = 16.dp),
style = ElementTheme.typography.fontBodyMdRegular
.copy(
color = MaterialTheme.colorScheme.secondary,
color = ElementTheme.colors.textSecondary,
)
)
if (state.defaultRoomNotificationMode != null) {

View file

@ -29,7 +29,6 @@ import androidx.compose.foundation.lazy.LazyListState
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.lazy.rememberLazyListState
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
@ -356,7 +355,7 @@ private fun MemberRow(
text = name,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
color = MaterialTheme.colorScheme.primary,
color = ElementTheme.colors.textPrimary,
style = ElementTheme.typography.fontBodyLgRegular,
)
// Invitation pending marker
@ -365,7 +364,7 @@ private fun MemberRow(
modifier = Modifier.padding(start = 8.dp),
text = stringResource(id = R.string.screen_room_member_list_pending_header_title),
style = ElementTheme.typography.fontBodySmRegular.copy(fontStyle = FontStyle.Italic),
color = MaterialTheme.colorScheme.secondary
color = ElementTheme.colors.textSecondary
)
}
}
@ -373,7 +372,7 @@ private fun MemberRow(
userId?.let {
Text(
text = userId,
color = MaterialTheme.colorScheme.secondary,
color = ElementTheme.colors.textSecondary,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
style = ElementTheme.typography.fontBodySmRegular,

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
)

View file

@ -13,7 +13,6 @@ import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
@ -72,7 +71,7 @@ fun UserProfileHeaderSection(
Text(
text = userId.value,
style = ElementTheme.typography.fontBodyLgRegular,
color = MaterialTheme.colorScheme.secondary,
color = ElementTheme.colors.textSecondary,
textAlign = TextAlign.Center,
)
if (isUserVerified.dataOrNull() == true) {

View file

@ -18,7 +18,6 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.widthIn
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
@ -49,7 +48,7 @@ internal fun VerificationContentVerifying(
modifier = Modifier.fillMaxWidth(),
text = text,
style = ElementTheme.typography.fontHeadingLgBold,
color = MaterialTheme.colorScheme.primary,
color = ElementTheme.colors.textPrimary,
textAlign = TextAlign.Center,
)
}
@ -86,7 +85,7 @@ private fun EmojiItemView(emoji: VerificationEmoji, modifier: Modifier = Modifie
Text(
text = stringResource(id = emojiResource.nameRes),
style = ElementTheme.typography.fontBodyMdRegular,
color = MaterialTheme.colorScheme.secondary,
color = ElementTheme.colors.textSecondary,
maxLines = 1,
overflow = TextOverflow.Ellipsis,
)