mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-03 19:01:39 +00:00
Return back to a limited number of top song in Artist page
This commit is contained in:
parent
59e0de7836
commit
cd7e3bf84f
3 changed files with 8 additions and 12 deletions
|
|
@ -14,9 +14,7 @@ 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 com.cappielloantonio.play.App;
|
||||
import com.cappielloantonio.play.R;
|
||||
|
|
@ -31,7 +29,6 @@ import com.cappielloantonio.play.repository.ArtistRepository;
|
|||
import com.cappielloantonio.play.repository.QueueRepository;
|
||||
import com.cappielloantonio.play.service.MusicPlayerRemote;
|
||||
import com.cappielloantonio.play.ui.activity.MainActivity;
|
||||
import com.cappielloantonio.play.util.UIUtil;
|
||||
import com.cappielloantonio.play.viewmodel.ArtistPageViewModel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -166,18 +163,14 @@ public class ArtistPageFragment extends Fragment {
|
|||
}
|
||||
|
||||
private void initTopSongsView() {
|
||||
bind.mostStreamedSongRecyclerView.setHasFixedSize(true);
|
||||
bind.mostStreamedSongRecyclerView.setLayoutManager(new LinearLayoutManager(requireContext()));
|
||||
|
||||
songHorizontalAdapter = new SongHorizontalAdapter(activity, requireContext(), getChildFragmentManager());
|
||||
bind.mostStreamedSongRecyclerView.setAdapter(songHorizontalAdapter);
|
||||
artistPageViewModel.getArtistTopSongList().observe(requireActivity(), songs -> {
|
||||
artistPageViewModel.getArtistTopSongList(10).observe(requireActivity(), songs -> {
|
||||
if (bind != null) bind.artistPageTopSongsSector.setVisibility(!songs.isEmpty() ? View.VISIBLE : View.GONE);
|
||||
bind.mostStreamedSongRecyclerView.setLayoutManager(new GridLayoutManager(requireContext(), UIUtil.getSpanCount(songs.size(), 5), GridLayoutManager.HORIZONTAL, false));
|
||||
songHorizontalAdapter.setItems(songs);
|
||||
});
|
||||
|
||||
PagerSnapHelper pagerSnapHelper = new PagerSnapHelper();
|
||||
pagerSnapHelper.attachToRecyclerView(bind.mostStreamedSongRecyclerView);
|
||||
}
|
||||
|
||||
private void initAlbumsView() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue