First implementation of the panel dedicated to the download, divided by type of the downloaded resource

This commit is contained in:
CappielloAntonio 2021-08-28 16:54:12 +02:00
parent 8789b44e26
commit 23568bae9b
16 changed files with 609 additions and 102 deletions

8
.idea/misc.xml generated
View file

@ -7,6 +7,7 @@
<entry key="app/src/main/res/drawable-v24/ic_add.xml" value="0.27685185185185185" />
<entry key="app/src/main/res/drawable-v24/ic_download.xml" value="0.27685185185185185" />
<entry key="app/src/main/res/drawable-v24/ic_launcher_foreground.xml" value="0.2814814814814815" />
<entry key="app/src/main/res/drawable-v24/ic_play_for_work.xml" value="0.28055555555555556" />
<entry key="app/src/main/res/drawable-v24/ic_shuffle.xml" value="0.28055555555555556" />
<entry key="app/src/main/res/drawable-v24/ic_toolbar_motion_on.xml" value="0.28055555555555556" />
<entry key="app/src/main/res/drawable/bottom_nav_shape.xml" value="0.28055555555555556" />
@ -17,9 +18,12 @@
<entry key="app/src/main/res/drawable/ic_download_for_offline.xml" value="0.27685185185185185" />
<entry key="app/src/main/res/drawable/ic_downloading.xml" value="0.2722222222222222" />
<entry key="app/src/main/res/drawable/ic_drag_handle.xml" value="0.27685185185185185" />
<entry key="app/src/main/res/drawable/ic_favorite.xml" value="0.28055555555555556" />
<entry key="app/src/main/res/drawable/ic_favorites_outlined.xml" value="0.28055555555555556" />
<entry key="app/src/main/res/drawable/ic_feed.xml" value="0.28055555555555556" />
<entry key="app/src/main/res/drawable/ic_file_download.xml" value="0.2722222222222222" />
<entry key="app/src/main/res/drawable/ic_graphic_eq.xml" value="0.28055555555555556" />
<entry key="app/src/main/res/drawable/ic_home.xml" value="0.28055555555555556" />
<entry key="app/src/main/res/drawable/ic_launcher_background.xml" value="0.2814814814814815" />
<entry key="app/src/main/res/drawable/ic_more_vert.xml" value="0.28055555555555556" />
<entry key="app/src/main/res/drawable/ic_pause.xml" value="0.28055555555555556" />
@ -43,7 +47,8 @@
<entry key="app/src/main/res/layout/fragment_album_catalogue.xml" value="0.3229166666666667" />
<entry key="app/src/main/res/layout/fragment_album_page.xml" value="0.2769409038238702" />
<entry key="app/src/main/res/layout/fragment_artist_page.xml" value="0.1" />
<entry key="app/src/main/res/layout/fragment_home.xml" value="0.3229166666666667" />
<entry key="app/src/main/res/layout/fragment_download.xml" value="0.283363802559415" />
<entry key="app/src/main/res/layout/fragment_home.xml" value="0.283363802559415" />
<entry key="app/src/main/res/layout/fragment_login.xml" value="0.3166496424923391" />
<entry key="app/src/main/res/layout/fragment_player_bottom_sheet.xml" value="0.3166496424923391" />
<entry key="app/src/main/res/layout/fragment_playlist_catalogue.xml" value="0.3229166666666667" />
@ -72,6 +77,7 @@
<entry key="app/src/main/res/layout/item_player_now_playing_song.xml" value="0.3229166666666667" />
<entry key="app/src/main/res/layout/item_player_queue_song.xml" value="0.3229166666666667" />
<entry key="app/src/main/res/layout/player_body_bottom_sheet.xml" value="0.3229166666666667" />
<entry key="app/src/main/res/menu/bottom_nav_menu.xml" value="0.3229166666666667" />
<entry key="app/src/main/res/menu/login_page_menu.xml" value="0.3229166666666667" />
<entry key="app/src/main/res/menu/main_page_menu.xml" value="0.3229166666666667" />
<entry key="app/src/main/res/menu/toolbar_menu.xml" value="0.3229166666666667" />

