mirror of
https://github.com/antebudimir/tempus.git
synced 2025-12-31 17:43:32 +00:00
Removed unused constants
This commit is contained in:
parent
cc7775c986
commit
d16db8e36d
8 changed files with 9 additions and 44 deletions
|
|
@ -5,7 +5,6 @@ import kotlinx.android.parcel.Parcelize
|
|||
|
||||
@Parcelize
|
||||
class NowPlayingEntry(
|
||||
// TODO
|
||||
@SerializedName("_id")
|
||||
override val id: String
|
||||
) : Child(id) {
|
||||
|
|
|
|||
|
|
@ -81,7 +81,6 @@ public class AlbumAdapter extends RecyclerView.Adapter<AlbumAdapter.ViewHolder>
|
|||
private void onClick() {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putParcelable("album_object", albums.get(getBindingAdapterPosition()));
|
||||
bundle.putBoolean("is_offline", false);
|
||||
|
||||
click.onAlbumClick(bundle);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,7 +81,6 @@ public class AlbumArtistPageOrSimilarAdapter extends RecyclerView.Adapter<AlbumA
|
|||
private void onClick() {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putParcelable("album_object", albums.get(getBindingAdapterPosition()));
|
||||
bundle.putBoolean("is_offline", false);
|
||||
|
||||
click.onAlbumClick(bundle);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -133,7 +133,6 @@ public class AlbumCatalogueAdapter extends RecyclerView.Adapter<AlbumCatalogueAd
|
|||
private void onClick() {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putParcelable("album_object", albums.get(getBindingAdapterPosition()));
|
||||
bundle.putBoolean("is_offline", false);
|
||||
|
||||
click.onAlbumClick(bundle);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,7 +84,6 @@ public class AlbumHorizontalAdapter extends RecyclerView.Adapter<AlbumHorizontal
|
|||
private void onClick() {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putParcelable("album_object", albums.get(getBindingAdapterPosition()));
|
||||
bundle.putBoolean("is_offline", false);
|
||||
|
||||
click.onAlbumClick(bundle);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,13 +103,11 @@ public class AlbumPageFragment extends Fragment implements ClickCallback {
|
|||
@Override
|
||||
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
|
||||
if (item.getItemId() == R.id.action_download_album) {
|
||||
albumPageViewModel.getAlbumSongLiveList(getViewLifecycleOwner()).observe(getViewLifecycleOwner(), songs -> {
|
||||
if (isVisible() && getActivity() != null) {
|
||||
DownloadUtil.getDownloadTracker(requireContext()).download(
|
||||
MappingUtil.mapMediaItems(songs, false),
|
||||
songs.stream().map(Download::new).collect(Collectors.toList())
|
||||
);
|
||||
}
|
||||
albumPageViewModel.getAlbumSongLiveList().observe(getViewLifecycleOwner(), songs -> {
|
||||
DownloadUtil.getDownloadTracker(requireContext()).download(
|
||||
MappingUtil.mapMediaItems(songs, false),
|
||||
songs.stream().map(Download::new).collect(Collectors.toList())
|
||||
);
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
|
@ -119,7 +117,6 @@ public class AlbumPageFragment extends Fragment implements ClickCallback {
|
|||
|
||||
private void init() {
|
||||
albumPageViewModel.setAlbum(requireArguments().getParcelable("album_object"));
|
||||
albumPageViewModel.setOffline(requireArguments().getBoolean("is_offline"));
|
||||
}
|
||||
|
||||
private void initAppBar() {
|
||||
|
|
@ -153,7 +150,7 @@ public class AlbumPageFragment extends Fragment implements ClickCallback {
|
|||
}
|
||||
|
||||
private void initMusicButton() {
|
||||
albumPageViewModel.getAlbumSongLiveList(getViewLifecycleOwner()).observe(getViewLifecycleOwner(), songs -> {
|
||||
albumPageViewModel.getAlbumSongLiveList().observe(getViewLifecycleOwner(), songs -> {
|
||||
if (bind != null && !songs.isEmpty()) {
|
||||
bind.albumPagePlayButton.setOnClickListener(v -> {
|
||||
MediaManager.startQueue(mediaBrowserListenableFuture, requireContext(), songs, 0);
|
||||
|
|
@ -189,7 +186,7 @@ public class AlbumPageFragment extends Fragment implements ClickCallback {
|
|||
songHorizontalAdapter = new SongHorizontalAdapter(this, false);
|
||||
bind.songRecyclerView.setAdapter(songHorizontalAdapter);
|
||||
|
||||
albumPageViewModel.getAlbumSongLiveList(getViewLifecycleOwner()).observe(getViewLifecycleOwner(), songs -> songHorizontalAdapter.setItems(songs));
|
||||
albumPageViewModel.getAlbumSongLiveList().observe(getViewLifecycleOwner(), songs -> songHorizontalAdapter.setItems(songs));
|
||||
}
|
||||
|
||||
private void initializeMediaBrowser() {
|
||||
|
|
|
|||
|
|
@ -58,14 +58,6 @@ public class AlbumListPageViewModel extends AndroidViewModel {
|
|||
albumList.postValue(albums.subList(0, Math.min(20, albums.size())));
|
||||
});
|
||||
break;
|
||||
case Album.DOWNLOADED:
|
||||
// TODO
|
||||
// downloadRepository.getLiveDownload().observe(owner, downloads -> albumList.setValue(MappingUtil.mapDownloadToAlbum(downloads)));
|
||||
break;
|
||||
case Album.FROM_ARTIST:
|
||||
// TODO
|
||||
// downloadRepository.getLiveDownloadFromArtist(artist.getId()).observe(owner, downloads -> albumList.setValue(MappingUtil.mapDownloadToAlbum(downloads)));
|
||||
break;
|
||||
}
|
||||
|
||||
return albumList;
|
||||
|
|
|
|||
|
|
@ -4,13 +4,10 @@ import android.app.Application;
|
|||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.AndroidViewModel;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
import androidx.lifecycle.LiveData;
|
||||
import androidx.lifecycle.MutableLiveData;
|
||||
|
||||
import com.cappielloantonio.play.repository.AlbumRepository;
|
||||
import com.cappielloantonio.play.repository.ArtistRepository;
|
||||
import com.cappielloantonio.play.repository.DownloadRepository;
|
||||
import com.cappielloantonio.play.subsonic.models.AlbumID3;
|
||||
import com.cappielloantonio.play.subsonic.models.ArtistID3;
|
||||
import com.cappielloantonio.play.subsonic.models.Child;
|
||||
|
|
@ -20,30 +17,18 @@ import java.util.List;
|
|||
public class AlbumPageViewModel extends AndroidViewModel {
|
||||
private final AlbumRepository albumRepository;
|
||||
private final ArtistRepository artistRepository;
|
||||
private final DownloadRepository downloadRepository;
|
||||
|
||||
private MutableLiveData<List<Child>> songLiveList = new MutableLiveData<>();
|
||||
|
||||
private AlbumID3 album;
|
||||
private boolean isOffline;
|
||||
|
||||
public AlbumPageViewModel(@NonNull Application application) {
|
||||
super(application);
|
||||
|
||||
albumRepository = new AlbumRepository();
|
||||
artistRepository = new ArtistRepository();
|
||||
downloadRepository = new DownloadRepository();
|
||||
}
|
||||
|
||||
public LiveData<List<Child>> getAlbumSongLiveList(LifecycleOwner owner) {
|
||||
if (isOffline) {
|
||||
// TODO
|
||||
//downloadRepository.getLiveDownloadFromAlbum(album.getId()).observe(owner, downloads -> songLiveList.postValue(MappingUtil.mapDownloadToMedia(downloads)));
|
||||
} else {
|
||||
songLiveList = albumRepository.getAlbumTracks(album.getId());
|
||||
}
|
||||
|
||||
return songLiveList;
|
||||
public LiveData<List<Child>> getAlbumSongLiveList() {
|
||||
return albumRepository.getAlbumTracks(album.getId());
|
||||
}
|
||||
|
||||
public AlbumID3 getAlbum() {
|
||||
|
|
@ -54,10 +39,6 @@ public class AlbumPageViewModel extends AndroidViewModel {
|
|||
this.album = album;
|
||||
}
|
||||
|
||||
public void setOffline(boolean offline) {
|
||||
isOffline = offline;
|
||||
}
|
||||
|
||||
public LiveData<ArtistID3> getArtist() {
|
||||
return artistRepository.getArtistInfo(album.getArtistId());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue