From fc71341c73980e5130485ee75daf0e7aedf6a30f Mon Sep 17 00:00:00 2001 From: CappielloAntonio Date: Sat, 15 Jan 2022 17:06:34 +0100 Subject: [PATCH] Added references to new releases, favorites and a shortcut to genres in the library --- .../play/ui/fragment/LibraryFragment.java | 24 ++++ app/src/main/res/layout/fragment_library.xml | 103 ++++++++++++++++++ 2 files changed, 127 insertions(+) diff --git a/app/src/main/java/com/cappielloantonio/play/ui/fragment/LibraryFragment.java b/app/src/main/java/com/cappielloantonio/play/ui/fragment/LibraryFragment.java index ce21b6f6..709d13fe 100644 --- a/app/src/main/java/com/cappielloantonio/play/ui/fragment/LibraryFragment.java +++ b/app/src/main/java/com/cappielloantonio/play/ui/fragment/LibraryFragment.java @@ -31,6 +31,7 @@ import com.cappielloantonio.play.adapter.SongHorizontalAdapter; import com.cappielloantonio.play.databinding.FragmentLibraryBinding; 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.Playlist; import com.cappielloantonio.play.model.Song; import com.cappielloantonio.play.ui.activity.MainActivity; @@ -85,6 +86,9 @@ public class LibraryFragment extends Fragment { super.onViewCreated(view, savedInstanceState); initAppBar(); + initNewReleasesShortcut(); + initStarredShortcut(); + initGenresShortcut(); initAlbumView(); initArtistView(); initGenreView(); @@ -149,6 +153,26 @@ public class LibraryFragment extends Fragment { Objects.requireNonNull(bind.toolbar.getOverflowIcon()).setTint(requireContext().getResources().getColor(R.color.titleTextColor, null)); } + private void initNewReleasesShortcut() { + bind.libraryNewReleasesSector.setOnClickListener(view -> { + Bundle bundle = new Bundle(); + bundle.putString(Album.NEW_RELEASES, Album.NEW_RELEASES); + activity.navController.navigate(R.id.action_libraryFragment_to_albumListPageFragment, bundle); + }); + } + + private void initStarredShortcut() { + bind.libraryStarredSector.setOnClickListener(view -> { + activity.navController.navigate(R.id.action_libraryFragment_to_starredFragment); + }); + } + + private void initGenresShortcut() { + bind.libraryGenresShortcutSector.setOnClickListener(view -> { + activity.navController.navigate(R.id.action_libraryFragment_to_genreCatalogueFragment); + }); + } + private void initAlbumView() { bind.albumRecyclerView.setLayoutManager(new LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false)); bind.albumRecyclerView.setHasFixedSize(true); diff --git a/app/src/main/res/layout/fragment_library.xml b/app/src/main/res/layout/fragment_library.xml index 238aa2e1..31ba614f 100644 --- a/app/src/main/res/layout/fragment_library.xml +++ b/app/src/main/res/layout/fragment_library.xml @@ -52,6 +52,109 @@ android:orientation="vertical" android:paddingBottom="@dimen/global_padding_bottom"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + +