mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-01 01:53:31 +00:00
Fix long click to refresh
This commit is contained in:
parent
560c7e0035
commit
d3f1ce1fe4
6 changed files with 34 additions and 75 deletions
|
|
@ -22,7 +22,7 @@ import retrofit2.Call;
|
|||
import retrofit2.Callback;
|
||||
|
||||
public class PlaylistCatalogueViewModel extends AndroidViewModel {
|
||||
private MutableLiveData<List<Playlist>> playlists = new MutableLiveData<>(new ArrayList<>());
|
||||
private MutableLiveData<List<Playlist>> playlists;
|
||||
|
||||
private PlaylistRepository playlistRepository;
|
||||
private String query = "";
|
||||
|
|
@ -31,28 +31,12 @@ public class PlaylistCatalogueViewModel extends AndroidViewModel {
|
|||
super(application);
|
||||
|
||||
playlistRepository = new PlaylistRepository(application);
|
||||
|
||||
playlists = playlistRepository.getPlaylists(false, -1);
|
||||
}
|
||||
|
||||
public LiveData<List<Playlist>> getPlaylistList() {
|
||||
return playlists;
|
||||
}
|
||||
|
||||
public void loadPlaylists(Context context) {
|
||||
App.getSubsonicClientInstance(context, false)
|
||||
.getPlaylistClient()
|
||||
.getPlaylists()
|
||||
.enqueue(new Callback<SubsonicResponse>() {
|
||||
@Override
|
||||
public void onResponse(Call<SubsonicResponse> call, retrofit2.Response<SubsonicResponse> response) {
|
||||
if (response.body().getStatus().getValue().equals(ResponseStatus.OK)) {
|
||||
playlists.setValue(MappingUtil.mapPlaylist(response.body().getPlaylists().getPlaylists()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<SubsonicResponse> call, Throwable t) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue