mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-27 12:05:22 +00:00
Button in new message is not slim but the regular size
This commit is contained in:
parent
7ae95a953a
commit
7826484320
@ -29,9 +29,9 @@ import org.thoughtcrime.securesms.ui.color.LocalColors
|
|||||||
import org.thoughtcrime.securesms.ui.components.AppBar
|
import org.thoughtcrime.securesms.ui.components.AppBar
|
||||||
import org.thoughtcrime.securesms.ui.components.BorderlessButtonWithIcon
|
import org.thoughtcrime.securesms.ui.components.BorderlessButtonWithIcon
|
||||||
import org.thoughtcrime.securesms.ui.components.MaybeScanQrCode
|
import org.thoughtcrime.securesms.ui.components.MaybeScanQrCode
|
||||||
|
import org.thoughtcrime.securesms.ui.components.OutlineButton
|
||||||
import org.thoughtcrime.securesms.ui.components.SessionOutlinedTextField
|
import org.thoughtcrime.securesms.ui.components.SessionOutlinedTextField
|
||||||
import org.thoughtcrime.securesms.ui.components.SessionTabRow
|
import org.thoughtcrime.securesms.ui.components.SessionTabRow
|
||||||
import org.thoughtcrime.securesms.ui.components.SlimOutlineButton
|
|
||||||
import org.thoughtcrime.securesms.ui.contentDescription
|
import org.thoughtcrime.securesms.ui.contentDescription
|
||||||
|
|
||||||
private val TITLES = listOf(R.string.enter_account_id, R.string.qrScan)
|
private val TITLES = listOf(R.string.enter_account_id, R.string.qrScan)
|
||||||
@ -95,7 +95,7 @@ private fun EnterAccountId(
|
|||||||
.fillMaxWidth(),
|
.fillMaxWidth(),
|
||||||
) { onHelp() }
|
) { onHelp() }
|
||||||
|
|
||||||
SlimOutlineButton(
|
OutlineButton(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.align(Alignment.CenterHorizontally)
|
.align(Alignment.CenterHorizontally)
|
||||||
.padding(horizontal = LocalDimensions.current.marginLarge)
|
.padding(horizontal = LocalDimensions.current.marginLarge)
|
||||||
|
@ -2,6 +2,7 @@ package org.thoughtcrime.securesms.ui.components
|
|||||||
|
|
||||||
import androidx.annotation.DrawableRes
|
import androidx.annotation.DrawableRes
|
||||||
import androidx.compose.animation.AnimatedVisibility
|
import androidx.compose.animation.AnimatedVisibility
|
||||||
|
import androidx.compose.animation.AnimatedVisibilityScope
|
||||||
import androidx.compose.animation.fadeIn
|
import androidx.compose.animation.fadeIn
|
||||||
import androidx.compose.animation.fadeOut
|
import androidx.compose.animation.fadeOut
|
||||||
import androidx.compose.foundation.BorderStroke
|
import androidx.compose.foundation.BorderStroke
|
||||||
@ -122,12 +123,23 @@ fun Button(
|
|||||||
Button(text, onClick, color, ButtonType.Outline, modifier, enabled)
|
Button(text, onClick, color, ButtonType.Outline, modifier, enabled)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Composable fun OutlineButton(modifier: Modifier = Modifier, color: Color = LocalColors.current.buttonOutline, enabled: Boolean = true, onClick: () -> Unit, content: @Composable RowScope.() -> Unit) {
|
||||||
|
Button(
|
||||||
|
onClick = onClick,
|
||||||
|
color = color,
|
||||||
|
type = ButtonType.Outline,
|
||||||
|
modifier = modifier,
|
||||||
|
enabled = enabled,
|
||||||
|
content = content
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
@Composable fun PrimaryOutlineButton(text: String, modifier: Modifier = Modifier, enabled: Boolean = true, onClick: () -> Unit) {
|
@Composable fun PrimaryOutlineButton(text: String, modifier: Modifier = Modifier, enabled: Boolean = true, onClick: () -> Unit) {
|
||||||
Button(text, onClick, LocalColors.current.primary, ButtonType.Outline, modifier, enabled)
|
Button(text, onClick, LocalColors.current.primary, ButtonType.Outline, modifier, enabled)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable fun SlimOutlineButton(onClick: () -> Unit, modifier: Modifier = Modifier, color: Color = LocalColors.current.text, enabled: Boolean = true, content: @Composable () -> Unit) {
|
@Composable fun SlimOutlineButton(onClick: () -> Unit, modifier: Modifier = Modifier, color: Color = LocalColors.current.text, enabled: Boolean = true, content: @Composable RowScope.() -> Unit) {
|
||||||
Button(onClick, color, ButtonType.Outline, modifier, enabled, ButtonStyle.Slim) { content() }
|
Button(onClick, color, ButtonType.Outline, modifier, enabled, ButtonStyle.Slim, content = content)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -174,8 +186,8 @@ fun OutlineCopyButton(
|
|||||||
@Composable
|
@Composable
|
||||||
fun TemporaryClickedContent(
|
fun TemporaryClickedContent(
|
||||||
interactionSource: MutableInteractionSource,
|
interactionSource: MutableInteractionSource,
|
||||||
content: @Composable () -> Unit,
|
content: @Composable AnimatedVisibilityScope.() -> Unit,
|
||||||
temporaryContent: @Composable () -> Unit,
|
temporaryContent: @Composable AnimatedVisibilityScope.() -> Unit,
|
||||||
temporaryDelay: Duration = 2.seconds
|
temporaryDelay: Duration = 2.seconds
|
||||||
) {
|
) {
|
||||||
var clicked by remember { mutableStateOf(false) }
|
var clicked by remember { mutableStateOf(false) }
|
||||||
@ -191,23 +203,18 @@ fun TemporaryClickedContent(
|
|||||||
// Using a Box because the Buttons add children in a Row
|
// Using a Box because the Buttons add children in a Row
|
||||||
// and they will jank as they are added and removed.
|
// and they will jank as they are added and removed.
|
||||||
Box(contentAlignment = Alignment.Center) {
|
Box(contentAlignment = Alignment.Center) {
|
||||||
AnimatedVisibility(!clicked, enter = fadeIn(), exit = fadeOut()) {
|
AnimatedVisibility(!clicked, enter = fadeIn(), exit = fadeOut(), content = content)
|
||||||
content()
|
AnimatedVisibility(clicked, enter = fadeIn(), exit = fadeOut(), content = temporaryContent)
|
||||||
}
|
|
||||||
AnimatedVisibility(clicked, enter = fadeIn(), exit = fadeOut()) {
|
|
||||||
temporaryContent()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun BorderlessButton(
|
fun BorderlessButton(
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
contentColor: Color = LocalColors.current.text,
|
contentColor: Color = LocalColors.current.text,
|
||||||
backgroundColor: Color = Color.Transparent,
|
backgroundColor: Color = Color.Transparent,
|
||||||
onClick: () -> Unit,
|
onClick: () -> Unit,
|
||||||
content: @Composable () -> Unit
|
content: @Composable RowScope.() -> Unit
|
||||||
) {
|
) {
|
||||||
TextButton(
|
TextButton(
|
||||||
onClick = onClick,
|
onClick = onClick,
|
||||||
@ -215,8 +222,9 @@ fun BorderlessButton(
|
|||||||
colors = ButtonDefaults.outlinedButtonColors(
|
colors = ButtonDefaults.outlinedButtonColors(
|
||||||
contentColor = contentColor,
|
contentColor = contentColor,
|
||||||
backgroundColor = backgroundColor
|
backgroundColor = backgroundColor
|
||||||
)
|
),
|
||||||
) { content() }
|
content = content
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
Loading…
Reference in New Issue
Block a user