Added references to new releases, favorites and a shortcut to genres in the library

This commit is contained in:
CappielloAntonio 2022-01-15 17:06:34 +01:00
parent ac64ed2fb6
commit fc71341c73
2 changed files with 127 additions and 0 deletions

View file

@ -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);