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;
|
if (holder.image == null) return;
|
||||||
|
|
||||||
CustomGlideRequest.Builder
|
CustomGlideRequest.Builder
|
||||||
.from(activity, genre.id, genre.id)
|
.from(activity, genre.primary, genre.blurHash)
|
||||||
.palette().build()
|
.palette().build()
|
||||||
.into(new CustomPaletteTarget(holder.image) {
|
.into(new CustomPaletteTarget(holder.image) {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ public class PlaylistAdapter extends AbsMultiSelectAdapter<PlaylistAdapter.ViewH
|
||||||
if (holder.image == null) return;
|
if (holder.image == null) return;
|
||||||
|
|
||||||
CustomGlideRequest.Builder
|
CustomGlideRequest.Builder
|
||||||
.from(activity, playlist.id, playlist.id)
|
.from(activity, playlist.primary, playlist.blurHash)
|
||||||
.palette().build()
|
.palette().build()
|
||||||
.into(new CustomPaletteTarget(holder.image) {
|
.into(new CustomPaletteTarget(holder.image) {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -7,12 +7,16 @@ import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import org.jellyfin.apiclient.model.dto.BaseItemDto;
|
import org.jellyfin.apiclient.model.dto.BaseItemDto;
|
||||||
import org.jellyfin.apiclient.model.dto.GenreDto;
|
import org.jellyfin.apiclient.model.dto.GenreDto;
|
||||||
|
import org.jellyfin.apiclient.model.entities.ImageType;
|
||||||
|
|
||||||
public class Genre implements Parcelable {
|
public class Genre implements Parcelable {
|
||||||
public final String id;
|
public final String id;
|
||||||
public final String name;
|
public final String name;
|
||||||
public final int songCount;
|
public final int songCount;
|
||||||
|
|
||||||
|
public String primary;
|
||||||
|
public String blurHash;
|
||||||
|
|
||||||
public Genre(GenreDto genreDto) {
|
public Genre(GenreDto genreDto) {
|
||||||
this.id = genreDto.getId();
|
this.id = genreDto.getId();
|
||||||
this.name = genreDto.getName();
|
this.name = genreDto.getName();
|
||||||
|
|
@ -23,6 +27,11 @@ public class Genre implements Parcelable {
|
||||||
this.id = itemDto.getId();
|
this.id = itemDto.getId();
|
||||||
this.name = itemDto.getName();
|
this.name = itemDto.getName();
|
||||||
this.songCount = itemDto.getSongCount() != null ? itemDto.getSongCount() : 0;
|
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
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -6,14 +6,23 @@ import android.os.Parcelable;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import org.jellyfin.apiclient.model.dto.BaseItemDto;
|
import org.jellyfin.apiclient.model.dto.BaseItemDto;
|
||||||
|
import org.jellyfin.apiclient.model.entities.ImageType;
|
||||||
|
|
||||||
public class Playlist implements Parcelable {
|
public class Playlist implements Parcelable {
|
||||||
public final String id;
|
public final String id;
|
||||||
public final String name;
|
public final String name;
|
||||||
|
|
||||||
|
public String primary;
|
||||||
|
public String blurHash;
|
||||||
|
|
||||||
public Playlist(BaseItemDto itemDto) {
|
public Playlist(BaseItemDto itemDto) {
|
||||||
this.id = itemDto.getId();
|
this.id = itemDto.getId();
|
||||||
this.name = itemDto.getName();
|
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) {
|
public Playlist(final int id, final String name) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue