Improving sizes of blurhashes
This commit is contained in:
@@ -22,6 +22,7 @@ import androidx.compose.foundation.layout.ExperimentalLayoutApi
|
|||||||
import androidx.compose.foundation.layout.FlowRow
|
import androidx.compose.foundation.layout.FlowRow
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.Spacer
|
import androidx.compose.foundation.layout.Spacer
|
||||||
|
import androidx.compose.foundation.layout.aspectRatio
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.height
|
import androidx.compose.foundation.layout.height
|
||||||
@@ -489,13 +490,31 @@ private fun AddedImageFeatures(
|
|||||||
verifiedModifier: Modifier,
|
verifiedModifier: Modifier,
|
||||||
showImage: MutableState<Boolean>
|
showImage: MutableState<Boolean>
|
||||||
) {
|
) {
|
||||||
|
val ratio = remember {
|
||||||
|
aspectRatio(content.dim)
|
||||||
|
}
|
||||||
|
|
||||||
if (!showImage.value) {
|
if (!showImage.value) {
|
||||||
ImageUrlWithDownloadButton(content.uri, showImage)
|
if (content.blurhash != null && ratio != null) {
|
||||||
|
DisplayBlurHash(content.blurhash, content.description, ContentScale.Crop, myModifier.aspectRatio(ratio))
|
||||||
|
IconButton(
|
||||||
|
modifier = Modifier.size(Size75dp),
|
||||||
|
onClick = { showImage.value = true }
|
||||||
|
) {
|
||||||
|
DownloadForOfflineIcon(Size75dp, Color.White)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
ImageUrlWithDownloadButton(content.uri, showImage)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
when (painter.value) {
|
when (painter.value) {
|
||||||
null, is AsyncImagePainter.State.Loading -> {
|
null, is AsyncImagePainter.State.Loading -> {
|
||||||
if (content.blurhash != null) {
|
if (content.blurhash != null) {
|
||||||
DisplayBlurHash(content.blurhash, content.description, contentScale, myModifier)
|
if (ratio != null) {
|
||||||
|
DisplayBlurHash(content.blurhash, content.description, ContentScale.Crop, myModifier.aspectRatio(ratio))
|
||||||
|
} else {
|
||||||
|
DisplayBlurHash(content.blurhash, content.description, contentScale, myModifier)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
FlowRow() {
|
FlowRow() {
|
||||||
DisplayUrlWithLoadingSymbol(content)
|
DisplayUrlWithLoadingSymbol(content)
|
||||||
@@ -529,9 +548,13 @@ private fun AddedImageFeatures(
|
|||||||
verifiedModifier: Modifier,
|
verifiedModifier: Modifier,
|
||||||
showImage: MutableState<Boolean>
|
showImage: MutableState<Boolean>
|
||||||
) {
|
) {
|
||||||
|
val ratio = remember {
|
||||||
|
aspectRatio(content.dim)
|
||||||
|
}
|
||||||
|
|
||||||
if (!showImage.value) {
|
if (!showImage.value) {
|
||||||
if (content.blurhash != null) {
|
if (content.blurhash != null && ratio != null) {
|
||||||
DisplayBlurHash(content.blurhash, content.description, contentScale, myModifier)
|
DisplayBlurHash(content.blurhash, content.description, ContentScale.Crop, myModifier.aspectRatio(ratio))
|
||||||
IconButton(
|
IconButton(
|
||||||
modifier = Modifier.size(Size75dp),
|
modifier = Modifier.size(Size75dp),
|
||||||
onClick = { showImage.value = true }
|
onClick = { showImage.value = true }
|
||||||
@@ -549,7 +572,11 @@ private fun AddedImageFeatures(
|
|||||||
when (painter.value) {
|
when (painter.value) {
|
||||||
null, is AsyncImagePainter.State.Loading -> {
|
null, is AsyncImagePainter.State.Loading -> {
|
||||||
if (content.blurhash != null) {
|
if (content.blurhash != null) {
|
||||||
DisplayBlurHash(content.blurhash, content.description, contentScale, myModifier)
|
if (ratio != null) {
|
||||||
|
DisplayBlurHash(content.blurhash, content.description, ContentScale.Crop, myModifier.aspectRatio(ratio))
|
||||||
|
} else {
|
||||||
|
DisplayBlurHash(content.blurhash, content.description, contentScale, myModifier)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
FlowRow(Modifier.fillMaxWidth()) {
|
FlowRow(Modifier.fillMaxWidth()) {
|
||||||
DisplayUrlWithLoadingSymbol(content)
|
DisplayUrlWithLoadingSymbol(content)
|
||||||
|
|||||||
Reference in New Issue
Block a user