use blurhash for genre and playlist images
This commit is contained in:
parent
52986be353
commit
71b5108520
4 changed files with 20 additions and 2 deletions
|
|
@ -82,7 +82,7 @@ public class GenreAdapter extends RecyclerView.Adapter<GenreAdapter.ViewHolder>
|
|||
if (holder.image == null) return;
|
||||
|
||||
CustomGlideRequest.Builder
|
||||
.from(activity, genre.id, genre.id)
|
||||
.from(activity, genre.primary, genre.blurHash)
|
||||
.palette().build()
|
||||
.into(new CustomPaletteTarget(holder.image) {
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ public class PlaylistAdapter extends AbsMultiSelectAdapter<PlaylistAdapter.ViewH
|
|||
if (holder.image == null) return;
|
||||
|
||||
CustomGlideRequest.Builder
|
||||
.from(activity, playlist.id, playlist.id)
|
||||
.from(activity, playlist.primary, playlist.blurHash)
|
||||
.palette().build()
|
||||
.into(new CustomPaletteTarget(holder.image) {
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -7,12 +7,16 @@ import androidx.annotation.NonNull;
|
|||
|
||||
import org.jellyfin.apiclient.model.dto.BaseItemDto;
|
||||
import org.jellyfin.apiclient.model.dto.GenreDto;
|
||||
import org.jellyfin.apiclient.model.entities.ImageType;
|
||||
|
||||
public class Genre implements Parcelable {
|
||||
public final String id;
|
||||
public final String name;
|
||||
public final int songCount;
|
||||
|
||||
public String primary;
|
||||
public String blurHash;
|
||||
|
||||
public Genre(GenreDto genreDto) {
|
||||
this.id = genreDto.getId();
|
||||
this.name = genreDto.getName();
|
||||
|
|
@ -23,6 +27,11 @@ public class Genre implements Parcelable {
|
|||
this.id = itemDto.getId();
|
||||
this.name = itemDto.getName();
|
||||
this.songCount = itemDto.getSongCount() != null ? itemDto.getSongCount() : 0;
|
||||
|
||||
this.primary = itemDto.getImageTags().containsKey(ImageType.Primary) ? id : null;
|
||||
if (itemDto.getImageBlurHashes() != null && itemDto.getImageBlurHashes().get(ImageType.Primary) != null) {
|
||||
this.blurHash = (String) itemDto.getImageBlurHashes().get(ImageType.Primary).values().toArray()[0];
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -6,14 +6,23 @@ import android.os.Parcelable;
|
|||
import androidx.annotation.NonNull;
|
||||
|
||||
import org.jellyfin.apiclient.model.dto.BaseItemDto;
|
||||
import org.jellyfin.apiclient.model.entities.ImageType;
|
||||
|
||||
public class Playlist implements Parcelable {
|
||||
public final String id;
|
||||
public final String name;
|
||||
|
||||
public String primary;
|
||||
public String blurHash;
|
||||
|
||||
public Playlist(BaseItemDto itemDto) {
|
||||
this.id = itemDto.getId();
|
||||
this.name = itemDto.getName();
|
||||
|
||||
this.primary = itemDto.getImageTags().containsKey(ImageType.Primary) ? id : null;
|
||||
if (itemDto.getImageBlurHashes() != null && itemDto.getImageBlurHashes().get(ImageType.Primary) != null) {
|
||||
this.blurHash = (String) itemDto.getImageBlurHashes().get(ImageType.Primary).values().toArray()[0];
|
||||
}
|
||||
}
|
||||
|
||||
public Playlist(final int id, final String name) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue