mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-01 09:53:33 +00:00
Imports optimization and entries rearranged
This commit is contained in:
parent
3c2837e096
commit
65e47f61ef
63 changed files with 987 additions and 1087 deletions
|
|
@ -12,9 +12,8 @@ import com.cappielloantonio.play.repository.AlbumRepository;
|
|||
import java.util.List;
|
||||
|
||||
public class AlbumCatalogueViewModel extends AndroidViewModel {
|
||||
private AlbumRepository albumRepository;
|
||||
public LiveData<List<Album>> albumList;
|
||||
|
||||
private AlbumRepository albumRepository;
|
||||
private String query = "";
|
||||
|
||||
public AlbumCatalogueViewModel(@NonNull Application application) {
|
||||
|
|
|
|||
|
|
@ -14,11 +14,11 @@ public class ArtistBottomSheetViewModel extends AndroidViewModel {
|
|||
super(application);
|
||||
}
|
||||
|
||||
public void setArtist(Artist artist) {
|
||||
this.artist = artist;
|
||||
}
|
||||
|
||||
public Artist getArtist() {
|
||||
return artist;
|
||||
}
|
||||
|
||||
public void setArtist(Artist artist) {
|
||||
this.artist = artist;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,9 +6,7 @@ import androidx.annotation.NonNull;
|
|||
import androidx.lifecycle.AndroidViewModel;
|
||||
import androidx.lifecycle.LiveData;
|
||||
|
||||
import com.cappielloantonio.play.model.Artist;
|
||||
import com.cappielloantonio.play.model.Genre;
|
||||
import com.cappielloantonio.play.repository.ArtistRepository;
|
||||
import com.cappielloantonio.play.repository.GenreRepository;
|
||||
|
||||
import java.util.List;
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ public class HomeViewModel extends AndroidViewModel {
|
|||
|
||||
|
||||
public List<Song> getDiscoverSongList() {
|
||||
if(dicoverSongSample.isEmpty()) {
|
||||
if (dicoverSongSample.isEmpty()) {
|
||||
dicoverSongSample = songRepository.getRandomSample(10);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,13 +10,11 @@ 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.AlbumRepository;
|
||||
import com.cappielloantonio.play.repository.ArtistRepository;
|
||||
import com.cappielloantonio.play.repository.GenreRepository;
|
||||
import com.cappielloantonio.play.repository.PlaylistRepository;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class LibraryViewModel extends AndroidViewModel {
|
||||
|
|
@ -47,7 +45,7 @@ public class LibraryViewModel extends AndroidViewModel {
|
|||
}
|
||||
|
||||
public List<Playlist> getPlaylistSample() {
|
||||
if(playlistSample.isEmpty()) {
|
||||
if (playlistSample.isEmpty()) {
|
||||
playlistSample = playlistRepository.getRandomSample(5);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ public class MainViewModel extends AndroidViewModel {
|
|||
}
|
||||
|
||||
public boolean isQueueLoaded() {
|
||||
if(queueRepository.count() == 0)
|
||||
if (queueRepository.count() == 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@ import androidx.annotation.NonNull;
|
|||
import androidx.lifecycle.AndroidViewModel;
|
||||
import androidx.lifecycle.LiveData;
|
||||
|
||||
import com.cappielloantonio.play.service.MusicPlayerRemote;
|
||||
import com.cappielloantonio.play.model.Song;
|
||||
import com.cappielloantonio.play.repository.QueueRepository;
|
||||
import com.cappielloantonio.play.repository.SongRepository;
|
||||
import com.cappielloantonio.play.service.MusicPlayerRemote;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
|
|||
|
|
@ -6,9 +6,7 @@ import androidx.annotation.NonNull;
|
|||
import androidx.lifecycle.AndroidViewModel;
|
||||
import androidx.lifecycle.LiveData;
|
||||
|
||||
import com.cappielloantonio.play.model.Genre;
|
||||
import com.cappielloantonio.play.model.Playlist;
|
||||
import com.cappielloantonio.play.repository.GenreRepository;
|
||||
import com.cappielloantonio.play.repository.PlaylistRepository;
|
||||
|
||||
import java.util.List;
|
||||
|
|
|
|||
|
|
@ -1,13 +1,11 @@
|
|||
package com.cappielloantonio.play.viewmodel;
|
||||
|
||||
import android.app.Application;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.AndroidViewModel;
|
||||
import androidx.lifecycle.LiveData;
|
||||
|
||||
import com.cappielloantonio.play.model.Album;
|
||||
import com.cappielloantonio.play.model.Playlist;
|
||||
import com.cappielloantonio.play.model.Song;
|
||||
import com.cappielloantonio.play.repository.SongRepository;
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ public class SearchViewModel extends AndroidViewModel {
|
|||
public void setQuery(String query) {
|
||||
this.query = query;
|
||||
|
||||
if(!query.isEmpty()) {
|
||||
if (!query.isEmpty()) {
|
||||
insertNewSearch(query);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,14 +27,14 @@ public class SongBottomSheetViewModel extends AndroidViewModel {
|
|||
artistRepository = new ArtistRepository(application);
|
||||
}
|
||||
|
||||
public void setSong(Song song) {
|
||||
this.song = song;
|
||||
}
|
||||
|
||||
public Song getSong() {
|
||||
return song;
|
||||
}
|
||||
|
||||
public void setSong(Song song) {
|
||||
this.song = song;
|
||||
}
|
||||
|
||||
public void setFavorite() {
|
||||
song.setFavorite(!song.isFavorite());
|
||||
songRepository.setFavoriteStatus(song);
|
||||
|
|
|
|||
|
|
@ -16,16 +16,14 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
public class SongListPageViewModel extends AndroidViewModel {
|
||||
private SongRepository songRepository;
|
||||
|
||||
private LiveData<List<Song>> songList;
|
||||
|
||||
public String title;
|
||||
public Genre genre;
|
||||
public Artist artist;
|
||||
public ArrayList<String> filters = new ArrayList<>();
|
||||
public ArrayList<String> filterNames = new ArrayList<>();
|
||||
public int year = 0;
|
||||
private SongRepository songRepository;
|
||||
private LiveData<List<Song>> songList;
|
||||
|
||||
public SongListPageViewModel(@NonNull Application application) {
|
||||
super(application);
|
||||
|
|
|
|||
|
|
@ -49,12 +49,12 @@ public class SyncViewModel extends AndroidViewModel {
|
|||
}
|
||||
|
||||
private void countStep() {
|
||||
if(syncAlbum) step++;
|
||||
if(syncArtist) step++;
|
||||
if(syncGenres) step++;
|
||||
if(syncPlaylist) step++;
|
||||
if(syncSong) step++;
|
||||
if(crossSyncSongGenre) step++;
|
||||
if (syncAlbum) step++;
|
||||
if (syncArtist) step++;
|
||||
if (syncGenres) step++;
|
||||
if (syncPlaylist) step++;
|
||||
if (syncSong) step++;
|
||||
if (crossSyncSongGenre) step++;
|
||||
}
|
||||
|
||||
public boolean isSyncAlbum() {
|
||||
|
|
@ -90,7 +90,7 @@ public class SyncViewModel extends AndroidViewModel {
|
|||
}
|
||||
|
||||
public void setProgress(Boolean step) {
|
||||
if(step) progress++;
|
||||
if (step) progress++;
|
||||
}
|
||||
|
||||
public int getProgressBarInfo() {
|
||||
|
|
@ -100,7 +100,7 @@ public class SyncViewModel extends AndroidViewModel {
|
|||
public Map<Integer, Song> getCatalogue() {
|
||||
Map<Integer, Song> map = new HashMap<>();
|
||||
|
||||
for(Song song: songRepository.getCatalogue()){
|
||||
for (Song song : songRepository.getCatalogue()) {
|
||||
map.put(song.hashCode(), song);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue