fix: continue not to animate avatars
Signed-off-by: Infi <infi@infi.sh>
This commit is contained in:
parent
872940900a
commit
bcfdcd6496
|
|
@ -21,7 +21,8 @@ fun RemoteImage(
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
contentScale: ContentScale = ContentScale.Crop,
|
contentScale: ContentScale = ContentScale.Crop,
|
||||||
width: Int = 0,
|
width: Int = 0,
|
||||||
height: Int = 0
|
height: Int = 0,
|
||||||
|
allowAnimation: Boolean = true
|
||||||
) {
|
) {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
|
|
||||||
|
|
@ -41,6 +42,9 @@ fun RemoteImage(
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
.width(pxAsDp(width))
|
.width(pxAsDp(width))
|
||||||
.height(pxAsDp(height)),
|
.height(pxAsDp(height)),
|
||||||
transition = CrossFade
|
transition = CrossFade,
|
||||||
|
requestBuilderTransform = { rb ->
|
||||||
|
if (!allowAnimation) rb.dontAnimate() else rb
|
||||||
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -91,6 +91,7 @@ fun UserAvatar(
|
||||||
size: Dp = 40.dp,
|
size: Dp = 40.dp,
|
||||||
presenceSize: Dp = 16.dp,
|
presenceSize: Dp = 16.dp,
|
||||||
shape: Shape = RoundedCornerShape(LoadedSettings.avatarRadius),
|
shape: Shape = RoundedCornerShape(LoadedSettings.avatarRadius),
|
||||||
|
allowAnimation: Boolean = false,
|
||||||
onLongClick: (() -> Unit)? = null,
|
onLongClick: (() -> Unit)? = null,
|
||||||
onClick: (() -> Unit)? = null
|
onClick: (() -> Unit)? = null
|
||||||
) {
|
) {
|
||||||
|
|
@ -104,6 +105,7 @@ fun UserAvatar(
|
||||||
url = rawUrl ?: "$REVOLT_FILES/avatars/${avatar.id}",
|
url = rawUrl ?: "$REVOLT_FILES/avatars/${avatar.id}",
|
||||||
contentScale = ContentScale.Crop,
|
contentScale = ContentScale.Crop,
|
||||||
description = stringResource(id = R.string.avatar_alt, username),
|
description = stringResource(id = R.string.avatar_alt, username),
|
||||||
|
allowAnimation = allowAnimation,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.clip(shape)
|
.clip(shape)
|
||||||
.size(size)
|
.size(size)
|
||||||
|
|
@ -123,6 +125,7 @@ fun UserAvatar(
|
||||||
RemoteImage(
|
RemoteImage(
|
||||||
url = "$REVOLT_BASE/users/${userId.ifBlank { "0".repeat(26) }}/default_avatar",
|
url = "$REVOLT_BASE/users/${userId.ifBlank { "0".repeat(26) }}/default_avatar",
|
||||||
description = stringResource(id = R.string.avatar_alt, username),
|
description = stringResource(id = R.string.avatar_alt, username),
|
||||||
|
allowAnimation = allowAnimation,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.clip(shape)
|
.clip(shape)
|
||||||
.size(size)
|
.size(size)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue