Added download UI in home screen

This commit is contained in:
CappielloAntonio 2021-04-26 19:37:05 +02:00
parent e0569c3901
commit bf70863f84
8 changed files with 109 additions and 3 deletions

View file

@ -1,7 +1,6 @@
package com.cappielloantonio.play.repository;
import android.app.Application;
import android.util.Log;
import androidx.lifecycle.LiveData;
@ -33,6 +32,8 @@ public class SongRepository {
private LiveData<List<Song>> listLiveSongByYear;
private LiveData<List<Song>> listLiveSampleFavoritesSong;
private LiveData<List<Song>> listLiveFavoritesSong;
private LiveData<List<Song>> listLiveSampleDownloadedSong;
private LiveData<List<Song>> listLiveDownloadedSong;
public SongRepository(Application application) {
AppDatabase database = AppDatabase.getInstance(application);
@ -314,6 +315,16 @@ public class SongRepository {
return listLiveFavoritesSong;
}
public LiveData<List<Song>> getListLiveDownloadedSampleSong(int number) {
listLiveSampleDownloadedSong = songDao.getDownloadedSongSample(number);
return listLiveSampleDownloadedSong;
}
public LiveData<List<Song>> getListLiveDownloadedSong() {
listLiveDownloadedSong = songDao.getDownloadedSong();
return listLiveDownloadedSong;
}
public void insertAll(ArrayList<Song> songs) {
InsertAllThreadSafe insertAll = new InsertAllThreadSafe(songDao, songGenreCrossDao, songs);
Thread thread = new Thread(insertAll);