Remember's modifiers in animations
This commit is contained in:
@@ -840,8 +840,8 @@ private fun MuteButton(
|
|||||||
AnimatedVisibility(
|
AnimatedVisibility(
|
||||||
visible = holdOn.value || controllerVisible.value,
|
visible = holdOn.value || controllerVisible.value,
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
enter = fadeIn(),
|
enter = remember { fadeIn() },
|
||||||
exit = fadeOut()
|
exit = remember { fadeOut() }
|
||||||
) {
|
) {
|
||||||
Box(modifier = VolumeBottomIconSize) {
|
Box(modifier = VolumeBottomIconSize) {
|
||||||
Box(
|
Box(
|
||||||
@@ -881,8 +881,8 @@ private fun KeepPlayingButton(
|
|||||||
AnimatedVisibility(
|
AnimatedVisibility(
|
||||||
visible = controllerVisible.value,
|
visible = controllerVisible.value,
|
||||||
modifier = alignment,
|
modifier = alignment,
|
||||||
enter = fadeIn(),
|
enter = remember { fadeIn() },
|
||||||
exit = fadeOut()
|
exit = remember { fadeOut() }
|
||||||
) {
|
) {
|
||||||
Box(modifier = PinBottomIconSize) {
|
Box(modifier = PinBottomIconSize) {
|
||||||
Box(
|
Box(
|
||||||
|
|||||||
@@ -726,8 +726,8 @@ private fun DialogContent(
|
|||||||
|
|
||||||
AnimatedVisibility(
|
AnimatedVisibility(
|
||||||
visible = holdOn.value || controllerVisible.value,
|
visible = holdOn.value || controllerVisible.value,
|
||||||
enter = fadeIn(),
|
enter = remember { fadeIn() },
|
||||||
exit = fadeOut()
|
exit = remember { fadeOut() }
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ import androidx.compose.runtime.remember
|
|||||||
import androidx.compose.runtime.rememberCoroutineScope
|
import androidx.compose.runtime.rememberCoroutineScope
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
|
import androidx.compose.ui.Alignment.Companion.BottomEnd
|
||||||
import androidx.compose.ui.Alignment.Companion.CenterVertically
|
import androidx.compose.ui.Alignment.Companion.CenterVertically
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.draw.clip
|
import androidx.compose.ui.draw.clip
|
||||||
@@ -70,6 +71,7 @@ import androidx.compose.ui.text.AnnotatedString
|
|||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.text.style.TextAlign
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
import androidx.compose.ui.text.style.TextOverflow
|
import androidx.compose.ui.text.style.TextOverflow
|
||||||
|
import androidx.compose.ui.tooling.preview.Preview
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import androidx.core.graphics.drawable.toBitmap
|
import androidx.core.graphics.drawable.toBitmap
|
||||||
@@ -2861,21 +2863,16 @@ private fun RepostNoteAuthorPicture(
|
|||||||
accountViewModel: AccountViewModel,
|
accountViewModel: AccountViewModel,
|
||||||
nav: (String) -> Unit
|
nav: (String) -> Unit
|
||||||
) {
|
) {
|
||||||
Box(modifier = Size55Modifier) {
|
GenericRepostSection(
|
||||||
Box(Size35Modifier.align(Alignment.TopStart)) {
|
baseAuthorPicture = {
|
||||||
NoteAuthorPicture(
|
NoteAuthorPicture(
|
||||||
baseNote = baseNote,
|
baseNote = baseNote,
|
||||||
nav = nav,
|
nav = nav,
|
||||||
accountViewModel = accountViewModel,
|
accountViewModel = accountViewModel,
|
||||||
size = Size34dp
|
size = Size34dp
|
||||||
)
|
)
|
||||||
}
|
},
|
||||||
|
repostAuthorPicture = {
|
||||||
Box(Size18Modifier.align(Alignment.BottomStart).padding(1.dp)) {
|
|
||||||
RepostedIcon(modifier = Size18Modifier, MaterialTheme.colorScheme.placeholderText)
|
|
||||||
}
|
|
||||||
|
|
||||||
Box(Size35Modifier.align(Alignment.BottomEnd)) {
|
|
||||||
NoteAuthorPicture(
|
NoteAuthorPicture(
|
||||||
baseNote = baseRepost,
|
baseNote = baseRepost,
|
||||||
nav = nav,
|
nav = nav,
|
||||||
@@ -2883,6 +2880,39 @@ private fun RepostNoteAuthorPicture(
|
|||||||
size = Size34dp
|
size = Size34dp
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
@Preview
|
||||||
|
private fun GenericRepostSectionPreview() {
|
||||||
|
GenericRepostSection(
|
||||||
|
baseAuthorPicture = {
|
||||||
|
Text("ab")
|
||||||
|
},
|
||||||
|
repostAuthorPicture = {
|
||||||
|
Text("cd")
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
private fun GenericRepostSection(
|
||||||
|
baseAuthorPicture: @Composable () -> Unit,
|
||||||
|
repostAuthorPicture: @Composable () -> Unit
|
||||||
|
) {
|
||||||
|
Box(modifier = Size55Modifier) {
|
||||||
|
Box(remember { Size35Modifier.align(Alignment.TopStart) }) {
|
||||||
|
baseAuthorPicture()
|
||||||
|
}
|
||||||
|
|
||||||
|
Box(remember { Size18Modifier.align(Alignment.BottomStart).padding(1.dp) }) {
|
||||||
|
RepostedIcon(modifier = Size18Modifier, MaterialTheme.colorScheme.placeholderText)
|
||||||
|
}
|
||||||
|
|
||||||
|
Box(remember { Size35Modifier.align(Alignment.BottomEnd) }, contentAlignment = BottomEnd) {
|
||||||
|
repostAuthorPicture()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ fun NoteAuthorPicture(
|
|||||||
) {
|
) {
|
||||||
val author by baseNote.live().authorChanges.observeAsState(baseNote.author)
|
val author by baseNote.live().authorChanges.observeAsState(baseNote.author)
|
||||||
|
|
||||||
Crossfade(targetState = author) {
|
Crossfade(targetState = author, label = "NoteAuthorPicture") {
|
||||||
if (it == null) {
|
if (it == null) {
|
||||||
DisplayBlankAuthor(size, modifier)
|
DisplayBlankAuthor(size, modifier)
|
||||||
} else {
|
} else {
|
||||||
@@ -351,8 +351,8 @@ fun ObserveAndDisplayFollowingMark(userHex: String, iconSize: Dp, accountViewMod
|
|||||||
WatchUserFollows(userHex, accountViewModel) { newFollowingState ->
|
WatchUserFollows(userHex, accountViewModel) { newFollowingState ->
|
||||||
AnimatedVisibility(
|
AnimatedVisibility(
|
||||||
visible = newFollowingState,
|
visible = newFollowingState,
|
||||||
enter = fadeIn(),
|
enter = remember { fadeIn() },
|
||||||
exit = fadeOut()
|
exit = remember { fadeOut() }
|
||||||
) {
|
) {
|
||||||
Box(contentAlignment = Alignment.TopEnd) {
|
Box(contentAlignment = Alignment.TopEnd) {
|
||||||
FollowingIcon(iconSize)
|
FollowingIcon(iconSize)
|
||||||
|
|||||||
@@ -331,8 +331,8 @@ fun MainScreen(
|
|||||||
floatingActionButton = {
|
floatingActionButton = {
|
||||||
AnimatedVisibility(
|
AnimatedVisibility(
|
||||||
visible = shouldShow.value,
|
visible = shouldShow.value,
|
||||||
enter = scaleIn(),
|
enter = remember { scaleIn() },
|
||||||
exit = scaleOut()
|
exit = remember { scaleOut() }
|
||||||
) {
|
) {
|
||||||
Box(
|
Box(
|
||||||
Size55Modifier
|
Size55Modifier
|
||||||
|
|||||||
Reference in New Issue
Block a user