mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-22 04:28:00 +01:00
Merge pull request #306 from FossifyOrg/add_black_placeholders
Use black placeholder background for thumbnails
This commit is contained in:
commit
2caa178417
6 changed files with 35 additions and 3 deletions
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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))
|
||||
}
|
||||
|
|
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