Merging
This commit is contained in:
@@ -24,8 +24,10 @@ import android.content.Context
|
|||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import androidx.compose.animation.AnimatedContent
|
import androidx.compose.animation.AnimatedContent
|
||||||
import androidx.compose.animation.AnimatedContentTransitionScope
|
import androidx.compose.animation.AnimatedContentTransitionScope
|
||||||
|
import androidx.compose.animation.AnimatedVisibility
|
||||||
import androidx.compose.animation.ContentTransform
|
import androidx.compose.animation.ContentTransform
|
||||||
import androidx.compose.animation.ExperimentalAnimationApi
|
import androidx.compose.animation.ExperimentalAnimationApi
|
||||||
|
import androidx.compose.animation.core.MutableTransitionState
|
||||||
import androidx.compose.animation.core.animateFloatAsState
|
import androidx.compose.animation.core.animateFloatAsState
|
||||||
import androidx.compose.animation.core.tween
|
import androidx.compose.animation.core.tween
|
||||||
import androidx.compose.animation.fadeIn
|
import androidx.compose.animation.fadeIn
|
||||||
@@ -147,6 +149,7 @@ import kotlinx.collections.immutable.persistentSetOf
|
|||||||
import kotlinx.collections.immutable.toImmutableList
|
import kotlinx.collections.immutable.toImmutableList
|
||||||
import kotlinx.collections.immutable.toImmutableSet
|
import kotlinx.collections.immutable.toImmutableSet
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlin.math.roundToInt
|
import kotlin.math.roundToInt
|
||||||
|
|
||||||
@@ -1326,11 +1329,38 @@ fun ReactionChoicePopup(
|
|||||||
.collectAsStateWithLifecycle()
|
.collectAsStateWithLifecycle()
|
||||||
val toRemove = remember { baseNote.reactedBy(accountViewModel.userProfile()).toImmutableSet() }
|
val toRemove = remember { baseNote.reactedBy(accountViewModel.userProfile()).toImmutableSet() }
|
||||||
|
|
||||||
|
// Define animation specs
|
||||||
|
val animationDuration = 250
|
||||||
|
val fadeAnimationSpec = tween<Float>(durationMillis = animationDuration)
|
||||||
|
|
||||||
|
// Prevent multiple calls to onDismiss()
|
||||||
|
var dismissed by remember { mutableStateOf(false) }
|
||||||
|
|
||||||
|
val visibilityState = remember { MutableTransitionState(false).apply { targetState = true } }
|
||||||
|
LaunchedEffect(visibilityState.targetState) {
|
||||||
|
if (!visibilityState.targetState && !dismissed) {
|
||||||
|
delay(animationDuration.toLong())
|
||||||
|
dismissed = true
|
||||||
|
onDismiss()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Popup(
|
Popup(
|
||||||
alignment = Alignment.BottomCenter,
|
alignment = Alignment.BottomCenter,
|
||||||
offset = IntOffset(0, iconSizePx),
|
offset = IntOffset(0, iconSizePx),
|
||||||
onDismissRequest = { onDismiss() },
|
onDismissRequest = { visibilityState.targetState = false },
|
||||||
properties = PopupProperties(focusable = true),
|
properties = PopupProperties(focusable = true),
|
||||||
|
) {
|
||||||
|
AnimatedVisibility(
|
||||||
|
visibleState = visibilityState,
|
||||||
|
enter =
|
||||||
|
slideInVertically(
|
||||||
|
initialOffsetY = { it / 2 },
|
||||||
|
) + fadeIn(animationSpec = fadeAnimationSpec),
|
||||||
|
exit =
|
||||||
|
slideOutVertically(
|
||||||
|
targetOffsetY = { it / 2 },
|
||||||
|
) + fadeOut(animationSpec = fadeAnimationSpec),
|
||||||
) {
|
) {
|
||||||
ReactionChoicePopupContent(
|
ReactionChoicePopupContent(
|
||||||
reactions,
|
reactions,
|
||||||
@@ -1340,11 +1370,12 @@ fun ReactionChoicePopup(
|
|||||||
baseNote,
|
baseNote,
|
||||||
reactionType,
|
reactionType,
|
||||||
)
|
)
|
||||||
onDismiss()
|
visibilityState.targetState = false
|
||||||
},
|
},
|
||||||
onChangeAmount,
|
onChangeAmount,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@OptIn(ExperimentalLayoutApi::class)
|
@OptIn(ExperimentalLayoutApi::class)
|
||||||
@@ -1505,11 +1536,38 @@ fun ZapAmountChoicePopup(
|
|||||||
|
|
||||||
val yOffset = with(LocalDensity.current) { -popupYOffset.toPx().toInt() }
|
val yOffset = with(LocalDensity.current) { -popupYOffset.toPx().toInt() }
|
||||||
|
|
||||||
|
// Define animation specs
|
||||||
|
val animationDuration = 250
|
||||||
|
val fadeAnimationSpec = tween<Float>(durationMillis = animationDuration)
|
||||||
|
|
||||||
|
// Prevent multiple calls to onDismiss()
|
||||||
|
var dismissed by remember { mutableStateOf(false) }
|
||||||
|
|
||||||
|
val visibilityState = remember { MutableTransitionState(false).apply { targetState = true } }
|
||||||
|
LaunchedEffect(visibilityState.targetState) {
|
||||||
|
if (!visibilityState.targetState && !dismissed) {
|
||||||
|
delay(animationDuration.toLong())
|
||||||
|
dismissed = true
|
||||||
|
onDismiss()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Popup(
|
Popup(
|
||||||
alignment = Alignment.BottomCenter,
|
alignment = Alignment.BottomCenter,
|
||||||
offset = IntOffset(0, yOffset),
|
offset = IntOffset(0, yOffset),
|
||||||
onDismissRequest = { onDismiss() },
|
onDismissRequest = { visibilityState.targetState = false },
|
||||||
properties = PopupProperties(focusable = true),
|
properties = PopupProperties(focusable = true),
|
||||||
|
) {
|
||||||
|
AnimatedVisibility(
|
||||||
|
visibleState = visibilityState,
|
||||||
|
enter =
|
||||||
|
slideInVertically(
|
||||||
|
initialOffsetY = { it / 2 },
|
||||||
|
) + fadeIn(animationSpec = fadeAnimationSpec),
|
||||||
|
exit =
|
||||||
|
slideOutVertically(
|
||||||
|
targetOffsetY = { it / 2 },
|
||||||
|
) + fadeOut(animationSpec = fadeAnimationSpec),
|
||||||
) {
|
) {
|
||||||
FlowRow(horizontalArrangement = Arrangement.Center) {
|
FlowRow(horizontalArrangement = Arrangement.Center) {
|
||||||
zapAmountChoices.forEach { amountInSats ->
|
zapAmountChoices.forEach { amountInSats ->
|
||||||
@@ -1527,7 +1585,7 @@ fun ZapAmountChoicePopup(
|
|||||||
onProgress,
|
onProgress,
|
||||||
onPayViaIntent,
|
onPayViaIntent,
|
||||||
)
|
)
|
||||||
onDismiss()
|
visibilityState.targetState = false
|
||||||
},
|
},
|
||||||
shape = ButtonBorder,
|
shape = ButtonBorder,
|
||||||
colors =
|
colors =
|
||||||
@@ -1553,7 +1611,7 @@ fun ZapAmountChoicePopup(
|
|||||||
onProgress,
|
onProgress,
|
||||||
onPayViaIntent,
|
onPayViaIntent,
|
||||||
)
|
)
|
||||||
onDismiss()
|
visibilityState.targetState = false
|
||||||
},
|
},
|
||||||
onLongClick = { onChangeAmount() },
|
onLongClick = { onChangeAmount() },
|
||||||
),
|
),
|
||||||
@@ -1562,6 +1620,7 @@ fun ZapAmountChoicePopup(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun showCount(count: Int?): String {
|
fun showCount(count: Int?): String {
|
||||||
|
|||||||
+22
-2
@@ -20,6 +20,12 @@
|
|||||||
*/
|
*/
|
||||||
package com.vitorpamplona.amethyst.ui.screen.loggedIn.chatrooms
|
package com.vitorpamplona.amethyst.ui.screen.loggedIn.chatrooms
|
||||||
|
|
||||||
|
import androidx.compose.animation.AnimatedVisibility
|
||||||
|
import androidx.compose.animation.core.animateFloatAsState
|
||||||
|
import androidx.compose.animation.fadeIn
|
||||||
|
import androidx.compose.animation.fadeOut
|
||||||
|
import androidx.compose.animation.slideInVertically
|
||||||
|
import androidx.compose.animation.slideOutVertically
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.height
|
import androidx.compose.foundation.layout.height
|
||||||
@@ -38,6 +44,7 @@ import androidx.compose.runtime.remember
|
|||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
|
import androidx.compose.ui.graphics.graphicsLayer
|
||||||
import androidx.compose.ui.text.style.TextAlign
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.vitorpamplona.amethyst.R
|
import com.vitorpamplona.amethyst.R
|
||||||
@@ -76,7 +83,12 @@ fun ChannelFabColumn(
|
|||||||
}
|
}
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
if (isOpen) {
|
AnimatedVisibility(
|
||||||
|
visible = isOpen,
|
||||||
|
enter = slideInVertically(initialOffsetY = { it / 2 }) + fadeIn(),
|
||||||
|
exit = slideOutVertically(targetOffsetY = { it / 2 }) + fadeOut(),
|
||||||
|
) {
|
||||||
|
Column {
|
||||||
FloatingActionButton(
|
FloatingActionButton(
|
||||||
onClick = {
|
onClick = {
|
||||||
wantsToSendNewMessage = true
|
wantsToSendNewMessage = true
|
||||||
@@ -115,6 +127,11 @@ fun ChannelFabColumn(
|
|||||||
|
|
||||||
Spacer(modifier = Modifier.height(20.dp))
|
Spacer(modifier = Modifier.height(20.dp))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val rotationDegree by animateFloatAsState(
|
||||||
|
targetValue = if (isOpen) 45f else 0f,
|
||||||
|
)
|
||||||
|
|
||||||
FloatingActionButton(
|
FloatingActionButton(
|
||||||
onClick = { isOpen = !isOpen },
|
onClick = { isOpen = !isOpen },
|
||||||
@@ -125,7 +142,10 @@ fun ChannelFabColumn(
|
|||||||
Icon(
|
Icon(
|
||||||
imageVector = Icons.Outlined.Add,
|
imageVector = Icons.Outlined.Add,
|
||||||
contentDescription = stringRes(R.string.messages_create_public_private_chat_description),
|
contentDescription = stringRes(R.string.messages_create_public_private_chat_description),
|
||||||
modifier = Modifier.size(26.dp),
|
modifier =
|
||||||
|
Modifier.size(26.dp).graphicsLayer {
|
||||||
|
rotationZ = rotationDegree
|
||||||
|
},
|
||||||
tint = Color.White,
|
tint = Color.White,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
+10
-1
@@ -20,6 +20,11 @@
|
|||||||
*/
|
*/
|
||||||
package com.vitorpamplona.amethyst.ui.screen.loggedIn.notifications
|
package com.vitorpamplona.amethyst.ui.screen.loggedIn.notifications
|
||||||
|
|
||||||
|
import androidx.compose.animation.AnimatedVisibility
|
||||||
|
import androidx.compose.animation.expandVertically
|
||||||
|
import androidx.compose.animation.shrinkVertically
|
||||||
|
import androidx.compose.animation.slideInVertically
|
||||||
|
import androidx.compose.animation.slideOutVertically
|
||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
@@ -73,7 +78,11 @@ fun SummaryBar(state: NotificationSummaryState) {
|
|||||||
|
|
||||||
UserReactionsRow(state) { showChart = !showChart }
|
UserReactionsRow(state) { showChart = !showChart }
|
||||||
|
|
||||||
if (showChart) {
|
AnimatedVisibility(
|
||||||
|
visible = showChart,
|
||||||
|
enter = slideInVertically() + expandVertically(),
|
||||||
|
exit = slideOutVertically() + shrinkVertically(),
|
||||||
|
) {
|
||||||
val lineChartCount =
|
val lineChartCount =
|
||||||
lineChart(
|
lineChart(
|
||||||
lines =
|
lines =
|
||||||
|
|||||||
+33
-1
@@ -25,7 +25,12 @@ import android.net.Uri
|
|||||||
import android.os.Build
|
import android.os.Build
|
||||||
import androidx.activity.compose.rememberLauncherForActivityResult
|
import androidx.activity.compose.rememberLauncherForActivityResult
|
||||||
import androidx.activity.result.contract.ActivityResultContracts
|
import androidx.activity.result.contract.ActivityResultContracts
|
||||||
|
import androidx.compose.animation.AnimatedVisibility
|
||||||
import androidx.compose.animation.core.animateFloatAsState
|
import androidx.compose.animation.core.animateFloatAsState
|
||||||
|
import androidx.compose.animation.fadeIn
|
||||||
|
import androidx.compose.animation.fadeOut
|
||||||
|
import androidx.compose.animation.slideInVertically
|
||||||
|
import androidx.compose.animation.slideOutVertically
|
||||||
import androidx.compose.foundation.background
|
import androidx.compose.foundation.background
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
@@ -36,6 +41,7 @@ import androidx.compose.foundation.shape.CircleShape
|
|||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.filled.AddPhotoAlternate
|
import androidx.compose.material.icons.filled.AddPhotoAlternate
|
||||||
import androidx.compose.material.icons.filled.CameraAlt
|
import androidx.compose.material.icons.filled.CameraAlt
|
||||||
|
import androidx.compose.material.icons.outlined.Close
|
||||||
import androidx.compose.material3.CircularProgressIndicator
|
import androidx.compose.material3.CircularProgressIndicator
|
||||||
import androidx.compose.material3.FloatingActionButton
|
import androidx.compose.material3.FloatingActionButton
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
@@ -186,7 +192,13 @@ fun NewImageButton(
|
|||||||
ShowProgress(postViewModel)
|
ShowProgress(postViewModel)
|
||||||
} else {
|
} else {
|
||||||
Column {
|
Column {
|
||||||
if (isOpen) {
|
// if (isOpen) {
|
||||||
|
AnimatedVisibility(
|
||||||
|
visible = isOpen,
|
||||||
|
enter = slideInVertically(initialOffsetY = { it / 2 }) + fadeIn(),
|
||||||
|
exit = slideOutVertically(targetOffsetY = { it / 2 }) + fadeOut(),
|
||||||
|
) {
|
||||||
|
Column {
|
||||||
FloatingActionButton(
|
FloatingActionButton(
|
||||||
onClick = {
|
onClick = {
|
||||||
wantsToPostFromCamera = true
|
wantsToPostFromCamera = true
|
||||||
@@ -225,6 +237,7 @@ fun NewImageButton(
|
|||||||
|
|
||||||
Spacer(modifier = Modifier.height(20.dp))
|
Spacer(modifier = Modifier.height(20.dp))
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
FloatingActionButton(
|
FloatingActionButton(
|
||||||
onClick = {
|
onClick = {
|
||||||
@@ -233,6 +246,24 @@ fun NewImageButton(
|
|||||||
modifier = Size55Modifier,
|
modifier = Size55Modifier,
|
||||||
shape = CircleShape,
|
shape = CircleShape,
|
||||||
containerColor = MaterialTheme.colorScheme.primary,
|
containerColor = MaterialTheme.colorScheme.primary,
|
||||||
|
) {
|
||||||
|
AnimatedVisibility(
|
||||||
|
visible = isOpen,
|
||||||
|
enter = fadeIn(),
|
||||||
|
exit = fadeOut(),
|
||||||
|
) {
|
||||||
|
Icon(
|
||||||
|
imageVector = Icons.Outlined.Close,
|
||||||
|
contentDescription = stringRes(id = R.string.new_short),
|
||||||
|
modifier = Modifier.size(26.dp),
|
||||||
|
tint = Color.White,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
AnimatedVisibility(
|
||||||
|
visible = !isOpen,
|
||||||
|
enter = fadeIn(),
|
||||||
|
exit = fadeOut(),
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
painter = painterResource(R.drawable.ic_compose),
|
painter = painterResource(R.drawable.ic_compose),
|
||||||
@@ -243,6 +274,7 @@ fun NewImageButton(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|||||||
Reference in New Issue
Block a user