Fix SubsonicPreferences creation

This commit is contained in:
CappielloAntonio 2021-07-28 13:55:05 +02:00
parent 7bd2b10165
commit ca1831d23c
3 changed files with 8 additions and 13 deletions

View file

@ -41,7 +41,7 @@ public class PlayerNowPlayingSongAdapter extends RecyclerView.Adapter<PlayerNowP
Song song = songs.get(position);
CustomGlideRequest.Builder
.from(context, song.getPrimary(), song.getBlurHash(), CustomGlideRequest.PRIMARY)
.from(context, song.getPrimary(), song.getBlurHash(), CustomGlideRequest.SONG_PIC)
.build()
.into(holder.cover);
}

View file

@ -29,14 +29,13 @@ import com.cappielloantonio.play.model.Song;
import com.cappielloantonio.play.model.SongArtistCross;
import com.cappielloantonio.play.model.SongGenreCross;
@Database(entities = {Album.class, Artist.class, Genre.class, Playlist.class, Song.class, RecentSearch.class, SongGenreCross.class, Queue.class, AlbumArtistCross.class, SongArtistCross.class, PlaylistSongCross.class}, version = 1, exportSchema = false)
@Database(entities = {Album.class, Artist.class, Genre.class, Playlist.class, Song.class, RecentSearch.class, SongGenreCross.class, Queue.class, AlbumArtistCross.class, SongArtistCross.class, PlaylistSongCross.class}, version = 2, exportSchema = false)
public abstract class AppDatabase extends RoomDatabase {
private static final String TAG = "AppDatabase";
private final static String DB_NAME = "play_db";
private static AppDatabase instance;
public static synchronized AppDatabase getInstance(Context context) {
if (instance == null && context != null) {
instance = Room.databaseBuilder(context, AppDatabase.class, DB_NAME)
.fallbackToDestructiveMigration()

View file

@ -15,8 +15,7 @@ public class SubsonicPreferences {
this.serverUrl = serverUrl;
this.username = username;
if(password != null) this.authentication = new SubsonicAuthentication(password);
if(token != null) this.authentication.setToken(token);
if(salt != null) this.authentication.setSalt(salt);
if(token != null && salt != null) this.authentication = new SubsonicAuthentication(token, salt);
}
public String getServerUrl() {
@ -47,6 +46,11 @@ public class SubsonicPreferences {
update(password);
}
public SubsonicAuthentication(String token, String salt) {
this.token = token;
this.salt = salt;
}
public String getSalt() {
return salt;
}
@ -55,14 +59,6 @@ public class SubsonicPreferences {
return token;
}
public void setSalt(String salt) {
this.salt = salt;
}
public void setToken(String token) {
this.token = token;
}
void update(String password) {
this.salt = UUID.randomUUID().toString();
this.token = StringUtil.tokenize(password + salt);