mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-19 00:01:08 +01:00
Member labels padding, margin, and styling fixes.
This commit is contained in:
committed by
Cody Henthorne
parent
01b56995d9
commit
d798a35c38
@@ -3,7 +3,6 @@ package org.thoughtcrime.securesms.components.settings.conversation.preferences
|
||||
import android.text.SpannableStringBuilder
|
||||
import android.view.View
|
||||
import android.widget.TextView
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
@@ -12,6 +11,7 @@ import org.thoughtcrime.securesms.R
|
||||
import org.thoughtcrime.securesms.badges.BadgeImageView
|
||||
import org.thoughtcrime.securesms.components.AvatarImageView
|
||||
import org.thoughtcrime.securesms.components.settings.PreferenceModel
|
||||
import org.thoughtcrime.securesms.groups.memberlabel.MemberLabelPill
|
||||
import org.thoughtcrime.securesms.groups.memberlabel.MemberLabelPillView
|
||||
import org.thoughtcrime.securesms.groups.memberlabel.StyledMemberLabel
|
||||
import org.thoughtcrime.securesms.recipients.Recipient
|
||||
@@ -125,7 +125,7 @@ object RecipientPreference {
|
||||
style = MemberLabelPillView.Style(
|
||||
horizontalPadding = 8.dp,
|
||||
verticalPadding = 2.dp,
|
||||
textStyle = { MaterialTheme.typography.labelSmall }
|
||||
textStyle = { MemberLabelPill.textStyleCompact }
|
||||
)
|
||||
setLabel(styledLabel.label, styledLabel.tintColor)
|
||||
visible = true
|
||||
|
||||
@@ -22,14 +22,24 @@ import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.compositeOver
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import org.signal.core.ui.compose.DayNightPreviews
|
||||
import org.signal.core.ui.compose.Previews
|
||||
import org.thoughtcrime.securesms.components.emoji.Emojifier
|
||||
|
||||
private val defaultModifier = Modifier.padding(horizontal = 12.dp, vertical = 2.dp)
|
||||
private val defaultTextStyle: @Composable () -> TextStyle = { MaterialTheme.typography.bodyLarge }
|
||||
object MemberLabelPill {
|
||||
@get:Composable
|
||||
val textStyleCompact: TextStyle
|
||||
get() = MaterialTheme.typography.labelSmall.copy(fontWeight = FontWeight.Normal)
|
||||
|
||||
@get:Composable
|
||||
val textStyleNormal: TextStyle
|
||||
get() = MaterialTheme.typography.bodyLarge
|
||||
}
|
||||
|
||||
private val defaultModifier = Modifier.padding(horizontal = 12.dp, vertical = 5.dp)
|
||||
|
||||
/**
|
||||
* Displays member label text with an optional emoji.
|
||||
@@ -40,7 +50,7 @@ fun MemberLabelPill(
|
||||
text: String,
|
||||
tintColor: Color,
|
||||
modifier: Modifier = defaultModifier,
|
||||
textStyle: TextStyle = defaultTextStyle()
|
||||
textStyle: TextStyle = MemberLabelPill.textStyleCompact
|
||||
) {
|
||||
val isDark = isSystemInDarkTheme()
|
||||
val backgroundColor = tintColor.copy(alpha = if (isDark) 0.32f else 0.10f)
|
||||
@@ -71,7 +81,7 @@ fun MemberLabelPill(
|
||||
textColor: Color,
|
||||
backgroundColor: Color,
|
||||
modifier: Modifier = defaultModifier,
|
||||
textStyle: TextStyle = defaultTextStyle()
|
||||
textStyle: TextStyle = MemberLabelPill.textStyleCompact
|
||||
) {
|
||||
val shape = RoundedCornerShape(percent = 50)
|
||||
|
||||
@@ -91,7 +101,7 @@ fun MemberLabelPill(
|
||||
Text(
|
||||
text = annotatedText,
|
||||
inlineContent = inlineContent,
|
||||
modifier = if (text.isNotEmpty()) Modifier.padding(end = 5.dp) else Modifier
|
||||
modifier = if (text.isNotEmpty()) Modifier.padding(end = 4.dp) else Modifier
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import androidx.annotation.ColorInt
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
@@ -65,6 +64,6 @@ class MemberLabelPillView : AbstractComposeView {
|
||||
data class Style(
|
||||
val horizontalPadding: Dp = 12.dp,
|
||||
val verticalPadding: Dp = 2.dp,
|
||||
val textStyle: @Composable () -> TextStyle = { MaterialTheme.typography.bodyLarge }
|
||||
val textStyle: @Composable () -> TextStyle = { MemberLabelPill.textStyleNormal }
|
||||
)
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.signal.core.ui.compose.DayNightPreviews
|
||||
import org.signal.core.ui.compose.Previews
|
||||
import org.thoughtcrime.securesms.components.emoji.Emojifier
|
||||
|
||||
private val defaultLabelModifier = Modifier.padding(horizontal = 6.dp, vertical = 2.dp)
|
||||
private val defaultLabelModifier = Modifier.padding(horizontal = 8.dp, vertical = 2.dp)
|
||||
private val defaultLabelTextStyle: @Composable () -> TextStyle = { MaterialTheme.typography.bodySmall }
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user