mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-22 12:38:00 +01:00
Use black placeholder for thumbnails
Using a black placeholder leads to clearer thumbnail and background separation on most themes.
This commit is contained in:
parent
9b93b62f00
commit
056032cb67
6 changed files with 35 additions and 3 deletions
|
@ -821,6 +821,14 @@ class DirectoryAdapter(
|
||||||
else -> ROUNDED_CORNERS_BIG
|
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(
|
activity.loadImage(
|
||||||
type = thumbnailType,
|
type = thumbnailType,
|
||||||
path = directory.tmb,
|
path = directory.tmb,
|
||||||
|
|
|
@ -656,6 +656,14 @@ class MediaAdapter(
|
||||||
else -> ROUNDED_CORNERS_NONE
|
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(
|
activity.loadImage(
|
||||||
type = medium.type,
|
type = medium.type,
|
||||||
path = path,
|
path = path,
|
||||||
|
|
|
@ -558,7 +558,6 @@ fun Context.loadImageBase(
|
||||||
|
|
||||||
// animation is only supported without rounded corners and the file must be a GIF or WEBP.
|
// 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
|
// 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())) {
|
if (animate && roundCorners == ROUNDED_CORNERS_NONE && (path.isGif() || path.isWebP())) {
|
||||||
// this is required to make glide cache aware of changes
|
// this is required to make glide cache aware of changes
|
||||||
options.decode(Drawable::class.java)
|
options.decode(Drawable::class.java)
|
||||||
|
@ -629,8 +628,11 @@ fun Context.loadSVG(
|
||||||
.transition(getOptionalCrossFadeTransition(crossFadeDuration))
|
.transition(getOptionalCrossFadeTransition(crossFadeDuration))
|
||||||
|
|
||||||
if (roundCorners != ROUNDED_CORNERS_NONE) {
|
if (roundCorners != ROUNDED_CORNERS_NONE) {
|
||||||
val cornerSize =
|
val cornerSize = when (roundCorners) {
|
||||||
if (roundCorners == ROUNDED_CORNERS_SMALL) org.fossify.commons.R.dimen.rounded_corner_radius_small else org.fossify.commons.R.dimen.rounded_corner_radius_big
|
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()
|
val cornerRadius = resources.getDimension(cornerSize).toInt()
|
||||||
builder = builder.transform(CenterCrop(), RoundedCorners(cornerRadius))
|
builder = builder.transform(CenterCrop(), RoundedCorners(cornerRadius))
|
||||||
}
|
}
|
||||||
|
|
5
app/src/main/res/drawable/placeholder_rounded_big.xml
Normal file
5
app/src/main/res/drawable/placeholder_rounded_big.xml
Normal 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>
|
5
app/src/main/res/drawable/placeholder_rounded_small.xml
Normal file
5
app/src/main/res/drawable/placeholder_rounded_small.xml
Normal 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>
|
4
app/src/main/res/drawable/placeholder_square.xml
Normal file
4
app/src/main/res/drawable/placeholder_square.xml
Normal 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>
|
Loading…
Reference in a new issue