mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-01 09:53:33 +00:00
Fix a bunch of lint warning
This commit is contained in:
parent
a49626aa43
commit
81ba6970f5
19 changed files with 36 additions and 256 deletions
|
|
@ -31,12 +31,10 @@ public class AlbumHorizontalAdapter extends RecyclerView.Adapter<AlbumHorizontal
|
|||
private LayoutInflater mInflater;
|
||||
private MainActivity mainActivity;
|
||||
private Context context;
|
||||
private FragmentManager fragmentManager;
|
||||
|
||||
public AlbumHorizontalAdapter(MainActivity mainActivity, Context context, FragmentManager fragmentManager) {
|
||||
this.mainActivity = mainActivity;
|
||||
this.context = context;
|
||||
this.fragmentManager = fragmentManager;
|
||||
this.mInflater = LayoutInflater.from(context);
|
||||
this.albums = new ArrayList<>();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ public class DownloadRepository {
|
|||
|
||||
private DownloadDao downloadDao;
|
||||
private MutableLiveData<List<Download>> listLiveDownload = new MutableLiveData<>(new ArrayList<>());
|
||||
private LiveData<List<Download>> listLiveDownloadSample;
|
||||
|
||||
public DownloadRepository(Application application) {
|
||||
AppDatabase database = AppDatabase.getInstance(application);
|
||||
|
|
@ -62,8 +61,7 @@ public class DownloadRepository {
|
|||
}
|
||||
|
||||
public LiveData<List<Download>> getLiveDownloadSample(int size) {
|
||||
listLiveDownloadSample = downloadDao.getSample(size, PreferenceUtil.getInstance(App.getInstance()).getServerId());
|
||||
return listLiveDownloadSample;
|
||||
return downloadDao.getSample(size, PreferenceUtil.getInstance(App.getInstance()).getServerId());
|
||||
}
|
||||
|
||||
public void insert(Download download) {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ public class QueueRepository {
|
|||
private static final String TAG = "QueueRepository";
|
||||
|
||||
private QueueDao queueDao;
|
||||
private LiveData<List<Queue>> listLiveQueue;
|
||||
|
||||
public QueueRepository(Application application) {
|
||||
AppDatabase database = AppDatabase.getInstance(application);
|
||||
|
|
@ -30,8 +29,7 @@ public class QueueRepository {
|
|||
}
|
||||
|
||||
public LiveData<List<Queue>> getLiveQueue() {
|
||||
listLiveQueue = queueDao.getAll();
|
||||
return listLiveQueue;
|
||||
return queueDao.getAll();
|
||||
}
|
||||
|
||||
public List<Song> getSongs() {
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ public class ServerRepository {
|
|||
private static final String TAG = "QueueRepository";
|
||||
|
||||
private ServerDao serverDao;
|
||||
private LiveData<List<Server>> listLiveServer;
|
||||
|
||||
public ServerRepository(Application application) {
|
||||
AppDatabase database = AppDatabase.getInstance(application);
|
||||
|
|
@ -25,8 +24,7 @@ public class ServerRepository {
|
|||
}
|
||||
|
||||
public LiveData<List<Server>> getLiveServer() {
|
||||
listLiveServer = serverDao.getAll();
|
||||
return listLiveServer;
|
||||
return serverDao.getAll();
|
||||
}
|
||||
|
||||
public void insert(Server server) {
|
||||
|
|
|
|||
|
|
@ -1,13 +0,0 @@
|
|||
package com.cappielloantonio.play.subsonic.base;
|
||||
|
||||
public class SubsonicIncompatibilityException extends RuntimeException {
|
||||
private final Version serverApiVersion;
|
||||
private final Version minClientApiVersion;
|
||||
|
||||
public SubsonicIncompatibilityException(Version serverApiVersion, Version minClientApiVersion) {
|
||||
super(String.format("Server API version %s is lower than minimal supported API version %s.", serverApiVersion, minClientApiVersion));
|
||||
|
||||
this.serverApiVersion = serverApiVersion;
|
||||
this.minClientApiVersion = minClientApiVersion;
|
||||
}
|
||||
}
|
||||
|
|
@ -36,7 +36,6 @@ public class AlbumCatalogueFragment extends Fragment {
|
|||
private AlbumCatalogueViewModel albumCatalogueViewModel;
|
||||
|
||||
private AlbumCatalogueAdapter albumAdapter;
|
||||
private GridLayoutManager gridLayoutManager;
|
||||
|
||||
@Override
|
||||
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
|
|
@ -101,7 +100,7 @@ public class AlbumCatalogueFragment extends Fragment {
|
|||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
private void initAlbumCatalogueView() {
|
||||
gridLayoutManager = new GridLayoutManager(requireContext(), 2);
|
||||
GridLayoutManager gridLayoutManager = new GridLayoutManager(requireContext(), 2);
|
||||
|
||||
bind.albumCatalogueRecyclerView.setLayoutManager(gridLayoutManager);
|
||||
bind.albumCatalogueRecyclerView.addItemDecoration(new GridItemDecoration(2, 20, false));
|
||||
|
|
|
|||
|
|
@ -44,18 +44,6 @@ public class AlbumBottomSheetDialog extends BottomSheetDialogFragment implements
|
|||
private AlbumBottomSheetViewModel albumBottomSheetViewModel;
|
||||
private Album album;
|
||||
|
||||
private ImageView coverAlbum;
|
||||
private TextView titleAlbum;
|
||||
private TextView artistAlbum;
|
||||
private ToggleButton favoriteToggle;
|
||||
|
||||
private TextView playRadio;
|
||||
private TextView playRandom;
|
||||
private TextView playNext;
|
||||
private TextView addToQueue;
|
||||
private TextView Download;
|
||||
private TextView goToArtist;
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
|
|
@ -74,28 +62,28 @@ public class AlbumBottomSheetDialog extends BottomSheetDialogFragment implements
|
|||
private void init(View view) {
|
||||
activity = (MainActivity) requireActivity();
|
||||
|
||||
coverAlbum = view.findViewById(R.id.album_cover_image_view);
|
||||
ImageView coverAlbum = view.findViewById(R.id.album_cover_image_view);
|
||||
CustomGlideRequest.Builder
|
||||
.from(requireContext(), albumBottomSheetViewModel.getAlbum().getPrimary(), CustomGlideRequest.ALBUM_PIC, null)
|
||||
.build()
|
||||
.transform(new RoundedCorners(CustomGlideRequest.CORNER_RADIUS))
|
||||
.into(coverAlbum);
|
||||
|
||||
titleAlbum = view.findViewById(R.id.album_title_text_view);
|
||||
TextView titleAlbum = view.findViewById(R.id.album_title_text_view);
|
||||
titleAlbum.setText(MusicUtil.getReadableString(albumBottomSheetViewModel.getAlbum().getTitle()));
|
||||
titleAlbum.setSelected(true);
|
||||
|
||||
artistAlbum = view.findViewById(R.id.album_artist_text_view);
|
||||
TextView artistAlbum = view.findViewById(R.id.album_artist_text_view);
|
||||
artistAlbum.setText(MusicUtil.getReadableString(albumBottomSheetViewModel.getAlbum().getArtistName()));
|
||||
|
||||
favoriteToggle = view.findViewById(R.id.button_favorite);
|
||||
ToggleButton favoriteToggle = view.findViewById(R.id.button_favorite);
|
||||
favoriteToggle.setChecked(albumBottomSheetViewModel.getAlbum().isFavorite());
|
||||
favoriteToggle.setOnClickListener(v -> {
|
||||
albumBottomSheetViewModel.setFavorite();
|
||||
dismissBottomSheet();
|
||||
});
|
||||
|
||||
playRadio = view.findViewById(R.id.play_radio_text_view);
|
||||
TextView playRadio = view.findViewById(R.id.play_radio_text_view);
|
||||
playRadio.setOnClickListener(v -> {
|
||||
AlbumRepository albumRepository = new AlbumRepository(App.getInstance());
|
||||
albumRepository.getInstantMix(album, 20, new MediaCallback() {
|
||||
|
|
@ -125,7 +113,7 @@ public class AlbumBottomSheetDialog extends BottomSheetDialogFragment implements
|
|||
});
|
||||
});
|
||||
|
||||
playRandom = view.findViewById(R.id.play_random_text_view);
|
||||
TextView playRandom = view.findViewById(R.id.play_random_text_view);
|
||||
playRandom.setOnClickListener(v -> {
|
||||
AlbumRepository albumRepository = new AlbumRepository(App.getInstance());
|
||||
albumRepository.getAlbumTracks(album.getId()).observe(requireActivity(), songs -> {
|
||||
|
|
@ -141,7 +129,7 @@ public class AlbumBottomSheetDialog extends BottomSheetDialogFragment implements
|
|||
});
|
||||
});
|
||||
|
||||
playNext = view.findViewById(R.id.play_next_text_view);
|
||||
TextView playNext = view.findViewById(R.id.play_next_text_view);
|
||||
playNext.setOnClickListener(v -> {
|
||||
albumBottomSheetViewModel.getAlbumTracks().observe(requireActivity(), songs -> {
|
||||
MusicPlayerRemote.playNext(songs);
|
||||
|
|
@ -150,7 +138,7 @@ public class AlbumBottomSheetDialog extends BottomSheetDialogFragment implements
|
|||
});
|
||||
});
|
||||
|
||||
addToQueue = view.findViewById(R.id.add_to_queue_text_view);
|
||||
TextView addToQueue = view.findViewById(R.id.add_to_queue_text_view);
|
||||
addToQueue.setOnClickListener(v -> {
|
||||
albumBottomSheetViewModel.getAlbumTracks().observe(requireActivity(), songs -> {
|
||||
MusicPlayerRemote.enqueue(songs);
|
||||
|
|
@ -158,15 +146,15 @@ public class AlbumBottomSheetDialog extends BottomSheetDialogFragment implements
|
|||
});
|
||||
});
|
||||
|
||||
Download = view.findViewById(R.id.download_text_view);
|
||||
Download.setOnClickListener(v -> {
|
||||
TextView download = view.findViewById(R.id.download_text_view);
|
||||
download.setOnClickListener(v -> {
|
||||
albumBottomSheetViewModel.getAlbumTracks().observe(requireActivity(), songs -> {
|
||||
DownloadUtil.getDownloadTracker(requireContext()).toggleDownload(songs);
|
||||
dismissBottomSheet();
|
||||
});
|
||||
});
|
||||
|
||||
goToArtist = view.findViewById(R.id.go_to_artist_text_view);
|
||||
TextView goToArtist = view.findViewById(R.id.go_to_artist_text_view);
|
||||
goToArtist.setOnClickListener(v -> {
|
||||
albumBottomSheetViewModel.getArtist().observe(requireActivity(), artist -> {
|
||||
if (artist != null) {
|
||||
|
|
|
|||
|
|
@ -41,13 +41,6 @@ public class ArtistBottomSheetDialog extends BottomSheetDialogFragment implement
|
|||
private ArtistBottomSheetViewModel artistBottomSheetViewModel;
|
||||
private Artist artist;
|
||||
|
||||
private ImageView coverArtist;
|
||||
private TextView nameArtist;
|
||||
private ToggleButton favoriteToggle;
|
||||
|
||||
private TextView playRadio;
|
||||
private TextView playRandom;
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
|
|
@ -66,25 +59,25 @@ public class ArtistBottomSheetDialog extends BottomSheetDialogFragment implement
|
|||
private void init(View view) {
|
||||
activity = (MainActivity) requireActivity();
|
||||
|
||||
coverArtist = view.findViewById(R.id.artist_cover_image_view);
|
||||
ImageView coverArtist = view.findViewById(R.id.artist_cover_image_view);
|
||||
CustomGlideRequest.Builder
|
||||
.from(requireContext(), artistBottomSheetViewModel.getArtist().getPrimary(), CustomGlideRequest.ARTIST_PIC, null)
|
||||
.build()
|
||||
.transform(new RoundedCorners(CustomGlideRequest.CORNER_RADIUS))
|
||||
.into(coverArtist);
|
||||
|
||||
nameArtist = view.findViewById(R.id.song_title_text_view);
|
||||
TextView nameArtist = view.findViewById(R.id.song_title_text_view);
|
||||
nameArtist.setText(MusicUtil.getReadableString(artistBottomSheetViewModel.getArtist().getName()));
|
||||
nameArtist.setSelected(true);
|
||||
|
||||
favoriteToggle = view.findViewById(R.id.button_favorite);
|
||||
ToggleButton favoriteToggle = view.findViewById(R.id.button_favorite);
|
||||
favoriteToggle.setChecked(artistBottomSheetViewModel.getArtist().isFavorite());
|
||||
favoriteToggle.setOnClickListener(v -> {
|
||||
artistBottomSheetViewModel.setFavorite();
|
||||
dismissBottomSheet();
|
||||
});
|
||||
|
||||
playRadio = view.findViewById(R.id.play_radio_text_view);
|
||||
TextView playRadio = view.findViewById(R.id.play_radio_text_view);
|
||||
playRadio.setOnClickListener(v -> {
|
||||
ArtistRepository artistRepository = new ArtistRepository(App.getInstance());
|
||||
artistRepository.getInstantMix(artist, 20, new MediaCallback() {
|
||||
|
|
@ -114,7 +107,7 @@ public class ArtistBottomSheetDialog extends BottomSheetDialogFragment implement
|
|||
});
|
||||
});
|
||||
|
||||
playRandom = view.findViewById(R.id.play_random_text_view);
|
||||
TextView playRandom = view.findViewById(R.id.play_random_text_view);
|
||||
playRandom.setOnClickListener(v -> {
|
||||
ArtistRepository artistRepository = new ArtistRepository(App.getInstance());
|
||||
artistRepository.getArtistRandomSong(requireActivity(), artist, 20).observe(requireActivity(), songs -> {
|
||||
|
|
|
|||
|
|
@ -43,19 +43,7 @@ public class SongBottomSheetDialog extends BottomSheetDialogFragment implements
|
|||
private SongBottomSheetViewModel songBottomSheetViewModel;
|
||||
private Song song;
|
||||
|
||||
private ImageView coverSong;
|
||||
private TextView titleSong;
|
||||
private TextView artistSong;
|
||||
private ToggleButton favoriteToggle;
|
||||
|
||||
private TextView playRadio;
|
||||
private TextView playNext;
|
||||
private TextView addToQueue;
|
||||
private TextView rate;
|
||||
private TextView download;
|
||||
private TextView addToPlaylist;
|
||||
private TextView goToAlbum;
|
||||
private TextView goToArtist;
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
|
|
@ -68,28 +56,28 @@ public class SongBottomSheetDialog extends BottomSheetDialogFragment implements
|
|||
songBottomSheetViewModel.setSong(song);
|
||||
|
||||
init(view);
|
||||
initDownloadedUI();
|
||||
initDownloadedUI(view.findViewById(R.id.download_text_view));
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
private void init(View view) {
|
||||
coverSong = view.findViewById(R.id.song_cover_image_view);
|
||||
ImageView coverSong = view.findViewById(R.id.song_cover_image_view);
|
||||
CustomGlideRequest.Builder
|
||||
.from(requireContext(), songBottomSheetViewModel.getSong().getPrimary(), CustomGlideRequest.SONG_PIC, null)
|
||||
.build()
|
||||
.transform(new RoundedCorners(CustomGlideRequest.CORNER_RADIUS))
|
||||
.into(coverSong);
|
||||
|
||||
titleSong = view.findViewById(R.id.song_title_text_view);
|
||||
TextView titleSong = view.findViewById(R.id.song_title_text_view);
|
||||
titleSong.setText(MusicUtil.getReadableString(songBottomSheetViewModel.getSong().getTitle()));
|
||||
|
||||
titleSong.setSelected(true);
|
||||
|
||||
artistSong = view.findViewById(R.id.song_artist_text_view);
|
||||
TextView artistSong = view.findViewById(R.id.song_artist_text_view);
|
||||
artistSong.setText(MusicUtil.getReadableString(songBottomSheetViewModel.getSong().getArtistName()));
|
||||
|
||||
favoriteToggle = view.findViewById(R.id.button_favorite);
|
||||
ToggleButton favoriteToggle = view.findViewById(R.id.button_favorite);
|
||||
favoriteToggle.setChecked(songBottomSheetViewModel.getSong().isFavorite());
|
||||
favoriteToggle.setOnClickListener(v -> {
|
||||
songBottomSheetViewModel.setFavorite();
|
||||
|
|
@ -107,7 +95,7 @@ public class SongBottomSheetDialog extends BottomSheetDialogFragment implements
|
|||
return true;
|
||||
});
|
||||
|
||||
playRadio = view.findViewById(R.id.play_radio_text_view);
|
||||
TextView playRadio = view.findViewById(R.id.play_radio_text_view);
|
||||
playRadio.setOnClickListener(v -> {
|
||||
List<Song> opener = new ArrayList<>();
|
||||
opener.add(song);
|
||||
|
|
@ -135,21 +123,21 @@ public class SongBottomSheetDialog extends BottomSheetDialogFragment implements
|
|||
dismissBottomSheet();
|
||||
});
|
||||
|
||||
playNext = view.findViewById(R.id.play_next_text_view);
|
||||
TextView playNext = view.findViewById(R.id.play_next_text_view);
|
||||
playNext.setOnClickListener(v -> {
|
||||
MusicPlayerRemote.playNext(song);
|
||||
((MainActivity) requireActivity()).isBottomSheetInPeek(true);
|
||||
dismissBottomSheet();
|
||||
});
|
||||
|
||||
addToQueue = view.findViewById(R.id.add_to_queue_text_view);
|
||||
TextView addToQueue = view.findViewById(R.id.add_to_queue_text_view);
|
||||
addToQueue.setOnClickListener(v -> {
|
||||
MusicPlayerRemote.enqueue(song);
|
||||
((MainActivity) requireActivity()).isBottomSheetInPeek(true);
|
||||
dismissBottomSheet();
|
||||
});
|
||||
|
||||
rate = view.findViewById(R.id.rate_text_view);
|
||||
TextView rate = view.findViewById(R.id.rate_text_view);
|
||||
rate.setOnClickListener(v -> {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putParcelable("song_object", song);
|
||||
|
|
@ -167,7 +155,7 @@ public class SongBottomSheetDialog extends BottomSheetDialogFragment implements
|
|||
dismissBottomSheet();
|
||||
});
|
||||
|
||||
addToPlaylist = view.findViewById(R.id.add_to_playlist_text_view);
|
||||
TextView addToPlaylist = view.findViewById(R.id.add_to_playlist_text_view);
|
||||
addToPlaylist.setOnClickListener(v -> {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putParcelable("song_object", song);
|
||||
|
|
@ -179,7 +167,7 @@ public class SongBottomSheetDialog extends BottomSheetDialogFragment implements
|
|||
dismissBottomSheet();
|
||||
});
|
||||
|
||||
goToAlbum = view.findViewById(R.id.go_to_album_text_view);
|
||||
TextView goToAlbum = view.findViewById(R.id.go_to_album_text_view);
|
||||
goToAlbum.setOnClickListener(v -> {
|
||||
songBottomSheetViewModel.getAlbum().observe(requireActivity(), album -> {
|
||||
if (album != null) {
|
||||
|
|
@ -193,7 +181,7 @@ public class SongBottomSheetDialog extends BottomSheetDialogFragment implements
|
|||
});
|
||||
});
|
||||
|
||||
goToArtist = view.findViewById(R.id.go_to_artist_text_view);
|
||||
TextView goToArtist = view.findViewById(R.id.go_to_artist_text_view);
|
||||
goToArtist.setOnClickListener(v -> {
|
||||
songBottomSheetViewModel.getArtist().observe(requireActivity(), artist -> {
|
||||
if (artist != null) {
|
||||
|
|
@ -217,7 +205,7 @@ public class SongBottomSheetDialog extends BottomSheetDialogFragment implements
|
|||
dismiss();
|
||||
}
|
||||
|
||||
private void initDownloadedUI() {
|
||||
private void initDownloadedUI(TextView download) {
|
||||
if (DownloadUtil.getDownloadTracker(requireContext()).isDownloaded(song)) {
|
||||
download.setText("Remove");
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -26,14 +26,10 @@ import retrofit2.Callback;
|
|||
public class AlbumCatalogueViewModel extends AndroidViewModel {
|
||||
private MutableLiveData<List<Album>> albumList = new MutableLiveData<>(new ArrayList<>());
|
||||
|
||||
private AlbumRepository albumRepository;
|
||||
private String query = "";
|
||||
private int page = 0;
|
||||
|
||||
public AlbumCatalogueViewModel(@NonNull Application application) {
|
||||
super(application);
|
||||
|
||||
albumRepository = new AlbumRepository(application);
|
||||
}
|
||||
|
||||
public LiveData<List<Album>> getAlbumList() {
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ import com.cappielloantonio.play.repository.SongRepository;
|
|||
import java.util.List;
|
||||
|
||||
public class AlbumPageViewModel extends AndroidViewModel {
|
||||
private SongRepository songRepository;
|
||||
private AlbumRepository albumRepository;
|
||||
private ArtistRepository artistRepository;
|
||||
|
||||
|
|
@ -29,7 +28,6 @@ public class AlbumPageViewModel extends AndroidViewModel {
|
|||
public AlbumPageViewModel(@NonNull Application application) {
|
||||
super(application);
|
||||
|
||||
songRepository = new SongRepository(application);
|
||||
albumRepository = new AlbumRepository(application);
|
||||
artistRepository = new ArtistRepository(application);
|
||||
}
|
||||
|
|
@ -50,8 +48,4 @@ public class AlbumPageViewModel extends AndroidViewModel {
|
|||
public LiveData<Artist> getArtist() {
|
||||
return artistRepository.getArtistInfo(album.getArtistId());
|
||||
}
|
||||
|
||||
public LiveData<Album> getAlbumInfo() {
|
||||
return albumRepository.getAlbumInfo(album.getId());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ import com.cappielloantonio.play.repository.ArtistRepository;
|
|||
|
||||
public class ArtistBottomSheetViewModel extends AndroidViewModel {
|
||||
private AlbumRepository albumRepository;
|
||||
private ArtistRepository artistRepository;
|
||||
|
||||
private Artist artist;
|
||||
|
||||
|
|
@ -19,7 +18,6 @@ public class ArtistBottomSheetViewModel extends AndroidViewModel {
|
|||
super(application);
|
||||
|
||||
albumRepository = new AlbumRepository(application);
|
||||
artistRepository = new ArtistRepository(application);
|
||||
}
|
||||
|
||||
public Artist getArtist() {
|
||||
|
|
|
|||
|
|
@ -26,13 +26,8 @@ import retrofit2.Callback;
|
|||
public class ArtistCatalogueViewModel extends AndroidViewModel {
|
||||
private MutableLiveData<List<Artist>> artistList = new MutableLiveData<>(new ArrayList<>());
|
||||
|
||||
private ArtistRepository artistRepository;
|
||||
private String query = "";
|
||||
|
||||
public ArtistCatalogueViewModel(@NonNull Application application) {
|
||||
super(application);
|
||||
|
||||
artistRepository = new ArtistRepository(application);
|
||||
}
|
||||
|
||||
public LiveData<List<Artist>> getArtistList() {
|
||||
|
|
|
|||
|
|
@ -18,14 +18,11 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
public class ArtistPageViewModel extends AndroidViewModel {
|
||||
private SongRepository songRepository;
|
||||
private AlbumRepository albumRepository;
|
||||
private ArtistRepository artistRepository;
|
||||
|
||||
private List<Song> randomList = new ArrayList<>();
|
||||
private LiveData<List<Song>> songList = new MutableLiveData<>();
|
||||
private LiveData<List<Album>> albumList = new MutableLiveData<>();
|
||||
private LiveData<List<Artist>> artistList = new MutableLiveData<>();
|
||||
private LiveData<Artist> artistInfo = new MutableLiveData<>();
|
||||
|
||||
private Artist artist;
|
||||
|
|
@ -33,7 +30,6 @@ public class ArtistPageViewModel extends AndroidViewModel {
|
|||
public ArtistPageViewModel(@NonNull Application application) {
|
||||
super(application);
|
||||
|
||||
songRepository = new SongRepository(application);
|
||||
albumRepository = new AlbumRepository(application);
|
||||
artistRepository = new ArtistRepository(application);
|
||||
}
|
||||
|
|
@ -48,11 +44,6 @@ public class ArtistPageViewModel extends AndroidViewModel {
|
|||
return artistInfo;
|
||||
}
|
||||
|
||||
public List<Song> getArtistRandomSongList() {
|
||||
// randomList = songRepository.getArtistListLiveRandomSong(artist.id);
|
||||
return randomList;
|
||||
}
|
||||
|
||||
public LiveData<List<Song>> getArtistTopSongList(int count) {
|
||||
songList = artistRepository.getTopSongs(artist.getName(), count);
|
||||
return songList;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ import java.util.List;
|
|||
public class FilterViewModel extends AndroidViewModel {
|
||||
private GenreRepository genreRepository;
|
||||
|
||||
private LiveData<List<Genre>> allGenres;
|
||||
private ArrayList<String> selectedFiltersID = new ArrayList<>();
|
||||
private ArrayList<String> selectedFilters = new ArrayList<>();
|
||||
|
||||
|
|
@ -26,8 +25,7 @@ public class FilterViewModel extends AndroidViewModel {
|
|||
}
|
||||
|
||||
public LiveData<List<Genre>> getGenreList() {
|
||||
allGenres = genreRepository.getGenres(false, -1);
|
||||
return allGenres;
|
||||
return genreRepository.getGenres(false, -1);
|
||||
}
|
||||
|
||||
public void addFilter(String filterID, String filterName) {
|
||||
|
|
|
|||
|
|
@ -15,8 +15,6 @@ import java.util.List;
|
|||
public class PlaylistPageViewModel extends AndroidViewModel {
|
||||
private PlaylistRepository playlistRepository;
|
||||
|
||||
private MutableLiveData<List<Song>> songLiveList = new MutableLiveData<>();
|
||||
|
||||
private Playlist playlist;
|
||||
|
||||
public PlaylistPageViewModel(@NonNull Application application) {
|
||||
|
|
@ -26,8 +24,7 @@ public class PlaylistPageViewModel extends AndroidViewModel {
|
|||
}
|
||||
|
||||
public MutableLiveData<List<Song>> getPlaylistSongLiveList() {
|
||||
songLiveList = playlistRepository.getPlaylistSongs(playlist.getId());
|
||||
return songLiveList;
|
||||
return playlistRepository.getPlaylistSongs(playlist.getId());
|
||||
}
|
||||
|
||||
public Playlist getPlaylist() {
|
||||
|
|
|
|||
|
|
@ -26,24 +26,15 @@ public class SearchViewModel extends AndroidViewModel {
|
|||
|
||||
private String query = "";
|
||||
|
||||
private SongRepository songRepository;
|
||||
private AlbumRepository albumRepository;
|
||||
private ArtistRepository artistRepository;
|
||||
private GenreRepository genreRepository;
|
||||
private SearchingRepository searchingRepository;
|
||||
|
||||
private LiveData<List<Song>> searchSong = new MutableLiveData<>(new ArrayList<>());
|
||||
private LiveData<List<Album>> searchAlbum = new MutableLiveData<>(new ArrayList<>());
|
||||
private LiveData<List<Artist>> searchArtist = new MutableLiveData<>(new ArrayList<>());
|
||||
private LiveData<List<Genre>> searchGenre = new MutableLiveData<>(new ArrayList<>());
|
||||
|
||||
public SearchViewModel(@NonNull Application application) {
|
||||
super(application);
|
||||
|
||||
songRepository = new SongRepository(application);
|
||||
albumRepository = new AlbumRepository(application);
|
||||
artistRepository = new ArtistRepository(application);
|
||||
genreRepository = new GenreRepository(application);
|
||||
searchingRepository = new SearchingRepository(application);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,8 +33,6 @@ public class SongListPageViewModel extends AndroidViewModel {
|
|||
|
||||
public int year = 0;
|
||||
|
||||
private MutableLiveData<List<Song>> songList;
|
||||
|
||||
public SongListPageViewModel(@NonNull Application application) {
|
||||
super(application);
|
||||
|
||||
|
|
@ -44,7 +42,7 @@ public class SongListPageViewModel extends AndroidViewModel {
|
|||
}
|
||||
|
||||
public LiveData<List<Song>> getSongList() {
|
||||
songList = new MutableLiveData<>(new ArrayList<>());
|
||||
MutableLiveData<List<Song>> songList = new MutableLiveData<>(new ArrayList<>());
|
||||
|
||||
switch (title) {
|
||||
case Song.RECENTLY_PLAYED:
|
||||
|
|
|
|||
|
|
@ -1,125 +0,0 @@
|
|||
package com.cappielloantonio.play.viewmodel;
|
||||
|
||||
import android.app.Application;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.AndroidViewModel;
|
||||
|
||||
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 com.cappielloantonio.play.repository.SongRepository;
|
||||
import com.cappielloantonio.play.subsonic.models.AlbumID3;
|
||||
import com.cappielloantonio.play.subsonic.models.ArtistID3;
|
||||
import com.cappielloantonio.play.subsonic.models.Genre;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SyncViewModel extends AndroidViewModel {
|
||||
private static final String TAG = "SyncViewModel";
|
||||
|
||||
private boolean syncAlbum = false;
|
||||
private boolean syncArtist = false;
|
||||
private boolean syncGenres = false;
|
||||
private boolean syncPlaylist = false;
|
||||
private boolean syncSong = false;
|
||||
|
||||
private ArrayList<AlbumID3> albumList = new ArrayList<>();
|
||||
private ArrayList<ArtistID3> artistList = new ArrayList<>();
|
||||
private ArrayList<Genre> genreList = new ArrayList<>();
|
||||
private ArrayList<Playlist> playlistList = new ArrayList<>();
|
||||
private ArrayList<Song> songList = new ArrayList<>();
|
||||
|
||||
private final SongRepository songRepository;
|
||||
private AlbumRepository albumRepository;
|
||||
private ArtistRepository artistRepository;
|
||||
private PlaylistRepository playlistRepository;
|
||||
private GenreRepository genreRepository;
|
||||
|
||||
public SyncViewModel(@NonNull Application application) {
|
||||
super(application);
|
||||
|
||||
songRepository = new SongRepository(application);
|
||||
albumRepository = new AlbumRepository(application);
|
||||
artistRepository = new ArtistRepository(application);
|
||||
playlistRepository = new PlaylistRepository(application);
|
||||
genreRepository = new GenreRepository(application);
|
||||
}
|
||||
|
||||
public void setArguemnts(Bundle bundle) {
|
||||
syncAlbum = bundle.getBoolean("sync_album", false);
|
||||
syncArtist = bundle.getBoolean("sync_artist", false);
|
||||
syncGenres = bundle.getBoolean("sync_genres", false);
|
||||
syncPlaylist = bundle.getBoolean("sync_playlist", false);
|
||||
syncSong = bundle.getBoolean("sync_song", false);
|
||||
}
|
||||
|
||||
public boolean isSyncAlbum() {
|
||||
return syncAlbum;
|
||||
}
|
||||
|
||||
public boolean isSyncArtist() {
|
||||
return syncArtist;
|
||||
}
|
||||
|
||||
public boolean isSyncGenres() {
|
||||
return syncGenres;
|
||||
}
|
||||
|
||||
public boolean isSyncPlaylist() {
|
||||
return syncPlaylist;
|
||||
}
|
||||
|
||||
public boolean isSyncSong() {
|
||||
return syncSong;
|
||||
}
|
||||
|
||||
public ArrayList<AlbumID3> getAlbumList() {
|
||||
return albumList;
|
||||
}
|
||||
|
||||
public void addToAlbumList(List<AlbumID3> albumList) {
|
||||
this.albumList.addAll(albumList);
|
||||
}
|
||||
|
||||
public ArrayList<ArtistID3> getArtistList() {
|
||||
return artistList;
|
||||
}
|
||||
|
||||
public void setArtistList(ArrayList<ArtistID3> 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 addToSongList(ArrayList<Song> songList) {
|
||||
this.songList.addAll(songList);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue