mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 21:32:34 +00:00
Use the blurHash if available, when the thumbnailSource is null, and if not available render the image icon for image file.
This commit is contained in:
+15
-1
@@ -22,6 +22,7 @@ import androidx.compose.foundation.layout.Box
|
|||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.outlined.GraphicEq
|
import androidx.compose.material.icons.outlined.GraphicEq
|
||||||
|
import androidx.compose.material.icons.outlined.Image
|
||||||
import androidx.compose.material.icons.outlined.VideoCameraBack
|
import androidx.compose.material.icons.outlined.VideoCameraBack
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
@@ -57,12 +58,26 @@ fun AttachmentThumbnail(
|
|||||||
contentScale = ContentScale.Crop,
|
contentScale = ContentScale.Crop,
|
||||||
modifier = modifier,
|
modifier = modifier,
|
||||||
)
|
)
|
||||||
|
} else if (info.blurHash != null) {
|
||||||
|
BlurHashAsyncImage(
|
||||||
|
model = null,
|
||||||
|
blurHash = info.blurHash,
|
||||||
|
contentDescription = info.textContent,
|
||||||
|
contentScale = ContentScale.Crop,
|
||||||
|
modifier = modifier,
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
Box(
|
Box(
|
||||||
modifier = modifier.background(backgroundColor),
|
modifier = modifier.background(backgroundColor),
|
||||||
contentAlignment = Alignment.Center
|
contentAlignment = Alignment.Center
|
||||||
) {
|
) {
|
||||||
when (info.type) {
|
when (info.type) {
|
||||||
|
AttachmentThumbnailType.Image -> {
|
||||||
|
Icon(
|
||||||
|
imageVector = Icons.Outlined.Image,
|
||||||
|
contentDescription = info.textContent,
|
||||||
|
)
|
||||||
|
}
|
||||||
AttachmentThumbnailType.Video -> {
|
AttachmentThumbnailType.Video -> {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = Icons.Outlined.VideoCameraBack,
|
imageVector = Icons.Outlined.VideoCameraBack,
|
||||||
@@ -93,7 +108,6 @@ fun AttachmentThumbnail(
|
|||||||
modifier = Modifier.fillMaxSize()
|
modifier = Modifier.fillMaxSize()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
else -> Unit
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user