mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-01 18:03:33 +00:00
Change toolbar title in catalogues
This commit is contained in:
parent
54c01d4dfb
commit
474df23add
2 changed files with 3 additions and 6 deletions
|
|
@ -91,7 +91,7 @@ public class AlbumCatalogueFragment extends Fragment {
|
||||||
|
|
||||||
bind.appBarLayout.addOnOffsetChangedListener((appBarLayout, verticalOffset) -> {
|
bind.appBarLayout.addOnOffsetChangedListener((appBarLayout, verticalOffset) -> {
|
||||||
if ((bind.albumInfoSector.getHeight() + verticalOffset) < (2 * ViewCompat.getMinimumHeight(bind.toolbar))) {
|
if ((bind.albumInfoSector.getHeight() + verticalOffset) < (2 * ViewCompat.getMinimumHeight(bind.toolbar))) {
|
||||||
bind.toolbar.setTitle("Album Catalogue");
|
bind.toolbar.setTitle("Albums");
|
||||||
} else {
|
} else {
|
||||||
bind.toolbar.setTitle("");
|
bind.toolbar.setTitle("");
|
||||||
}
|
}
|
||||||
|
|
@ -100,16 +100,13 @@ public class AlbumCatalogueFragment extends Fragment {
|
||||||
|
|
||||||
@SuppressLint("ClickableViewAccessibility")
|
@SuppressLint("ClickableViewAccessibility")
|
||||||
private void initAlbumCatalogueView() {
|
private void initAlbumCatalogueView() {
|
||||||
GridLayoutManager gridLayoutManager = new GridLayoutManager(requireContext(), 2);
|
bind.albumCatalogueRecyclerView.setLayoutManager(new GridLayoutManager(requireContext(), 2));
|
||||||
|
|
||||||
bind.albumCatalogueRecyclerView.setLayoutManager(gridLayoutManager);
|
|
||||||
bind.albumCatalogueRecyclerView.addItemDecoration(new GridItemDecoration(2, 20, false));
|
bind.albumCatalogueRecyclerView.addItemDecoration(new GridItemDecoration(2, 20, false));
|
||||||
bind.albumCatalogueRecyclerView.setHasFixedSize(true);
|
bind.albumCatalogueRecyclerView.setHasFixedSize(true);
|
||||||
|
|
||||||
albumAdapter = new AlbumCatalogueAdapter(activity, requireContext());
|
albumAdapter = new AlbumCatalogueAdapter(activity, requireContext());
|
||||||
albumAdapter.setStateRestorationPolicy(RecyclerView.Adapter.StateRestorationPolicy.PREVENT_WHEN_EMPTY);
|
albumAdapter.setStateRestorationPolicy(RecyclerView.Adapter.StateRestorationPolicy.PREVENT_WHEN_EMPTY);
|
||||||
bind.albumCatalogueRecyclerView.setAdapter(albumAdapter);
|
bind.albumCatalogueRecyclerView.setAdapter(albumAdapter);
|
||||||
|
|
||||||
albumCatalogueViewModel.getAlbumList().observe(requireActivity(), albums -> {
|
albumCatalogueViewModel.getAlbumList().observe(requireActivity(), albums -> {
|
||||||
albumAdapter.setItems(albums);
|
albumAdapter.setItems(albums);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@ public class ArtistCatalogueFragment extends Fragment {
|
||||||
|
|
||||||
bind.appBarLayout.addOnOffsetChangedListener((appBarLayout, verticalOffset) -> {
|
bind.appBarLayout.addOnOffsetChangedListener((appBarLayout, verticalOffset) -> {
|
||||||
if ((bind.artistInfoSector.getHeight() + verticalOffset) < (2 * ViewCompat.getMinimumHeight(bind.toolbar))) {
|
if ((bind.artistInfoSector.getHeight() + verticalOffset) < (2 * ViewCompat.getMinimumHeight(bind.toolbar))) {
|
||||||
bind.toolbar.setTitle("Artist Catalogue");
|
bind.toolbar.setTitle("Artists");
|
||||||
} else {
|
} else {
|
||||||
bind.toolbar.setTitle("");
|
bind.toolbar.setTitle("");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue