|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
package org.thoughtcrime.securesms.ui
|
|
|
|
|
|
|
|
|
|
import androidx.annotation.DrawableRes
|
|
|
|
|
import androidx.compose.animation.AnimatedVisibility
|
|
|
|
|
import androidx.compose.foundation.BorderStroke
|
|
|
|
|
import androidx.compose.foundation.Canvas
|
|
|
|
|
import androidx.compose.foundation.ScrollState
|
|
|
|
@ -34,7 +35,11 @@ import androidx.compose.material.Text
|
|
|
|
|
import androidx.compose.material.TextButton
|
|
|
|
|
import androidx.compose.runtime.Composable
|
|
|
|
|
import androidx.compose.runtime.LaunchedEffect
|
|
|
|
|
import androidx.compose.runtime.getValue
|
|
|
|
|
import androidx.compose.runtime.mutableStateOf
|
|
|
|
|
import androidx.compose.runtime.remember
|
|
|
|
|
import androidx.compose.runtime.rememberCoroutineScope
|
|
|
|
|
import androidx.compose.runtime.setValue
|
|
|
|
|
import androidx.compose.ui.Alignment
|
|
|
|
|
import androidx.compose.ui.Modifier
|
|
|
|
|
import androidx.compose.ui.draw.alpha
|
|
|
|
@ -58,6 +63,7 @@ import androidx.compose.ui.unit.dp
|
|
|
|
|
import androidx.compose.ui.unit.sp
|
|
|
|
|
import androidx.compose.ui.viewinterop.AndroidView
|
|
|
|
|
import kotlinx.coroutines.CoroutineScope
|
|
|
|
|
import kotlinx.coroutines.delay
|
|
|
|
|
import kotlinx.coroutines.launch
|
|
|
|
|
import network.loki.messenger.R
|
|
|
|
|
import org.session.libsession.utilities.recipients.Recipient
|
|
|
|
@ -66,6 +72,7 @@ import org.thoughtcrime.securesms.components.ProfilePictureView
|
|
|
|
|
import org.thoughtcrime.securesms.conversation.disappearingmessages.ui.OptionsCard
|
|
|
|
|
import kotlin.math.min
|
|
|
|
|
import kotlin.math.roundToInt
|
|
|
|
|
import kotlin.time.Duration.Companion.seconds
|
|
|
|
|
|
|
|
|
|
@Composable
|
|
|
|
|
fun OutlineButton(
|
|
|
|
@ -110,6 +117,42 @@ fun OutlineButton(
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Composable
|
|
|
|
|
fun OutlineButton(
|
|
|
|
|
temporaryContent: @Composable () -> Unit,
|
|
|
|
|
modifier: Modifier = Modifier,
|
|
|
|
|
color: Color = LocalExtraColors.current.prominentButtonColor,
|
|
|
|
|
onClick: () -> Unit = {},
|
|
|
|
|
content: @Composable () -> Unit = {}
|
|
|
|
|
) {
|
|
|
|
|
var clicked by remember { mutableStateOf(false) }
|
|
|
|
|
if (clicked) LaunchedEffectAsync {
|
|
|
|
|
delay(2.seconds)
|
|
|
|
|
clicked = false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
OutlinedButton(
|
|
|
|
|
modifier = modifier,
|
|
|
|
|
onClick = {
|
|
|
|
|
onClick()
|
|
|
|
|
clicked = true
|
|
|
|
|
},
|
|
|
|
|
border = BorderStroke(1.dp, color),
|
|
|
|
|
shape = RoundedCornerShape(percent = 50),
|
|
|
|
|
colors = ButtonDefaults.outlinedButtonColors(
|
|
|
|
|
contentColor = color,
|
|
|
|
|
backgroundColor = Color.Unspecified
|
|
|
|
|
)
|
|
|
|
|
) {
|
|
|
|
|
AnimatedVisibility(clicked) {
|
|
|
|
|
temporaryContent()
|
|
|
|
|
}
|
|
|
|
|
AnimatedVisibility(!clicked) {
|
|
|
|
|
content()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Composable
|
|
|
|
|
fun FilledButton(
|
|
|
|
|
text: String,
|
|
|
|
|