mirror of
https://github.com/CappielloAntonio/tempo.git
synced 2026-02-01 23:13:36 +00:00
Add song/genre sync
This commit is contained in:
@@ -1,20 +1,20 @@
|
||||
package com.cappielloantonio.play.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.viewpager.widget.PagerAdapter;
|
||||
|
||||
import com.cappielloantonio.play.App;
|
||||
import com.cappielloantonio.play.R;
|
||||
import com.cappielloantonio.play.model.Song;
|
||||
import com.cappielloantonio.play.repository.SongRepository;
|
||||
import com.cappielloantonio.play.util.Util;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -29,8 +29,6 @@ public class DiscoverSongAdapter extends PagerAdapter {
|
||||
public DiscoverSongAdapter(Context context, List<Song> songs) {
|
||||
this.context = context;
|
||||
this.songs = songs;
|
||||
|
||||
Log.d(TAG, "DiscoverSongAdapter: " + songs.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -50,7 +48,7 @@ public class DiscoverSongAdapter extends PagerAdapter {
|
||||
view = layoutInflater.inflate(R.layout.item_home_discover_song, container, false);
|
||||
|
||||
TextView title = view.findViewById(R.id.title_discover_song_label);
|
||||
TextView desc = view.findViewById(R.id.artist_discover_song_label);
|
||||
TextView desc = view.findViewById(R.id.album_discover_song_label);
|
||||
title.setText(songs.get(position).getTitle());
|
||||
desc.setText(songs.get(position).getAlbumName());
|
||||
|
||||
@@ -64,8 +62,6 @@ public class DiscoverSongAdapter extends PagerAdapter {
|
||||
}
|
||||
|
||||
public void setItems(List<Song> songs) {
|
||||
Log.d(TAG, "setItems: CHANGING");
|
||||
|
||||
this.songs = songs;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@@ -62,6 +62,10 @@ public class GenreAdapter extends RecyclerView.Adapter<GenreAdapter.ViewHolder>
|
||||
}
|
||||
}
|
||||
|
||||
public Genre getItem(int position) {
|
||||
return genres.get(position);
|
||||
}
|
||||
|
||||
public void setItems(List<Genre> genres) {
|
||||
this.genres = genres;
|
||||
notifyDataSetChanged();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.cappielloantonio.play.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Parcelable;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
@@ -45,6 +46,7 @@ public class GenreCatalogueAdapter extends RecyclerView.Adapter<GenreCatalogueAd
|
||||
return genres.size();
|
||||
}
|
||||
|
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
|
||||
TextView textGenre;
|
||||
|
||||
@@ -62,6 +64,10 @@ public class GenreCatalogueAdapter extends RecyclerView.Adapter<GenreCatalogueAd
|
||||
}
|
||||
}
|
||||
|
||||
public Genre getItem(int position) {
|
||||
return genres.get(position);
|
||||
}
|
||||
|
||||
public void setItems(List<Genre> genres) {
|
||||
this.genres = genres;
|
||||
notifyDataSetChanged();
|
||||
|
||||
Reference in New Issue
Block a user