Use black placeholder for thumbnails

Using a black placeholder leads to clearer thumbnail and background separation on most themes.
This commit is contained in:
Naveen Singh 2024-09-25 23:10:51 +05:30
parent 9b93b62f00
commit 056032cb67
No known key found for this signature in database
GPG key ID: AF5D43C216778C0B
6 changed files with 35 additions and 3 deletions

View file

@ -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,

View file

@ -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,

View file

@ -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))
}

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/md_grey_black" />
<corners android:radius="@dimen/rounded_corner_radius_big" />
</shape>

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/md_grey_black" />
<corners android:radius="@dimen/rounded_corner_radius_small" />
</shape>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/md_grey_black" />
</shape>