View file

@ -52,6 +52,14 @@ public class Album implements Parcelable {
this.songs = MappingUtil.mapSong(albumWithSongsID3.getSongs());
}
public Album(Download download) {
this.id = download.getAlbumId();
this.title = download.getAlbumName();
this.artistId = download.getArtistId();
this.artistName = download.getArtistName();
this.primary = download.getPrimary();
}
public Album(AlbumInfo info) {
this.notes = info.getNotes();
}

View file

@ -76,6 +76,11 @@ public class Artist implements Parcelable {
this.name = name;
}
public Artist(Download download) {
this.id = download.getArtistId();
this.name = download.getArtistName();
}
public String getId() {
return id;
}

View file

@ -0,0 +1,240 @@
package com.cappielloantonio.play.ui.fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.view.ViewCompat;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProvider;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.PagerSnapHelper;
import androidx.recyclerview.widget.SnapHelper;
import androidx.viewpager2.widget.ViewPager2;
import com.cappielloantonio.play.R;
import com.cappielloantonio.play.adapter.AlbumAdapter;
import com.cappielloantonio.play.adapter.AlbumHorizontalAdapter;
import com.cappielloantonio.play.adapter.ArtistAdapter;
import com.cappielloantonio.play.adapter.ArtistHorizontalAdapter;
import com.cappielloantonio.play.adapter.DiscoverSongAdapter;
import com.cappielloantonio.play.adapter.SimilarTrackAdapter;
import com.cappielloantonio.play.adapter.SongHorizontalAdapter;
import com.cappielloantonio.play.adapter.TrackAdapter;
import com.cappielloantonio.play.adapter.YearAdapter;
import com.cappielloantonio.play.databinding.FragmentDownloadBinding;
import com.cappielloantonio.play.databinding.FragmentHomeBinding;
import com.cappielloantonio.play.helper.recyclerview.CustomLinearSnapHelper;
import com.cappielloantonio.play.helper.recyclerview.DotsIndicatorDecoration;
import com.cappielloantonio.play.model.Album;
import com.cappielloantonio.play.model.Artist;
import com.cappielloantonio.play.model.Song;
import com.cappielloantonio.play.ui.activity.MainActivity;
import com.cappielloantonio.play.util.MappingUtil;
import com.cappielloantonio.play.util.UIUtil;
import com.cappielloantonio.play.viewmodel.DownloadViewModel;
import com.cappielloantonio.play.viewmodel.HomeViewModel;
import java.util.Objects;
public class DownloadFragment extends Fragment {
private static final String TAG = "CategoriesFragment";
private FragmentDownloadBinding bind;
private MainActivity activity;
private DownloadViewModel downloadViewModel;
private ArtistHorizontalAdapter downloadedArtistAdapter;
private AlbumHorizontalAdapter downloadedAlbumAdapter;
private SongHorizontalAdapter downloadedTrackAdapter;
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setHasOptionsMenu(true);
}
@Override
public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
inflater.inflate(R.menu.main_page_menu, menu);
}
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
activity = (MainActivity) getActivity();
bind = FragmentDownloadBinding.inflate(inflater, container, false);
View view = bind.getRoot();
downloadViewModel = new ViewModelProvider(requireActivity()).get(DownloadViewModel.class);
init();
return view;
}
@Override
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
initAppBar();
initDownloadedArtistView();
initDownloadedAlbumView();
initDownloadedSongView();
}
@Override
public void onStart() {
super.onStart();
activity.setBottomNavigationBarVisibility(true);
activity.setBottomSheetVisibility(true);
}
@Override
public void onDestroyView() {
super.onDestroyView();
bind = null;
}
@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
switch (item.getItemId()) {
case R.id.action_search:
activity.navController.navigate(R.id.action_downloadFragment_to_searchFragment);
return true;
case R.id.action_settings:
activity.navController.navigate(R.id.action_downloadFragment_to_settingsFragment);
return true;
default:
break;
}
return false;
}
private void init() {
bind.downloadedArtistTextViewClickable.setOnClickListener(v -> {
Bundle bundle = new Bundle();
bundle.putString(Song.DOWNLOADED, Song.DOWNLOADED);
activity.navController.navigate(R.id.action_downloadFragment_to_artistListPageFragment, bundle);
});
bind.downloadedAlbumTextViewClickable.setOnClickListener(v -> {
Bundle bundle = new Bundle();
bundle.putString(Song.DOWNLOADED, Song.DOWNLOADED);
activity.navController.navigate(R.id.action_downloadFragment_to_albumListPageFragment, bundle);
});
bind.downloadedTracksTextViewClickable.setOnClickListener(v -> {
Bundle bundle = new Bundle();
bundle.putString(Song.DOWNLOADED, Song.DOWNLOADED);
activity.navController.navigate(R.id.action_downloadFragment_to_songListPageFragment, bundle);
});
}
private void initAppBar() {
activity.setSupportActionBar(bind.toolbar);
Objects.requireNonNull(bind.toolbar.getOverflowIcon()).setTint(requireContext().getResources().getColor(R.color.titleTextColor, null));
}
private void initDownloadedArtistView() {
bind.downloadedArtistRecyclerView.setHasFixedSize(true);
downloadedArtistAdapter = new ArtistHorizontalAdapter(requireContext());
bind.downloadedArtistRecyclerView.setAdapter(downloadedArtistAdapter);
downloadViewModel.getDownloadedArtists(requireActivity(), 20).observe(requireActivity(), artists -> {
if (artists == null) {
if (bind != null) bind.downloadDownloadedArtistPlaceholder.placeholder.setVisibility(View.VISIBLE);
if (bind != null) bind.downloadDownloadedArtistSector.setVisibility(View.GONE);
} else {
if (bind != null) bind.downloadDownloadedArtistPlaceholder.placeholder.setVisibility(View.GONE);
if (bind != null) bind.downloadDownloadedArtistSector.setVisibility(!artists.isEmpty() ? View.VISIBLE : View.GONE);
if (bind != null) bind.downloadedArtistRecyclerView.setLayoutManager(new GridLayoutManager(requireContext(), UIUtil.getSpanCount(artists.size(), 5), GridLayoutManager.HORIZONTAL, false));
downloadedArtistAdapter.setItems(artists);
}
});
SnapHelper starredArtistSnapHelper = new PagerSnapHelper();
starredArtistSnapHelper.attachToRecyclerView(bind.downloadedArtistRecyclerView);
bind.downloadedArtistRecyclerView.addItemDecoration(
new DotsIndicatorDecoration(
getResources().getDimensionPixelSize(R.dimen.radius),
getResources().getDimensionPixelSize(R.dimen.radius) * 4,
getResources().getDimensionPixelSize(R.dimen.dots_height),
requireContext().getResources().getColor(R.color.titleTextColor, null),
requireContext().getResources().getColor(R.color.titleTextColor, null))
);
}
private void initDownloadedAlbumView() {
bind.downloadedAlbumRecyclerView.setHasFixedSize(true);
downloadedAlbumAdapter = new AlbumHorizontalAdapter(requireContext());
bind.downloadedAlbumRecyclerView.setAdapter(downloadedAlbumAdapter);
downloadViewModel.getDownloadedAlbums(requireActivity(), 20).observe(requireActivity(), albums -> {
if (albums == null) {
if (bind != null) bind.downloadDownloadedAlbumPlaceholder.placeholder.setVisibility(View.VISIBLE);
if (bind != null) bind.downloadDownloadedAlbumSector.setVisibility(View.GONE);
} else {
if (bind != null) bind.downloadDownloadedAlbumPlaceholder.placeholder.setVisibility(View.GONE);
if (bind != null) bind.downloadDownloadedAlbumSector.setVisibility(!albums.isEmpty() ? View.VISIBLE : View.GONE);
if (bind != null) bind.downloadedAlbumRecyclerView.setLayoutManager(new GridLayoutManager(requireContext(), UIUtil.getSpanCount(albums.size(), 5), GridLayoutManager.HORIZONTAL, false));
downloadedAlbumAdapter.setItems(albums);
}
});
SnapHelper starredAlbumSnapHelper = new PagerSnapHelper();
starredAlbumSnapHelper.attachToRecyclerView(bind.downloadedAlbumRecyclerView);
bind.downloadedAlbumRecyclerView.addItemDecoration(
new DotsIndicatorDecoration(
getResources().getDimensionPixelSize(R.dimen.radius),
getResources().getDimensionPixelSize(R.dimen.radius) * 4,
getResources().getDimensionPixelSize(R.dimen.dots_height),
requireContext().getResources().getColor(R.color.titleTextColor, null),
requireContext().getResources().getColor(R.color.titleTextColor, null))
);
}
private void initDownloadedSongView() {
bind.downloadedTracksRecyclerView.setHasFixedSize(true);
downloadedTrackAdapter = new SongHorizontalAdapter(activity, requireContext());
bind.downloadedTracksRecyclerView.setAdapter(downloadedTrackAdapter);
downloadViewModel.getDownloadedTracks(requireActivity(), 20).observe(requireActivity(), songs -> {
if (songs == null) {
if (bind != null) bind.downloadDownloadedTracksPlaceholder.placeholder.setVisibility(View.VISIBLE);
if (bind != null) bind.downloadDownloadedTracksSector.setVisibility(View.GONE);
} else {
if (bind != null) bind.downloadDownloadedTracksPlaceholder.placeholder.setVisibility(View.GONE);
if (bind != null) bind.downloadDownloadedTracksSector.setVisibility(!songs.isEmpty() ? View.VISIBLE : View.GONE);
if (bind != null) bind.downloadedTracksRecyclerView.setLayoutManager(new GridLayoutManager(requireContext(), UIUtil.getSpanCount(songs.size(), 5), GridLayoutManager.HORIZONTAL, false));
downloadedTrackAdapter.setItems(songs);
}
});
SnapHelper starredTrackSnapHelper = new PagerSnapHelper();
starredTrackSnapHelper.attachToRecyclerView(bind.downloadedTracksRecyclerView);
bind.downloadedTracksRecyclerView.addItemDecoration(
new DotsIndicatorDecoration(
getResources().getDimensionPixelSize(R.dimen.radius),
getResources().getDimensionPixelSize(R.dimen.radius) * 4,
getResources().getDimensionPixelSize(R.dimen.dots_height),
requireContext().getResources().getColor(R.color.titleTextColor, null),
requireContext().getResources().getColor(R.color.titleTextColor, null))
);
}
}

