diff --git a/app/src/main/kotlin/org/fossify/gallery/adapters/DirectoryAdapter.kt b/app/src/main/kotlin/org/fossify/gallery/adapters/DirectoryAdapter.kt index b21841f9a..4feca5b69 100644 --- a/app/src/main/kotlin/org/fossify/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/org/fossify/gallery/adapters/DirectoryAdapter.kt @@ -821,6 +821,14 @@ class DirectoryAdapter( else -> ROUNDED_CORNERS_BIG } + dirThumbnail.setBackgroundResource( + when (roundedCorners) { + ROUNDED_CORNERS_SMALL -> R.drawable.placeholder_rounded_small + ROUNDED_CORNERS_BIG -> R.drawable.placeholder_rounded_big + else -> R.drawable.placeholder_square + } + ) + activity.loadImage( type = thumbnailType, path = directory.tmb, diff --git a/app/src/main/kotlin/org/fossify/gallery/adapters/MediaAdapter.kt b/app/src/main/kotlin/org/fossify/gallery/adapters/MediaAdapter.kt index 7362870bb..068fca05f 100644 --- a/app/src/main/kotlin/org/fossify/gallery/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/org/fossify/gallery/adapters/MediaAdapter.kt @@ -656,6 +656,14 @@ class MediaAdapter( else -> ROUNDED_CORNERS_NONE } + mediumThumbnail.setBackgroundResource( + when (roundedCorners) { + ROUNDED_CORNERS_SMALL -> R.drawable.placeholder_rounded_small + ROUNDED_CORNERS_BIG -> R.drawable.placeholder_rounded_big + else -> R.drawable.placeholder_square + } + ) + activity.loadImage( type = medium.type, path = path, diff --git a/app/src/main/kotlin/org/fossify/gallery/extensions/Context.kt b/app/src/main/kotlin/org/fossify/gallery/extensions/Context.kt index 09e1daa35..a03a4f138 100644 --- a/app/src/main/kotlin/org/fossify/gallery/extensions/Context.kt +++ b/app/src/main/kotlin/org/fossify/gallery/extensions/Context.kt @@ -558,7 +558,6 @@ fun Context.loadImageBase( // animation is only supported without rounded corners and the file must be a GIF or WEBP. // Glide doesn't support animated AVIF: https://bumptech.github.io/glide/int/avif.html - // TODO: animate JXL if (animate && roundCorners == ROUNDED_CORNERS_NONE && (path.isGif() || path.isWebP())) { // this is required to make glide cache aware of changes options.decode(Drawable::class.java) @@ -629,8 +628,11 @@ fun Context.loadSVG( .transition(getOptionalCrossFadeTransition(crossFadeDuration)) if (roundCorners != ROUNDED_CORNERS_NONE) { - val cornerSize = - if (roundCorners == ROUNDED_CORNERS_SMALL) org.fossify.commons.R.dimen.rounded_corner_radius_small else org.fossify.commons.R.dimen.rounded_corner_radius_big + val cornerSize = when (roundCorners) { + ROUNDED_CORNERS_SMALL -> org.fossify.commons.R.dimen.rounded_corner_radius_small + else -> org.fossify.commons.R.dimen.rounded_corner_radius_big + } + val cornerRadius = resources.getDimension(cornerSize).toInt() builder = builder.transform(CenterCrop(), RoundedCorners(cornerRadius)) } diff --git a/app/src/main/res/drawable/placeholder_rounded_big.xml b/app/src/main/res/drawable/placeholder_rounded_big.xml new file mode 100644 index 000000000..62ecb9d05 --- /dev/null +++ b/app/src/main/res/drawable/placeholder_rounded_big.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/app/src/main/res/drawable/placeholder_rounded_small.xml b/app/src/main/res/drawable/placeholder_rounded_small.xml new file mode 100644 index 000000000..21f826cc7 --- /dev/null +++ b/app/src/main/res/drawable/placeholder_rounded_small.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/app/src/main/res/drawable/placeholder_square.xml b/app/src/main/res/drawable/placeholder_square.xml new file mode 100644 index 000000000..47152e43a --- /dev/null +++ b/app/src/main/res/drawable/placeholder_square.xml @@ -0,0 +1,4 @@ + + + +