pass blurhash in parcel and fix sidebar image
This commit is contained in:
parent
d7b1221199
commit
7f0bbaab4e
9 changed files with 29 additions and 8 deletions
|
|
@ -99,7 +99,6 @@ public class CustomGlideRequest {
|
||||||
|
|
||||||
public static RequestOptions createRequestOptions(String item, Drawable placeholder) {
|
public static RequestOptions createRequestOptions(String item, Drawable placeholder) {
|
||||||
return new RequestOptions()
|
return new RequestOptions()
|
||||||
.centerCrop()
|
|
||||||
.placeholder(placeholder)
|
.placeholder(placeholder)
|
||||||
.error(DEFAULT_IMAGE)
|
.error(DEFAULT_IMAGE)
|
||||||
.diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY)
|
.diskCacheStrategy(DEFAULT_DISK_CACHE_STRATEGY)
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@ package com.dkanada.gramophone.model;
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
|
|
||||||
|
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;
|
import org.jellyfin.apiclient.model.entities.ImageType;
|
||||||
|
|
||||||
|
|
@ -52,6 +54,7 @@ public class Album implements Parcelable {
|
||||||
this.artistName = song.artistName;
|
this.artistName = song.artistName;
|
||||||
|
|
||||||
this.primary = song.primary;
|
this.primary = song.primary;
|
||||||
|
this.blurHash = song.blurHash;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Album() {
|
public Album() {
|
||||||
|
|
@ -72,6 +75,7 @@ public class Album implements Parcelable {
|
||||||
return id.hashCode();
|
return id.hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return id;
|
return id;
|
||||||
|
|
@ -92,6 +96,7 @@ public class Album implements Parcelable {
|
||||||
dest.writeString(artistName);
|
dest.writeString(artistName);
|
||||||
|
|
||||||
dest.writeString(primary);
|
dest.writeString(primary);
|
||||||
|
dest.writeString(blurHash);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Album(Parcel in) {
|
protected Album(Parcel in) {
|
||||||
|
|
@ -105,6 +110,7 @@ public class Album implements Parcelable {
|
||||||
this.artistName = in.readString();
|
this.artistName = in.readString();
|
||||||
|
|
||||||
this.primary = in.readString();
|
this.primary = in.readString();
|
||||||
|
this.blurHash = in.readString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Creator<Album> CREATOR = new Creator<Album>() {
|
public static final Creator<Album> CREATOR = new Creator<Album>() {
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@ package com.dkanada.gramophone.model;
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
|
|
||||||
|
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;
|
import org.jellyfin.apiclient.model.entities.ImageType;
|
||||||
|
|
@ -70,6 +72,7 @@ public class Artist implements Parcelable {
|
||||||
return id.hashCode();
|
return id.hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return id;
|
return id;
|
||||||
|
|
@ -86,6 +89,7 @@ public class Artist implements Parcelable {
|
||||||
dest.writeString(name);
|
dest.writeString(name);
|
||||||
|
|
||||||
dest.writeString(primary);
|
dest.writeString(primary);
|
||||||
|
dest.writeString(blurHash);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Artist(Parcel in) {
|
protected Artist(Parcel in) {
|
||||||
|
|
@ -97,6 +101,7 @@ public class Artist implements Parcelable {
|
||||||
this.name = in.readString();
|
this.name = in.readString();
|
||||||
|
|
||||||
this.primary = in.readString();
|
this.primary = in.readString();
|
||||||
|
this.blurHash = in.readString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Parcelable.Creator<Artist> CREATOR = new Parcelable.Creator<Artist>() {
|
public static final Parcelable.Creator<Artist> CREATOR = new Parcelable.Creator<Artist>() {
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@ package com.dkanada.gramophone.model;
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
|
@ -37,6 +39,7 @@ public class Genre implements Parcelable {
|
||||||
return id.hashCode();
|
return id.hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return id;
|
return id;
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@ package com.dkanada.gramophone.model;
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import org.jellyfin.apiclient.model.dto.BaseItemDto;
|
import org.jellyfin.apiclient.model.dto.BaseItemDto;
|
||||||
|
|
||||||
public class Playlist implements Parcelable {
|
public class Playlist implements Parcelable {
|
||||||
|
|
@ -38,6 +40,7 @@ public class Playlist implements Parcelable {
|
||||||
return id.hashCode();
|
return id.hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return id;
|
return id;
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@ package com.dkanada.gramophone.model;
|
||||||
import android.os.Parcel;
|
import android.os.Parcel;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import org.jellyfin.apiclient.model.dto.BaseItemDto;
|
import org.jellyfin.apiclient.model.dto.BaseItemDto;
|
||||||
import org.jellyfin.apiclient.model.dto.MediaSourceInfo;
|
import org.jellyfin.apiclient.model.dto.MediaSourceInfo;
|
||||||
import org.jellyfin.apiclient.model.entities.ImageType;
|
import org.jellyfin.apiclient.model.entities.ImageType;
|
||||||
|
|
@ -117,6 +119,7 @@ public class Song implements Parcelable {
|
||||||
return id.hashCode();
|
return id.hashCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return id;
|
return id;
|
||||||
|
|
@ -144,6 +147,7 @@ public class Song implements Parcelable {
|
||||||
|
|
||||||
dest.writeString(this.primary);
|
dest.writeString(this.primary);
|
||||||
dest.writeString(Boolean.toString(favorite));
|
dest.writeString(Boolean.toString(favorite));
|
||||||
|
dest.writeString(this.blurHash);
|
||||||
|
|
||||||
dest.writeString(this.path);
|
dest.writeString(this.path);
|
||||||
dest.writeLong(this.size);
|
dest.writeLong(this.size);
|
||||||
|
|
@ -173,6 +177,7 @@ public class Song implements Parcelable {
|
||||||
|
|
||||||
this.primary = in.readString();
|
this.primary = in.readString();
|
||||||
this.favorite = Boolean.parseBoolean(in.readString());
|
this.favorite = Boolean.parseBoolean(in.readString());
|
||||||
|
this.blurHash = in.readString();
|
||||||
|
|
||||||
this.path = in.readString();
|
this.path = in.readString();
|
||||||
this.size = in.readLong();
|
this.size = in.readLong();
|
||||||
|
|
|
||||||
|
|
@ -184,7 +184,7 @@ public class MainActivity extends AbsSlidingMusicPanelActivity {
|
||||||
|
|
||||||
CustomGlideRequest.Builder
|
CustomGlideRequest.Builder
|
||||||
.from(this, song.primary, song.blurHash)
|
.from(this, song.primary, song.blurHash)
|
||||||
.build().into(navigationBinding.image);
|
.build().centerInside().into(navigationBinding.image);
|
||||||
} else if (binding.navigationView.getHeaderCount() != 0) {
|
} else if (binding.navigationView.getHeaderCount() != 0) {
|
||||||
binding.navigationView.removeHeaderView(navigationBinding.getRoot());
|
binding.navigationView.removeHeaderView(navigationBinding.getRoot());
|
||||||
navigationBinding = null;
|
navigationBinding = null;
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ public class AlbumDetailActivity extends AbsSlidingMusicPanelActivity implements
|
||||||
setUpViews();
|
setUpViews();
|
||||||
|
|
||||||
Album album = getIntent().getExtras().getParcelable(EXTRA_ALBUM);
|
Album album = getIntent().getExtras().getParcelable(EXTRA_ALBUM);
|
||||||
loadAlbumCover(album.primary);
|
loadAlbumCover(album);
|
||||||
setAlbum(album);
|
setAlbum(album);
|
||||||
|
|
||||||
ItemQuery query = new ItemQuery();
|
ItemQuery query = new ItemQuery();
|
||||||
|
|
@ -106,9 +106,9 @@ public class AlbumDetailActivity extends AbsSlidingMusicPanelActivity implements
|
||||||
setColors(DialogUtils.resolveColor(this, R.attr.defaultFooterColor));
|
setColors(DialogUtils.resolveColor(this, R.attr.defaultFooterColor));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadAlbumCover(String primary) {
|
private void loadAlbumCover(Album album) {
|
||||||
CustomGlideRequest.Builder
|
CustomGlideRequest.Builder
|
||||||
.from(this, primary, primary)
|
.from(this, album.primary, album.blurHash)
|
||||||
.palette().build().dontAnimate()
|
.palette().build().dontAnimate()
|
||||||
.into(new CustomPaletteTarget(binding.image) {
|
.into(new CustomPaletteTarget(binding.image) {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ public class ArtistDetailActivity extends AbsSlidingMusicPanelActivity implement
|
||||||
setUpViews();
|
setUpViews();
|
||||||
|
|
||||||
Artist artist = getIntent().getExtras().getParcelable(EXTRA_ARTIST);
|
Artist artist = getIntent().getExtras().getParcelable(EXTRA_ARTIST);
|
||||||
loadArtistImage(artist.primary);
|
loadArtistImage(artist);
|
||||||
setArtist(artist);
|
setArtist(artist);
|
||||||
|
|
||||||
ItemQuery albums = new ItemQuery();
|
ItemQuery albums = new ItemQuery();
|
||||||
|
|
@ -150,9 +150,9 @@ public class ArtistDetailActivity extends AbsSlidingMusicPanelActivity implement
|
||||||
this.usePalette = usePalette;
|
this.usePalette = usePalette;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadArtistImage(String primary) {
|
private void loadArtistImage(Artist artist) {
|
||||||
CustomGlideRequest.Builder
|
CustomGlideRequest.Builder
|
||||||
.from(this, primary, primary)
|
.from(this, artist.primary, artist.blurHash)
|
||||||
.palette().build().dontAnimate()
|
.palette().build().dontAnimate()
|
||||||
.into(new CustomPaletteTarget(binding.image) {
|
.into(new CustomPaletteTarget(binding.image) {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue