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