mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 21:32:34 +00:00
Update colors of permalinks.
This commit is contained in:
+2
-2
@@ -55,14 +55,14 @@ class MentionSpan(
|
|||||||
|
|
||||||
backgroundColor = when (type) {
|
backgroundColor = when (type) {
|
||||||
is MentionType.User -> if (isCurrentUser) mentionSpanTheme.currentUserBackgroundColor else mentionSpanTheme.otherBackgroundColor
|
is MentionType.User -> if (isCurrentUser) mentionSpanTheme.currentUserBackgroundColor else mentionSpanTheme.otherBackgroundColor
|
||||||
is MentionType.Everyone -> mentionSpanTheme.currentUserBackgroundColor
|
is MentionType.Everyone -> mentionSpanTheme.otherBackgroundColor
|
||||||
is MentionType.Room -> mentionSpanTheme.otherBackgroundColor
|
is MentionType.Room -> mentionSpanTheme.otherBackgroundColor
|
||||||
is MentionType.Message -> mentionSpanTheme.otherBackgroundColor
|
is MentionType.Message -> mentionSpanTheme.otherBackgroundColor
|
||||||
}
|
}
|
||||||
|
|
||||||
textColor = when (type) {
|
textColor = when (type) {
|
||||||
is MentionType.User -> if (isCurrentUser) mentionSpanTheme.currentUserTextColor else mentionSpanTheme.otherTextColor
|
is MentionType.User -> if (isCurrentUser) mentionSpanTheme.currentUserTextColor else mentionSpanTheme.otherTextColor
|
||||||
is MentionType.Everyone -> mentionSpanTheme.currentUserTextColor
|
is MentionType.Everyone -> mentionSpanTheme.otherTextColor
|
||||||
is MentionType.Room -> mentionSpanTheme.otherTextColor
|
is MentionType.Room -> mentionSpanTheme.otherTextColor
|
||||||
is MentionType.Message -> mentionSpanTheme.otherTextColor
|
is MentionType.Message -> mentionSpanTheme.otherTextColor
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-4
@@ -54,6 +54,7 @@ import kotlinx.collections.immutable.persistentListOf
|
|||||||
* To make this work, you need to:
|
* To make this work, you need to:
|
||||||
* 1. Call [MentionSpanTheme.updateStyles] so the colors and sizes are computed.
|
* 1. Call [MentionSpanTheme.updateStyles] so the colors and sizes are computed.
|
||||||
* 2. Use either [MentionSpanTheme.updateMentionStyles] or [MentionSpan.updateTheme] to update the styles of the mention spans.
|
* 2. Use either [MentionSpanTheme.updateMentionStyles] or [MentionSpan.updateTheme] to update the styles of the mention spans.
|
||||||
|
* https://www.figma.com/design/G1xy0HDZKJf5TCRFmKb5d5/Compound-Android-Components?node-id=3236-11203
|
||||||
*/
|
*/
|
||||||
@Stable
|
@Stable
|
||||||
@SingleIn(SessionScope::class)
|
@SingleIn(SessionScope::class)
|
||||||
@@ -61,10 +62,14 @@ class MentionSpanTheme(val currentUserId: UserId) {
|
|||||||
@Inject
|
@Inject
|
||||||
constructor(matrixClient: MatrixClient) : this(matrixClient.sessionId)
|
constructor(matrixClient: MatrixClient) : this(matrixClient.sessionId)
|
||||||
|
|
||||||
internal var currentUserTextColor: Int = 0
|
internal var currentUserTextColor: Int = Color.BLACK
|
||||||
|
private set
|
||||||
internal var currentUserBackgroundColor: Int = Color.WHITE
|
internal var currentUserBackgroundColor: Int = Color.WHITE
|
||||||
internal var otherTextColor: Int = 0
|
private set
|
||||||
|
internal var otherTextColor: Int = Color.BLACK
|
||||||
|
private set
|
||||||
internal var otherBackgroundColor: Int = Color.WHITE
|
internal var otherBackgroundColor: Int = Color.WHITE
|
||||||
|
private set
|
||||||
|
|
||||||
private val paddingValues = PaddingValues(start = 4.dp, end = 6.dp)
|
private val paddingValues = PaddingValues(start = 4.dp, end = 6.dp)
|
||||||
internal val paddingValuesPx = mutableStateOf(0 to 0)
|
internal val paddingValuesPx = mutableStateOf(0 to 0)
|
||||||
@@ -78,8 +83,8 @@ class MentionSpanTheme(val currentUserId: UserId) {
|
|||||||
fun updateStyles() {
|
fun updateStyles() {
|
||||||
currentUserTextColor = ElementTheme.colors.textBadgeAccent.toArgb()
|
currentUserTextColor = ElementTheme.colors.textBadgeAccent.toArgb()
|
||||||
currentUserBackgroundColor = ElementTheme.colors.bgBadgeAccent.toArgb()
|
currentUserBackgroundColor = ElementTheme.colors.bgBadgeAccent.toArgb()
|
||||||
otherTextColor = ElementTheme.colors.textPrimary.toArgb()
|
otherTextColor = ElementTheme.colors.textOnSolidPrimary.toArgb()
|
||||||
otherBackgroundColor = ElementTheme.colors.bgBadgeDefault.toArgb()
|
otherBackgroundColor = ElementTheme.colors.bgBadgePrimary.toArgb()
|
||||||
|
|
||||||
typeface.value = ElementTheme.typography.fontBodyLgMedium.rememberTypeface().value
|
typeface.value = ElementTheme.typography.fontBodyLgMedium.rememberTypeface().value
|
||||||
val density = LocalDensity.current
|
val density = LocalDensity.current
|
||||||
|
|||||||
Reference in New Issue
Block a user