Rename AlbumArtistPageAdapter in AlbumArtistPageOrSimilarAdapter

This commit is contained in:
CappielloAntonio 2021-05-01 18:35:21 +02:00
parent e7713ce19c
commit 214c803984
4 changed files with 13 additions and 19 deletions

View file

@ -18,14 +18,14 @@ import com.cappielloantonio.play.model.Album;
import java.util.ArrayList;
import java.util.List;
public class AlbumArtistPageAdapter extends RecyclerView.Adapter<AlbumArtistPageAdapter.ViewHolder> {
public class AlbumArtistPageOrSimilarAdapter extends RecyclerView.Adapter<AlbumArtistPageOrSimilarAdapter.ViewHolder> {
private static final String TAG = "AlbumArtistPageAdapter";
private List<Album> albums;
private LayoutInflater inflater;
private Context context;
public AlbumArtistPageAdapter(Context context) {
public AlbumArtistPageOrSimilarAdapter(Context context) {
this.context = context;
this.inflater = LayoutInflater.from(context);
this.albums = new ArrayList<>();
@ -33,7 +33,7 @@ public class AlbumArtistPageAdapter extends RecyclerView.Adapter<AlbumArtistPage
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View view = inflater.inflate(R.layout.item_artist_page_album, parent, false);
View view = inflater.inflate(R.layout.item_library_artist_page_or_similar_album, parent, false);
return new ViewHolder(view);
}

View file

@ -1,6 +1,5 @@
package com.cappielloantonio.play.ui.fragment;
import android.os.Build;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
@ -15,20 +14,17 @@ import androidx.annotation.Nullable;
import androidx.core.view.ViewCompat;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProvider;
import androidx.navigation.Navigation;
import androidx.navigation.fragment.NavHostFragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import com.cappielloantonio.play.App;
import com.cappielloantonio.play.R;
import com.cappielloantonio.play.adapter.AlbumArtistPageAdapter;
import com.cappielloantonio.play.adapter.AlbumArtistPageOrSimilarAdapter;
import com.cappielloantonio.play.adapter.SongResultSearchAdapter;
import com.cappielloantonio.play.databinding.FragmentAlbumPageBinding;
import com.cappielloantonio.play.glide.CustomGlideRequest;
import com.cappielloantonio.play.interfaces.MediaCallback;
import com.cappielloantonio.play.model.Album;
import com.cappielloantonio.play.model.Artist;
import com.cappielloantonio.play.model.Playlist;
import com.cappielloantonio.play.model.Song;
import com.cappielloantonio.play.service.MusicPlayerRemote;
import com.cappielloantonio.play.repository.QueueRepository;
@ -41,7 +37,6 @@ import com.cappielloantonio.play.viewmodel.AlbumPageViewModel;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
public class AlbumPageFragment extends Fragment {
private static final String TAG = "AlbumPageFragment";
@ -51,7 +46,7 @@ public class AlbumPageFragment extends Fragment {
private AlbumPageViewModel albumPageViewModel;
private SongResultSearchAdapter songResultSearchAdapter;
private AlbumArtistPageAdapter albumArtistPageAdapter;
private AlbumArtistPageOrSimilarAdapter albumArtistPageOrSimilarAdapter;
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
@ -221,9 +216,9 @@ public class AlbumPageFragment extends Fragment {
bind.similarAlbumsRecyclerView.setLayoutManager(new LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false));
albumArtistPageAdapter = new AlbumArtistPageAdapter(requireContext());
bind.similarAlbumsRecyclerView.setAdapter(albumArtistPageAdapter);
albumArtistPageAdapter.setItems((ArrayList<Album>) media);
albumArtistPageOrSimilarAdapter = new AlbumArtistPageOrSimilarAdapter(requireContext());
bind.similarAlbumsRecyclerView.setAdapter(albumArtistPageOrSimilarAdapter);
albumArtistPageOrSimilarAdapter.setItems((ArrayList<Album>) media);
}
}, SyncUtil.ALBUM, albumPageViewModel.getAlbum().getId(), PreferenceUtil.getInstance(requireContext()).getSimilarItemsNumber());
}

View file

@ -3,7 +3,6 @@ package com.cappielloantonio.play.ui.fragment;
import android.graphics.BlendMode;
import android.graphics.BlendModeColorFilter;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@ -17,7 +16,7 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import com.cappielloantonio.play.App;
import com.cappielloantonio.play.R;
import com.cappielloantonio.play.adapter.AlbumArtistPageAdapter;
import com.cappielloantonio.play.adapter.AlbumArtistPageOrSimilarAdapter;
import com.cappielloantonio.play.adapter.SongResultSearchAdapter;
import com.cappielloantonio.play.databinding.FragmentArtistPageBinding;
import com.cappielloantonio.play.glide.CustomGlideRequest;
@ -40,7 +39,7 @@ public class ArtistPageFragment extends Fragment {
private ArtistPageViewModel artistPageViewModel;
private SongResultSearchAdapter songResultSearchAdapter;
private AlbumArtistPageAdapter albumArtistPageAdapter;
private AlbumArtistPageOrSimilarAdapter albumArtistPageOrSimilarAdapter;
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
@ -159,8 +158,8 @@ public class ArtistPageFragment extends Fragment {
private void initAlbumsView() {
bind.albumsRecyclerView.setLayoutManager(new LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false));
albumArtistPageAdapter = new AlbumArtistPageAdapter(requireContext());
bind.albumsRecyclerView.setAdapter(albumArtistPageAdapter);
artistPageViewModel.getAlbumList().observe(requireActivity(), songs -> albumArtistPageAdapter.setItems(songs));
albumArtistPageOrSimilarAdapter = new AlbumArtistPageOrSimilarAdapter(requireContext());
bind.albumsRecyclerView.setAdapter(albumArtistPageOrSimilarAdapter);
artistPageViewModel.getAlbumList().observe(requireActivity(), songs -> albumArtistPageOrSimilarAdapter.setItems(songs));
}
}