mirror of
https://github.com/oxen-io/session-android.git
synced 2025-02-20 20:08:57 +00:00
Fix BorderlessButtonWithIcon
This commit is contained in:
parent
f8e3bc7d9a
commit
6df63b034c
@ -12,12 +12,9 @@ import androidx.compose.foundation.layout.Column
|
|||||||
import androidx.compose.foundation.layout.fillMaxHeight
|
import androidx.compose.foundation.layout.fillMaxHeight
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.width
|
|
||||||
import androidx.compose.foundation.pager.HorizontalPager
|
import androidx.compose.foundation.pager.HorizontalPager
|
||||||
import androidx.compose.foundation.pager.rememberPagerState
|
import androidx.compose.foundation.pager.rememberPagerState
|
||||||
import androidx.compose.material.LocalContentAlpha
|
|
||||||
import androidx.compose.material.MaterialTheme
|
import androidx.compose.material.MaterialTheme
|
||||||
import androidx.compose.material.Text
|
|
||||||
import androidx.compose.material.primarySurface
|
import androidx.compose.material.primarySurface
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.collectAsState
|
import androidx.compose.runtime.collectAsState
|
||||||
@ -52,7 +49,6 @@ import org.thoughtcrime.securesms.ui.LoadingArcOr
|
|||||||
import org.thoughtcrime.securesms.ui.LocalDimensions
|
import org.thoughtcrime.securesms.ui.LocalDimensions
|
||||||
import org.thoughtcrime.securesms.ui.PreviewTheme
|
import org.thoughtcrime.securesms.ui.PreviewTheme
|
||||||
import org.thoughtcrime.securesms.ui.ThemeResPreviewParameterProvider
|
import org.thoughtcrime.securesms.ui.ThemeResPreviewParameterProvider
|
||||||
import org.thoughtcrime.securesms.ui.baseBold
|
|
||||||
import org.thoughtcrime.securesms.ui.classicDarkColors
|
import org.thoughtcrime.securesms.ui.classicDarkColors
|
||||||
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
|
||||||
@ -166,7 +162,7 @@ fun EnterAccountId(
|
|||||||
error = state.error?.string(),
|
error = state.error?.string(),
|
||||||
)
|
)
|
||||||
if (state.error == null) {
|
if (state.error == null) {
|
||||||
BorderlessButtonSecondary(
|
BorderlessButtonWithIcon(
|
||||||
text = stringResource(R.string.messageNewDescription),
|
text = stringResource(R.string.messageNewDescription),
|
||||||
iconRes = R.drawable.ic_circle_question_mark,
|
iconRes = R.drawable.ic_circle_question_mark,
|
||||||
contentColor = classicDarkColors[5],
|
contentColor = classicDarkColors[5],
|
||||||
|
@ -36,11 +36,11 @@ class NewMessageViewModel @Inject constructor(
|
|||||||
private val _qrErrors = Channel<String>()
|
private val _qrErrors = Channel<String>()
|
||||||
val qrErrors: Flow<String> = _qrErrors.receiveAsFlow()
|
val qrErrors: Flow<String> = _qrErrors.receiveAsFlow()
|
||||||
|
|
||||||
private var job: Job? = null
|
private var loadOnsJob: Job? = null
|
||||||
|
|
||||||
override fun onChange(value: String) {
|
override fun onChange(value: String) {
|
||||||
job?.cancel()
|
loadOnsJob?.cancel()
|
||||||
job = null
|
loadOnsJob = null
|
||||||
|
|
||||||
_state.update { State(newMessageIdOrOns = value) }
|
_state.update { State(newMessageIdOrOns = value) }
|
||||||
}
|
}
|
||||||
@ -58,7 +58,7 @@ class NewMessageViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun createPrivateChatIfPossible(onsNameOrPublicKey: String) {
|
private fun createPrivateChatIfPossible(onsNameOrPublicKey: String) {
|
||||||
if (job?.isActive == true) return
|
if (loadOnsJob?.isActive == true) return
|
||||||
|
|
||||||
if (PublicKeyValidation.isValid(onsNameOrPublicKey, isPrefixRequired = false)) {
|
if (PublicKeyValidation.isValid(onsNameOrPublicKey, isPrefixRequired = false)) {
|
||||||
if (PublicKeyValidation.hasValidPrefix(onsNameOrPublicKey)) {
|
if (PublicKeyValidation.hasValidPrefix(onsNameOrPublicKey)) {
|
||||||
@ -70,7 +70,7 @@ class NewMessageViewModel @Inject constructor(
|
|||||||
// This could be an ONS name
|
// This could be an ONS name
|
||||||
_state.update { it.copy(error = null, loading = true) }
|
_state.update { it.copy(error = null, loading = true) }
|
||||||
|
|
||||||
job = viewModelScope.launch(Dispatchers.IO) {
|
loadOnsJob = viewModelScope.launch(Dispatchers.IO) {
|
||||||
try {
|
try {
|
||||||
withTimeout(5.seconds) {
|
withTimeout(5.seconds) {
|
||||||
SnodeAPI.getSessionID(onsNameOrPublicKey).get()
|
SnodeAPI.getSessionID(onsNameOrPublicKey).get()
|
||||||
|
@ -105,7 +105,7 @@ fun OutlineButton(
|
|||||||
onClick = onClick,
|
onClick = onClick,
|
||||||
border = BorderStroke(1.dp, LocalButtonColor.current),
|
border = BorderStroke(1.dp, LocalButtonColor.current),
|
||||||
colors = ButtonDefaults.outlinedButtonColors(
|
colors = ButtonDefaults.outlinedButtonColors(
|
||||||
contentColor = LocalButtonColor.current,
|
contentColor = if (enabled) LocalButtonColor.current else Color.Unspecified,
|
||||||
backgroundColor = Color.Unspecified
|
backgroundColor = Color.Unspecified
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
@ -200,20 +200,6 @@ fun FilledButton(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun BorderlessButtonSecondary(
|
|
||||||
text: String,
|
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
onClick: () -> Unit
|
|
||||||
) {
|
|
||||||
BorderlessButton(
|
|
||||||
text,
|
|
||||||
modifier = modifier,
|
|
||||||
contentColor = MaterialTheme.colors.onSurface.copy(ContentAlpha.medium),
|
|
||||||
onClick = onClick
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun BorderlessButton(
|
fun BorderlessButton(
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user