mirror of
https://github.com/antebudimir/tempus.git
synced 2025-12-31 17:43:32 +00:00
Fix SubsonicPreferences creation
This commit is contained in:
parent
7bd2b10165
commit
ca1831d23c
3 changed files with 8 additions and 13 deletions
|
|
@ -41,7 +41,7 @@ public class PlayerNowPlayingSongAdapter extends RecyclerView.Adapter<PlayerNowP
|
||||||
Song song = songs.get(position);
|
Song song = songs.get(position);
|
||||||
|
|
||||||
CustomGlideRequest.Builder
|
CustomGlideRequest.Builder
|
||||||
.from(context, song.getPrimary(), song.getBlurHash(), CustomGlideRequest.PRIMARY)
|
.from(context, song.getPrimary(), song.getBlurHash(), CustomGlideRequest.SONG_PIC)
|
||||||
.build()
|
.build()
|
||||||
.into(holder.cover);
|
.into(holder.cover);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,14 +29,13 @@ import com.cappielloantonio.play.model.Song;
|
||||||
import com.cappielloantonio.play.model.SongArtistCross;
|
import com.cappielloantonio.play.model.SongArtistCross;
|
||||||
import com.cappielloantonio.play.model.SongGenreCross;
|
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 {
|
public abstract class AppDatabase extends RoomDatabase {
|
||||||
private static final String TAG = "AppDatabase";
|
private static final String TAG = "AppDatabase";
|
||||||
private final static String DB_NAME = "play_db";
|
private final static String DB_NAME = "play_db";
|
||||||
private static AppDatabase instance;
|
private static AppDatabase instance;
|
||||||
|
|
||||||
public static synchronized AppDatabase getInstance(Context context) {
|
public static synchronized AppDatabase getInstance(Context context) {
|
||||||
|
|
||||||
if (instance == null && context != null) {
|
if (instance == null && context != null) {
|
||||||
instance = Room.databaseBuilder(context, AppDatabase.class, DB_NAME)
|
instance = Room.databaseBuilder(context, AppDatabase.class, DB_NAME)
|
||||||
.fallbackToDestructiveMigration()
|
.fallbackToDestructiveMigration()
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,7 @@ public class SubsonicPreferences {
|
||||||
this.serverUrl = serverUrl;
|
this.serverUrl = serverUrl;
|
||||||
this.username = username;
|
this.username = username;
|
||||||
if(password != null) this.authentication = new SubsonicAuthentication(password);
|
if(password != null) this.authentication = new SubsonicAuthentication(password);
|
||||||
if(token != null) this.authentication.setToken(token);
|
if(token != null && salt != null) this.authentication = new SubsonicAuthentication(token, salt);
|
||||||
if(salt != null) this.authentication.setSalt(salt);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getServerUrl() {
|
public String getServerUrl() {
|
||||||
|
|
@ -47,6 +46,11 @@ public class SubsonicPreferences {
|
||||||
update(password);
|
update(password);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SubsonicAuthentication(String token, String salt) {
|
||||||
|
this.token = token;
|
||||||
|
this.salt = salt;
|
||||||
|
}
|
||||||
|
|
||||||
public String getSalt() {
|
public String getSalt() {
|
||||||
return salt;
|
return salt;
|
||||||
}
|
}
|
||||||
|
|
@ -55,14 +59,6 @@ public class SubsonicPreferences {
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSalt(String salt) {
|
|
||||||
this.salt = salt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setToken(String token) {
|
|
||||||
this.token = token;
|
|
||||||
}
|
|
||||||
|
|
||||||
void update(String password) {
|
void update(String password) {
|
||||||
this.salt = UUID.randomUUID().toString();
|
this.salt = UUID.randomUUID().toString();
|
||||||
this.token = StringUtil.tokenize(password + salt);
|
this.token = StringUtil.tokenize(password + salt);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue