Implemented rating system for song, album and artist (album and artist do not retrieve rating from server)

This commit is contained in:
CappielloAntonio 2021-08-13 17:29:37 +02:00
parent 055ac44cf6
commit e2ddbdf6c9
15 changed files with 303 additions and 7 deletions

View file

@ -230,4 +230,27 @@ public class SongRepository {
return songsByGenre;
}
public MutableLiveData<Song> getSong(String id) {
MutableLiveData<Song> song = new MutableLiveData<>();
App.getSubsonicClientInstance(application, false)
.getBrowsingClient()
.getSong(id)
.enqueue(new Callback<SubsonicResponse>() {
@Override
public void onResponse(Call<SubsonicResponse> call, Response<SubsonicResponse> response) {
if (response.body().getStatus().getValue().equals(ResponseStatus.OK)) {
song.setValue(MappingUtil.mapSong(response.body().getSong()));
}
}
@Override
public void onFailure(Call<SubsonicResponse> call, Throwable t) {
}
});
return song;
}
}