mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-28 04:34:21 +01:00
Migrate Help Settings Fragment to Compose
This commit is contained in:
@@ -48,6 +48,45 @@ import org.signal.core.ui.compose.Rows.TextAndLabel
|
||||
|
||||
object Rows {
|
||||
|
||||
/**
|
||||
* Link row that positions [text] and optional [label] in a [TextAndLabel] to the side of an [icon] on the right.
|
||||
*/
|
||||
@OptIn(ExperimentalFoundationApi::class)
|
||||
@Composable
|
||||
fun LinkRow(
|
||||
text: String,
|
||||
onClick: (() -> Unit)? = null,
|
||||
modifier: Modifier = Modifier,
|
||||
label: String? = null,
|
||||
textColor: Color = MaterialTheme.colorScheme.onSurface,
|
||||
enabled: Boolean = true,
|
||||
icon: ImageVector
|
||||
) {
|
||||
Row(
|
||||
modifier = modifier
|
||||
.fillMaxWidth()
|
||||
.clickable(
|
||||
enabled = enabled,
|
||||
onClick = onClick ?: {}
|
||||
)
|
||||
.padding(defaultPadding()),
|
||||
verticalAlignment = CenterVertically
|
||||
) {
|
||||
TextAndLabel(
|
||||
text = text,
|
||||
label = label,
|
||||
textColor = textColor,
|
||||
enabled = enabled,
|
||||
modifier = Modifier.padding(end = 16.dp)
|
||||
)
|
||||
|
||||
Icon(
|
||||
imageVector = icon,
|
||||
contentDescription = null
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A row consisting of a radio button and [text] and optional [label] in a [TextAndLabel].
|
||||
*/
|
||||
@@ -293,7 +332,7 @@ object Rows {
|
||||
*/
|
||||
@Composable
|
||||
fun RowScope.TextAndLabel(
|
||||
text: String,
|
||||
text: String? = null,
|
||||
modifier: Modifier = Modifier,
|
||||
label: String? = null,
|
||||
enabled: Boolean = true,
|
||||
@@ -305,11 +344,13 @@ object Rows {
|
||||
.alpha(if (enabled) 1f else 0.4f)
|
||||
.weight(1f)
|
||||
) {
|
||||
Text(
|
||||
text = text,
|
||||
style = textStyle,
|
||||
color = textColor
|
||||
)
|
||||
if (text != null) {
|
||||
Text(
|
||||
text = text,
|
||||
style = textStyle,
|
||||
color = textColor
|
||||
)
|
||||
}
|
||||
|
||||
if (label != null) {
|
||||
Text(
|
||||
|
||||
Reference in New Issue
Block a user