mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-17 07:23:21 +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 }
|
||||
|
||||
/**
|
||||
|
||||
@@ -68,13 +68,15 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="1dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintBottom_toTopOf="@+id/recipient_about"
|
||||
app:layout_constraintEnd_toStartOf="@+id/popupMenuProgressContainer"
|
||||
app:layout_constraintEnd_toStartOf="@+id/admin"
|
||||
app:layout_constraintHorizontal_bias="0"
|
||||
app:layout_constraintStart_toStartOf="@+id/recipient_name"
|
||||
app:layout_constraintTop_toBottomOf="@+id/recipient_name"
|
||||
app:layout_constraintWidth_default="wrap"
|
||||
app:layout_goneMarginEnd="0dp"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<androidx.constraintlayout.widget.Barrier
|
||||
@@ -82,7 +84,7 @@
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
app:barrierDirection="end"
|
||||
app:constraint_referenced_ids="recipient_name,recipient_member_label, recipient_about" />
|
||||
app:constraint_referenced_ids="recipient_name, recipient_about" />
|
||||
|
||||
<org.thoughtcrime.securesms.components.emoji.EmojiTextView
|
||||
android:id="@+id/recipient_about"
|
||||
|
||||
@@ -117,7 +117,7 @@
|
||||
|
||||
<org.thoughtcrime.securesms.groups.memberlabel.MemberLabelPillView
|
||||
android:id="@+id/rbs_member_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="@dimen/dsl_settings_gutter"
|
||||
android:layout_marginTop="6dp"
|
||||
@@ -125,6 +125,7 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/rbs_full_name"
|
||||
app:layout_constraintWidth_default="wrap"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<org.thoughtcrime.securesms.components.emoji.EmojiTextView
|
||||
|
||||
Reference in New Issue
Block a user