View file

@ -103,7 +103,6 @@ public class HomeFragment extends Fragment {
initStarredArtistsView();
initYearSongView();
initRecentAddedAlbumView();
initDownloadedSongView();
}
@Override
@ -172,12 +171,6 @@ public class HomeFragment extends Fragment {
activity.navController.navigate(R.id.action_homeFragment_to_artistListPageFragment, bundle);
});
bind.downloadedTracksTextViewClickable.setOnClickListener(v -> {
Bundle bundle = new Bundle();
bundle.putString(Song.DOWNLOADED, Song.DOWNLOADED);
activity.navController.navigate(R.id.action_homeFragment_to_songListPageFragment, bundle);
});
bind.musicDiscoveryTextViewRefreshable.setOnLongClickListener(v -> {
homeViewModel.refreshDiscoverySongSample(requireActivity());
return true;
@ -455,28 +448,6 @@ public class HomeFragment extends Fragment {
recentAddedAlbumSnapHelper.attachToRecyclerView(bind.recentlyAddedAlbumsRecyclerView);
}
private void initDownloadedSongView() {
bind.downloadedTracksRecyclerView.setLayoutManager(new LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false));
bind.downloadedTracksRecyclerView.setHasFixedSize(true);
dowanloadedMusicAdapter = new TrackAdapter(activity, requireContext());
bind.downloadedTracksRecyclerView.setAdapter(dowanloadedMusicAdapter);
homeViewModel.getDownloaded(requireActivity()).observe(requireActivity(), downloads -> {
if (downloads == null) {
if (bind != null) bind.homeDownloadedTracksPlaceholder.placeholder.setVisibility(View.VISIBLE);
if (bind != null) bind.homeDownloadedTracksSector.setVisibility(View.GONE);
} else {
if (bind != null) bind.homeDownloadedTracksPlaceholder.placeholder.setVisibility(View.GONE);
if (bind != null) bind.homeDownloadedTracksSector.setVisibility(!downloads.isEmpty() ? View.VISIBLE : View.GONE);
dowanloadedMusicAdapter.setItems(MappingUtil.mapDownload(downloads));
}
});
CustomLinearSnapHelper downloadedSongSnapHelper = new CustomLinearSnapHelper();
downloadedSongSnapHelper.attachToRecyclerView(bind.downloadedTracksRecyclerView);
}
private void setDiscoverSongSlideViewOffset(float pageOffset, float pageMargin) {
bind.discoverSongViewPager.setPageTransformer((page, position) -> {
float myOffset = position * -(2 * pageOffset + pageMargin);
@ -509,7 +480,6 @@ public class HomeFragment extends Fragment {
bind.homeLinearLayoutContainer.addView(bind.homeStarredTracksSector);
bind.homeLinearLayoutContainer.addView(bind.homeStarredAlbumsSector);
bind.homeLinearLayoutContainer.addView(bind.homeStarredArtistsSector);
bind.homeLinearLayoutContainer.addView(bind.homeDownloadedTracksSector);
bind.homeLinearLayoutContainer.addView(bind.homeMostPlayedAlbumsSector);
bind.homeLinearLayoutContainer.addView(bind.homeRecentlyPlayedAlbumsSector);
}

View file

@ -53,7 +53,7 @@ public class SearchFragment extends Fragment {
@Override
public void onStart() {
super.onStart();
activity.setBottomNavigationBarVisibility(true);
activity.setBottomNavigationBarVisibility(false);
}
@Override

View file

@ -105,16 +105,45 @@ public class MappingUtil {
return playlist;
}
public static ArrayList<Song> mapDownload(List<Download> downloads) {
public static ArrayList<Song> mapDownloadToSong(List<Download> downloads) {
ArrayList<Song> songs = new ArrayList();
for (Download download : downloads) {
songs.add(new Song(download));
Song song = new Song(download);
if(!songs.contains(song)) {
songs.add(song);
}
}
return songs;
}
public static ArrayList<Album> mapDownloadToAlbum(List<Download> downloads) {
ArrayList<Album> albums = new ArrayList();
for (Download download : downloads) {
Album album = new Album(download);
if(!albums.contains(album)) {
albums.add(album);
}
}
return albums;
}
public static ArrayList<Artist> mapDownloadToArtist(List<Download> downloads) {
ArrayList<Artist> artists = new ArrayList();
for (Download download : downloads) {
Artist artist = new Artist(download);
if(!artists.contains(artist)) {
artists.add(artist);
}
}
return artists;
}
public static ArrayList<Download> mapToDownload(List<Song> songs) {
ArrayList<Download> downloads = new ArrayList();

View file

@ -0,0 +1,52 @@
package com.cappielloantonio.play.viewmodel;
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.model.Album;
import com.cappielloantonio.play.model.Artist;
import com.cappielloantonio.play.model.Download;
import com.cappielloantonio.play.model.Song;
import com.cappielloantonio.play.repository.AlbumRepository;
import com.cappielloantonio.play.repository.ArtistRepository;
import com.cappielloantonio.play.repository.DownloadRepository;
import com.cappielloantonio.play.repository.SongRepository;
import com.cappielloantonio.play.util.MappingUtil;
import java.util.List;
public class DownloadViewModel extends AndroidViewModel {
private static final String TAG = "HomeViewModel";
private final DownloadRepository downloadRepository;
private final MutableLiveData<List<Artist>> downloadedArtistSample = new MutableLiveData<>(null);
private final MutableLiveData<List<Album>> downloadedAlbumSample = new MutableLiveData<>(null);
private final MutableLiveData<List<Song>> downloadedTrackSample = new MutableLiveData<>(null);
public DownloadViewModel(@NonNull Application application) {
super(application);
downloadRepository = new DownloadRepository(application);
}
public LiveData<List<Artist>> getDownloadedArtists(LifecycleOwner owner, int size) {
downloadRepository.getLiveDownloadSample(size).observe(owner, downloads -> downloadedArtistSample.postValue(MappingUtil.mapDownloadToArtist(downloads)));
return downloadedArtistSample;
}
public LiveData<List<Album>> getDownloadedAlbums(LifecycleOwner owner, int size) {
downloadRepository.getLiveDownloadSample(size).observe(owner, downloads -> downloadedAlbumSample.postValue(MappingUtil.mapDownloadToAlbum(downloads)));
return downloadedAlbumSample;
}
public LiveData<List<Song>> getDownloadedTracks(LifecycleOwner owner, int size) {
downloadRepository.getLiveDownloadSample(size).observe(owner, downloads -> downloadedTrackSample.postValue(MappingUtil.mapDownloadToSong(downloads)));
return downloadedTrackSample;
}
}

View file

@ -25,7 +25,6 @@ public class HomeViewModel extends AndroidViewModel {
private final SongRepository songRepository;
private final AlbumRepository albumRepository;
private final ArtistRepository artistRepository;
private final DownloadRepository downloadRepository;
private final MutableLiveData<List<Song>> dicoverSongSample = new MutableLiveData<>(null);
private final MutableLiveData<List<Song>> starredTracksSample = new MutableLiveData<>(null);
@ -36,7 +35,6 @@ public class HomeViewModel extends AndroidViewModel {
private final MutableLiveData<List<Song>> starredTracks = new MutableLiveData<>(null);
private final MutableLiveData<List<Album>> starredAlbums = new MutableLiveData<>(null);
private final MutableLiveData<List<Artist>> starredArtists = new MutableLiveData<>(null);
private final MutableLiveData<List<Download>> downloadedSongSample = new MutableLiveData<>(null);
private final MutableLiveData<List<Album>> recentlyAddedAlbumSample = new MutableLiveData<>(null);
public HomeViewModel(@NonNull Application application) {
@ -45,7 +43,6 @@ public class HomeViewModel extends AndroidViewModel {
songRepository = new SongRepository(application);
albumRepository = new AlbumRepository(application);
artistRepository = new ArtistRepository(application);
downloadRepository = new DownloadRepository(application);
songRepository.getRandomSample(10, null, null).observeForever(dicoverSongSample::postValue);
songRepository.getStarredSongs(true, 10).observeForever(starredTracksSample::postValue);
@ -79,11 +76,6 @@ public class HomeViewModel extends AndroidViewModel {
return starredArtists;
}
public LiveData<List<Download>> getDownloaded(LifecycleOwner owner) {
downloadRepository.getLiveDownloadSample(10).observe(owner, downloadedSongSample::postValue);
return downloadedSongSample;
}
public LiveData<List<Album>> getMostPlayedAlbums(LifecycleOwner owner) {
albumRepository.getAlbums("frequent", 20).observe(owner, mostPlayedAlbumSample::postValue);
return mostPlayedAlbumSample;

View file

@ -70,7 +70,7 @@ public class SongListPageViewModel extends AndroidViewModel {
songList = songRepository.getStarredSongs(false, -1);
break;
case Song.DOWNLOADED:
songList.setValue(MappingUtil.mapDownload(downloadRepository.getLiveDownload()));
songList.setValue(MappingUtil.mapDownloadToSong(downloadRepository.getLiveDownload()));
break;
}

View file

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:pathData="M11,5v5.59L7.5,10.59l4.5,4.5 4.5,-4.5L13,10.59L13,5h-2zM6,14c0,3.31 2.69,6 6,6s6,-2.69 6,-6h-2c0,2.21 -1.79,4 -4,4s-4,-1.79 -4,-4L6,14z"/>
</vector>

View file

@ -0,0 +1,230 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/ThemeOverlay.MaterialComponents.Dark.ActionBar"
app:elevation="0dp">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways|snap"
app:popupTheme="@style/ThemeOverlay.MaterialComponents.Light">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_gravity="center_vertical"
android:layout_marginEnd="8dp"
android:background="@drawable/ic_toolbar_motion_on" />
<TextView
style="@style/ToolbarTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="8dp"
android:paddingEnd="8dp"
android:text="Play" />
</LinearLayout>
</androidx.appcompat.widget.Toolbar>
</com.google.android.material.appbar.AppBarLayout>
<androidx.core.widget.NestedScrollView
android:id="@+id/fragment_download_nested_scroll_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:id="@+id/download_linear_layout_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="@dimen/global_padding_bottom">
<!-- Downloaded artist -->
<LinearLayout
android:id="@+id/download_downloaded_artist_sector"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:visibility="gone">
<!-- Label and button -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingStart="8dp"
android:paddingTop="8dp"
android:paddingEnd="8dp">
<TextView
android:id="@+id/downloaded_artist_text_view_refreshable"
style="@style/HeadlineTextView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingStart="8dp"
android:paddingTop="12dp"
android:paddingEnd="8dp"
android:text="Artists" />
<TextView
android:id="@+id/downloaded_artist_text_view_clickable"
style="@style/SubheadTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="8dp"
android:paddingTop="12dp"
android:paddingEnd="8dp"
android:text="See all" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/downloaded_artist_recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:clipToPadding="false"
android:paddingTop="8dp"
android:paddingBottom="8dp" />
</LinearLayout>
<include
android:id="@+id/download_downloaded_artist_placeholder"
layout="@layout/item_placeholder_album"
android:visibility="gone" />
<!-- Downloaded albums -->
<LinearLayout
android:id="@+id/download_downloaded_album_sector"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<!-- Label and button -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingStart="8dp"
android:paddingTop="8dp"
android:paddingEnd="8dp">
<TextView
android:id="@+id/downloaded_album_text_view_refreshable"
style="@style/HeadlineTextView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingStart="8dp"
android:paddingTop="12dp"
android:paddingEnd="8dp"
android:text="Albums" />
<TextView
android:id="@+id/downloaded_album_text_view_clickable"
style="@style/SubheadTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="8dp"
android:paddingTop="12dp"
android:paddingEnd="8dp"
android:text="See all" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/downloaded_album_recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:clipToPadding="false"
android:paddingTop="8dp"
android:paddingBottom="8dp" />
</LinearLayout>
<include
android:id="@+id/download_downloaded_album_placeholder"
layout="@layout/item_placeholder_album"
android:visibility="gone" />
<!-- Downloaded tracks -->
<LinearLayout
android:id="@+id/download_downloaded_tracks_sector"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<!-- Label and button -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingStart="8dp"
android:paddingTop="8dp"
android:paddingEnd="8dp">
<TextView
android:id="@+id/downloaded_tracks_text_view_refreshable"
style="@style/HeadlineTextView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingStart="8dp"
android:paddingTop="12dp"
android:paddingEnd="8dp"
android:text="Tracks" />
<TextView
android:id="@+id/downloaded_tracks_text_view_clickable"
style="@style/SubheadTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="8dp"
android:paddingTop="12dp"
android:paddingEnd="8dp"
android:text="See all" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/downloaded_tracks_recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:clipToPadding="false"
android:paddingTop="8dp"
android:paddingBottom="8dp" />
</LinearLayout>
<include
android:id="@+id/download_downloaded_tracks_placeholder"
layout="@layout/item_placeholder_horizontal"
android:visibility="gone" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</androidx.coordinatorlayout.widget.CoordinatorLayout>

View file

@ -450,62 +450,6 @@
layout="@layout/item_placeholder_horizontal"
android:visibility="gone" />
<!-- Downloaded tracks -->
<LinearLayout
android:id="@+id/home_downloaded_tracks_sector"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<!-- Label and button -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingStart="8dp"
android:paddingTop="8dp"
android:paddingEnd="8dp">
<TextView
style="@style/HeadlineTextView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingStart="8dp"
android:paddingTop="12dp"
android:paddingEnd="8dp"
android:text="Downloaded" />
<TextView
android:id="@+id/downloaded_tracks_text_view_clickable"
style="@style/SubheadTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="8dp"
android:paddingTop="12dp"
android:paddingEnd="8dp"
android:text="See all" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/downloaded_tracks_recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="8dp"
android:clipToPadding="false"
android:paddingStart="16dp"
android:paddingTop="8dp"
android:paddingEnd="8dp"
android:paddingBottom="8dp" />
</LinearLayout>
<include
android:id="@+id/home_downloaded_tracks_placeholder"
layout="@layout/item_placeholder_album"
android:visibility="gone" />
<!-- Recently added albums -->
<LinearLayout
android:id="@+id/home_recently_added_albums_sector"

View file

@ -9,7 +9,7 @@
android:icon="@drawable/ic_graphic_eq"
android:title="@string/library_menu_label" />
<item
android:id="@+id/searchFragment"
android:icon="@drawable/ic_search"
android:title="@string/search_menu_label" />
android:id="@+id/downloadFragment"
android:icon="@drawable/ic_play_for_work"
android:title="@string/download_menu_label" />
</menu>

View file

@ -97,6 +97,27 @@
android:id="@+id/action_libraryFragment_to_searchFragment"
app:destination="@id/searchFragment" />
</fragment>
<fragment
android:id="@+id/downloadFragment"
android:name="com.cappielloantonio.play.ui.fragment.DownloadFragment"
android:label="DownloadFragment"
tools:layout="@layout/fragment_download">
<action
android:id="@+id/action_downloadFragment_to_songListPageFragment"
app:destination="@id/songListPageFragment" />
<action
android:id="@+id/action_downloadFragment_to_albumListPageFragment"
app:destination="@id/albumListPageFragment" />
<action
android:id="@+id/action_downloadFragment_to_artistListPageFragment"
app:destination="@id/artistListPageFragment" />
<action
android:id="@+id/action_downloadFragment_to_settingsFragment"
app:destination="@id/settingsFragment" />
<action
android:id="@+id/action_downloadFragment_to_searchFragment"
app:destination="@id/searchFragment" />
</fragment>
<fragment
android:id="@+id/settingsFragment"
android:name="com.cappielloantonio.play.ui.fragment.SettingsFragment"

View file

@ -9,6 +9,7 @@
<string name="library_menu_label">Library</string>
<string name="home_menu_label">Home</string>
<string name="search_menu_label">Search</string>
<string name="download_menu_label">Download</string>
<string name="label_placeholder">--</string>
<string name="label_dot_separator"></string>