Graphic and functional improvements in the synchronization section

This commit is contained in:
CappielloAntonio 2021-04-28 18:10:22 +02:00
parent fdc104f70b
commit 67803b9149
19 changed files with 991 additions and 215 deletions

View file

@ -6,9 +6,14 @@ import android.os.Bundle;
import androidx.annotation.NonNull;
import androidx.lifecycle.AndroidViewModel;
import com.cappielloantonio.play.model.Album;
import com.cappielloantonio.play.model.Artist;
import com.cappielloantonio.play.model.Genre;
import com.cappielloantonio.play.model.Playlist;
import com.cappielloantonio.play.model.Song;
import com.cappielloantonio.play.repository.SongRepository;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
@ -24,10 +29,15 @@ public class SyncViewModel extends AndroidViewModel {
private boolean syncSong = false;
private boolean crossSyncSongGenre = false;
private ArrayList<Album> albumList = new ArrayList<>();
private ArrayList<Artist> artistList = new ArrayList<>();
private ArrayList<Genre> genreList = new ArrayList<>();
private ArrayList<Playlist> playlistList = new ArrayList<>();
private ArrayList<Song> songList = new ArrayList<>();
private int step = 0;
private int progress = 0;
public SyncViewModel(@NonNull Application application) {
super(application);
@ -54,7 +64,6 @@ public class SyncViewModel extends AndroidViewModel {
if (syncGenres) step++;
if (syncPlaylist) step++;
if (syncSong) step++;
if (crossSyncSongGenre) step++;
}
public boolean isSyncAlbum() {
@ -81,6 +90,50 @@ public class SyncViewModel extends AndroidViewModel {
return crossSyncSongGenre;
}
public ArrayList<Album> getAlbumList() {
return albumList;
}
public void setAlbumList(ArrayList<Album> albumList) {
this.albumList = albumList;
}
public ArrayList<Artist> getArtistList() {
return artistList;
}
public void setArtistList(ArrayList<Artist> artistList) {
this.artistList = artistList;
}
public ArrayList<Genre> getGenreList() {
return genreList;
}
public void setGenreList(ArrayList<Genre> genreList) {
this.genreList = genreList;
}
public ArrayList<Playlist> getPlaylistList() {
return playlistList;
}
public void setPlaylistList(ArrayList<Playlist> playlistList) {
this.playlistList = playlistList;
}
public ArrayList<Song> getSongList() {
return songList;
}
public void setSongList(ArrayList<Song> songList) {
this.songList = songList;
}
public void increaseProggress() {
progress++;
}
public int getStep() {
return step;
}
@ -89,13 +142,6 @@ public class SyncViewModel extends AndroidViewModel {
return progress;
}
public void setProgress(Boolean step) {
if (step) progress++;
}
public int getProgressBarInfo() {
return progress * (100 / step);
}
public Map<Integer, Song> getCatalogue() {
Map<Integer, Song> map = new HashMap<>();