mirror of
https://github.com/antebudimir/tempus.git
synced 2025-12-31 17:43:32 +00:00
Adapters refactoring
This commit is contained in:
parent
18fae806a6
commit
ae23d268cd
34 changed files with 341 additions and 100 deletions
|
|
@ -54,6 +54,7 @@ dependencies {
|
|||
implementation "androidx.room:room-runtime:2.2.5"
|
||||
implementation "androidx.cardview:cardview:1.0.0"
|
||||
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
||||
implementation 'androidx.paging:paging-runtime:2.1.2'
|
||||
|
||||
// Android Material
|
||||
implementation 'com.google.android.material:material:1.2.1'
|
||||
|
|
|
|||
|
|
@ -16,21 +16,21 @@ import com.cappielloantonio.play.model.Album;
|
|||
import java.util.List;
|
||||
|
||||
public class AlbumAdapter extends RecyclerView.Adapter<AlbumAdapter.ViewHolder> {
|
||||
private static final String TAG = "RecentMusicAdapter";
|
||||
private static final String TAG = "AlbumAdapter";
|
||||
|
||||
private List<Album> albums;
|
||||
private LayoutInflater mInflater;
|
||||
private LayoutInflater inflater;
|
||||
private Context context;
|
||||
private ItemClickListener itemClickListener;
|
||||
|
||||
public AlbumAdapter(Context context, List<Album> albums) {
|
||||
public AlbumAdapter(Context context) {
|
||||
this.context = context;
|
||||
this.mInflater = LayoutInflater.from(context);
|
||||
this.albums = albums;
|
||||
this.inflater = LayoutInflater.from(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View view = mInflater.inflate(R.layout.item_library_album, parent, false);
|
||||
View view = inflater.inflate(R.layout.item_library_album, parent, false);
|
||||
return new ViewHolder(view);
|
||||
}
|
||||
|
||||
|
|
@ -69,7 +69,8 @@ public class AlbumAdapter extends RecyclerView.Adapter<AlbumAdapter.ViewHolder>
|
|||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (itemClickListener != null) itemClickListener.onItemClick(view, getAdapterPosition());
|
||||
if (itemClickListener != null)
|
||||
itemClickListener.onItemClick(view, getAdapterPosition());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,20 +17,20 @@ import java.util.List;
|
|||
|
||||
public class AlbumArtistPageAdapter extends RecyclerView.Adapter<AlbumArtistPageAdapter.ViewHolder> {
|
||||
private static final String TAG = "AlbumArtistPageAdapter";
|
||||
|
||||
private List<Album> albums;
|
||||
private LayoutInflater mInflater;
|
||||
private LayoutInflater inflater;
|
||||
private Context context;
|
||||
private ItemClickListener itemClickListener;
|
||||
|
||||
public AlbumArtistPageAdapter(Context context, List<Album> albums) {
|
||||
public AlbumArtistPageAdapter(Context context) {
|
||||
this.context = context;
|
||||
this.mInflater = LayoutInflater.from(context);
|
||||
this.albums = albums;
|
||||
this.inflater = LayoutInflater.from(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View view = mInflater.inflate(R.layout.item_artist_page_album, parent, false);
|
||||
View view = inflater.inflate(R.layout.item_artist_page_album, parent, false);
|
||||
return new ViewHolder(view);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,21 +16,21 @@ import com.cappielloantonio.play.model.Album;
|
|||
import java.util.List;
|
||||
|
||||
public class AlbumCatalogueAdapter extends RecyclerView.Adapter<AlbumCatalogueAdapter.ViewHolder> {
|
||||
private static final String TAG = "AlbumAdapter";
|
||||
private static final String TAG = "AlbumCatalogueAdapter";
|
||||
|
||||
private List<Album> albums;
|
||||
private LayoutInflater mInflater;
|
||||
private LayoutInflater inflater;
|
||||
private Context context;
|
||||
private ItemClickListener itemClickListener;
|
||||
|
||||
public AlbumCatalogueAdapter(Context context, List<Album> albums) {
|
||||
public AlbumCatalogueAdapter(Context context) {
|
||||
this.context = context;
|
||||
this.mInflater = LayoutInflater.from(context);
|
||||
this.albums = albums;
|
||||
this.inflater = LayoutInflater.from(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View view = mInflater.inflate(R.layout.item_library_catalogue_album, parent, false);
|
||||
View view = inflater.inflate(R.layout.item_library_catalogue_album, parent, false);
|
||||
return new ViewHolder(view);
|
||||
}
|
||||
|
||||
|
|
@ -70,7 +70,8 @@ public class AlbumCatalogueAdapter extends RecyclerView.Adapter<AlbumCatalogueAd
|
|||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (itemClickListener != null) itemClickListener.onItemClick(view, getAdapterPosition());
|
||||
if (itemClickListener != null)
|
||||
itemClickListener.onItemClick(view, getAdapterPosition());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,20 +17,20 @@ import java.util.List;
|
|||
|
||||
public class ArtistAdapter extends RecyclerView.Adapter<ArtistAdapter.ViewHolder> {
|
||||
private static final String TAG = "ArtistAdapter";
|
||||
|
||||
private List<Artist> artists;
|
||||
private LayoutInflater mInflater;
|
||||
private LayoutInflater inflater;
|
||||
private Context context;
|
||||
private ItemClickListener itemClickListener;
|
||||
|
||||
public ArtistAdapter(Context context, List<Artist> artists) {
|
||||
public ArtistAdapter(Context context) {
|
||||
this.context = context;
|
||||
this.mInflater = LayoutInflater.from(context);
|
||||
this.artists = artists;
|
||||
this.inflater = LayoutInflater.from(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View view = mInflater.inflate(R.layout.item_library_artist, parent, false);
|
||||
View view = inflater.inflate(R.layout.item_library_artist, parent, false);
|
||||
return new ViewHolder(view);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,21 +16,21 @@ import com.cappielloantonio.play.model.Artist;
|
|||
import java.util.List;
|
||||
|
||||
public class ArtistCatalogueAdapter extends RecyclerView.Adapter<ArtistCatalogueAdapter.ViewHolder> {
|
||||
private static final String TAG = "ArtistAdapter";
|
||||
private static final String TAG = "ArtistCatalogueAdapter";
|
||||
|
||||
private List<Artist> artists;
|
||||
private LayoutInflater mInflater;
|
||||
private LayoutInflater inflater;
|
||||
private Context context;
|
||||
private ItemClickListener itemClickListener;
|
||||
|
||||
public ArtistCatalogueAdapter(Context context, List<Artist> artists) {
|
||||
public ArtistCatalogueAdapter(Context context) {
|
||||
this.context = context;
|
||||
this.mInflater = LayoutInflater.from(context);
|
||||
this.artists = artists;
|
||||
this.inflater = LayoutInflater.from(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View view = mInflater.inflate(R.layout.item_library_catalogue_artist, parent, false);
|
||||
View view = inflater.inflate(R.layout.item_library_catalogue_artist, parent, false);
|
||||
return new ViewHolder(view);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,18 +21,18 @@ public class DiscoverSongAdapter extends RecyclerView.Adapter<DiscoverSongAdapte
|
|||
private static final String TAG = "DiscoverSongAdapter";
|
||||
|
||||
private List<Song> songs;
|
||||
private LayoutInflater layoutInflater;
|
||||
private LayoutInflater inflater;
|
||||
private Context context;
|
||||
|
||||
public DiscoverSongAdapter(Context context, List<Song> songs) {
|
||||
this.context = context;
|
||||
this.layoutInflater = LayoutInflater.from(context);
|
||||
this.inflater = LayoutInflater.from(context);
|
||||
this.songs = songs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View view = layoutInflater.inflate(R.layout.item_home_discover_song, parent, false);
|
||||
View view = inflater.inflate(R.layout.item_home_discover_song, parent, false);
|
||||
return new ViewHolder(view);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,18 +15,17 @@ import java.util.List;
|
|||
|
||||
public class GenreAdapter extends RecyclerView.Adapter<GenreAdapter.ViewHolder> {
|
||||
private static final String TAG = "GenreAdapter";
|
||||
|
||||
private List<Genre> genres;
|
||||
private LayoutInflater mInflater;
|
||||
private Context context;
|
||||
private ItemClickListener itemClickListener;
|
||||
|
||||
public GenreAdapter(Context context, List<Genre> genres) {
|
||||
public GenreAdapter(Context context) {
|
||||
this.context = context;
|
||||
this.mInflater = LayoutInflater.from(context);
|
||||
this.genres = genres;
|
||||
}
|
||||
|
||||
// inflates the row layout from xml when needed
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View view = mInflater.inflate(R.layout.item_library_genre, parent, false);
|
||||
|
|
@ -58,7 +57,8 @@ public class GenreAdapter extends RecyclerView.Adapter<GenreAdapter.ViewHolder>
|
|||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (itemClickListener != null) itemClickListener.onItemClick(view, getAdapterPosition());
|
||||
if (itemClickListener != null)
|
||||
itemClickListener.onItemClick(view, getAdapterPosition());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
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;
|
||||
|
|
@ -15,16 +14,16 @@ import com.cappielloantonio.play.model.Genre;
|
|||
import java.util.List;
|
||||
|
||||
public class GenreCatalogueAdapter extends RecyclerView.Adapter<GenreCatalogueAdapter.ViewHolder> {
|
||||
private static final String TAG = "GenreAdapter";
|
||||
private static final String TAG = "GenreCatalogueAdapter";
|
||||
|
||||
private List<Genre> genres;
|
||||
private LayoutInflater mInflater;
|
||||
private Context context;
|
||||
private ItemClickListener itemClickListener;
|
||||
|
||||
public GenreCatalogueAdapter(Context context, List<Genre> genres) {
|
||||
public GenreCatalogueAdapter(Context context) {
|
||||
this.context = context;
|
||||
this.mInflater = LayoutInflater.from(context);
|
||||
this.genres = genres;
|
||||
}
|
||||
|
||||
// inflates the row layout from xml when needed
|
||||
|
|
|
|||
|
|
@ -9,22 +9,21 @@ import android.widget.TextView;
|
|||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.cappielloantonio.play.R;
|
||||
import com.cappielloantonio.play.model.Artist;
|
||||
import com.cappielloantonio.play.model.Playlist;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class PlaylistAdapter extends RecyclerView.Adapter<PlaylistAdapter.ViewHolder> {
|
||||
private static final String TAG = "PlaylistAdapter";
|
||||
|
||||
private List<Playlist> playlists;
|
||||
private LayoutInflater mInflater;
|
||||
private Context context;
|
||||
private ItemClickListener itemClickListener;
|
||||
|
||||
public PlaylistAdapter(Context context, List<Playlist> playlists) {
|
||||
public PlaylistAdapter(Context context) {
|
||||
this.context = context;
|
||||
this.mInflater = LayoutInflater.from(context);
|
||||
this.playlists = playlists;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -58,7 +57,8 @@ public class PlaylistAdapter extends RecyclerView.Adapter<PlaylistAdapter.ViewHo
|
|||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (itemClickListener != null) itemClickListener.onItemClick(view, getAdapterPosition());
|
||||
if (itemClickListener != null)
|
||||
itemClickListener.onItemClick(view, getAdapterPosition());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,14 +22,14 @@ import java.util.List;
|
|||
*/
|
||||
public class RecentMusicAdapter extends RecyclerView.Adapter<RecentMusicAdapter.ViewHolder> {
|
||||
private static final String TAG = "RecentMusicAdapter";
|
||||
|
||||
private List<Song> songs;
|
||||
private LayoutInflater mInflater;
|
||||
private Context context;
|
||||
|
||||
public RecentMusicAdapter(Context context, List<Song> songs) {
|
||||
public RecentMusicAdapter(Context context) {
|
||||
this.context = context;
|
||||
this.mInflater = LayoutInflater.from(context);
|
||||
this.songs = songs;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -46,7 +46,7 @@ public class RecentMusicAdapter extends RecyclerView.Adapter<RecentMusicAdapter.
|
|||
holder.textAlbum.setText(song.getAlbumName());
|
||||
|
||||
CustomGlideRequest.Builder
|
||||
.from(context, song.getPrimary(), song.getPrimary(), CustomGlideRequest.PRIMARY, CustomGlideRequest.TOP_QUALITY)
|
||||
.from(context, song.getPrimary(), song.getBlurHash(), CustomGlideRequest.PRIMARY, CustomGlideRequest.TOP_QUALITY)
|
||||
.build()
|
||||
.into(holder.cover);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,22 +9,21 @@ import android.widget.TextView;
|
|||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.cappielloantonio.play.R;
|
||||
import com.cappielloantonio.play.model.Playlist;
|
||||
import com.cappielloantonio.play.model.RecentSearch;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class RecentSearchAdapter extends RecyclerView.Adapter<RecentSearchAdapter.ViewHolder> {
|
||||
private static final String TAG = "GenreAdapter";
|
||||
private static final String TAG = "RecentSearchAdapter";
|
||||
|
||||
private List<RecentSearch> searches;
|
||||
private LayoutInflater mInflater;
|
||||
private Context context;
|
||||
private ItemClickListener itemClickListener;
|
||||
|
||||
public RecentSearchAdapter(Context context, List<RecentSearch> searches) {
|
||||
public RecentSearchAdapter(Context context) {
|
||||
this.context = context;
|
||||
this.mInflater = LayoutInflater.from(context);
|
||||
this.searches = searches;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -23,14 +23,14 @@ import java.util.List;
|
|||
*/
|
||||
public class SongResultSearchAdapter extends RecyclerView.Adapter<SongResultSearchAdapter.ViewHolder> {
|
||||
private static final String TAG = "SongResultSearchAdapter";
|
||||
|
||||
private List<Song> songs;
|
||||
private LayoutInflater mInflater;
|
||||
private Context context;
|
||||
|
||||
public SongResultSearchAdapter(Context context, List<Song> songs) {
|
||||
public SongResultSearchAdapter(Context context) {
|
||||
this.context = context;
|
||||
this.mInflater = LayoutInflater.from(context);
|
||||
this.songs = songs;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -48,7 +48,7 @@ public class SongResultSearchAdapter extends RecyclerView.Adapter<SongResultSear
|
|||
holder.songDuration.setText(Util.getReadableDurationString(song.getDuration()));
|
||||
|
||||
CustomGlideRequest.Builder
|
||||
.from(context, song.getPrimary(), song.getPrimary(), CustomGlideRequest.PRIMARY, CustomGlideRequest.TOP_QUALITY)
|
||||
.from(context, song.getPrimary(), song.getBlurHash(), CustomGlideRequest.PRIMARY, CustomGlideRequest.TOP_QUALITY)
|
||||
.build()
|
||||
.into(holder.cover);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,79 @@
|
|||
package com.cappielloantonio.play.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.cappielloantonio.play.R;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class YearAdapter extends RecyclerView.Adapter<YearAdapter.ViewHolder> {
|
||||
private static final String TAG = "YearAdapter";
|
||||
private List<Integer> years;
|
||||
private LayoutInflater mInflater;
|
||||
private Context context;
|
||||
private ItemClickListener itemClickListener;
|
||||
|
||||
public YearAdapter(Context context, List<Integer> years) {
|
||||
this.context = context;
|
||||
this.mInflater = LayoutInflater.from(context);
|
||||
this.years = years;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View view = mInflater.inflate(R.layout.item_home_year, parent, false);
|
||||
return new ViewHolder(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(ViewHolder holder, int position) {
|
||||
int year = years.get(position);
|
||||
|
||||
holder.textYear.setText(Integer.toString(year));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return years.size();
|
||||
}
|
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
|
||||
TextView textYear;
|
||||
|
||||
ViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
|
||||
textYear = itemView.findViewById(R.id.year_label);
|
||||
|
||||
itemView.setOnClickListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (itemClickListener != null) itemClickListener.onItemClick(view, getAdapterPosition());
|
||||
}
|
||||
}
|
||||
|
||||
public Integer getItem(int position) {
|
||||
return years.get(position);
|
||||
}
|
||||
|
||||
public void setItems(List<Integer> years) {
|
||||
this.years = years;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void setClickListener(ItemClickListener itemClickListener) {
|
||||
this.itemClickListener = itemClickListener;
|
||||
}
|
||||
|
||||
public interface ItemClickListener {
|
||||
void onItemClick(View view, int position);
|
||||
}
|
||||
}
|
||||
|
|
@ -24,9 +24,6 @@ public interface SongDao {
|
|||
@Query("SELECT * FROM song WHERE title LIKE '%' || :title || '%'")
|
||||
LiveData<List<Song>> searchSong(String title);
|
||||
|
||||
@Query("SELECT * FROM song ORDER BY RANDOM() LIMIT :number")
|
||||
LiveData<List<Song>> getDiscoverSample(int number);
|
||||
|
||||
@Query("SELECT * FROM song ORDER BY added DESC LIMIT :number")
|
||||
LiveData<List<Song>> getRecentlyAddedSample(int number);
|
||||
|
||||
|
|
@ -74,4 +71,10 @@ public interface SongDao {
|
|||
|
||||
@Query("SELECT title FROM song WHERE title LIKE :query || '%' OR title like '% ' || :query || '%' GROUP BY title LIMIT :number")
|
||||
List<String> searchSuggestions(String query, int number);
|
||||
|
||||
@Query("SELECT year FROM song WHERE year != 0 GROUP BY year")
|
||||
List<Integer> getYearList();
|
||||
|
||||
@Query("SELECT * FROM song WHERE year = :year")
|
||||
LiveData<List<Song>> getSongsByYear(int year);
|
||||
}
|
||||
|
|
@ -93,14 +93,14 @@ public class CustomGlideRequest {
|
|||
break;
|
||||
}
|
||||
case MEDIUM_QUALITY: {
|
||||
options.setQuality(80);
|
||||
options.setMaxHeight(500);
|
||||
options.setQuality(100);
|
||||
options.setMaxHeight(600);
|
||||
options.setEnableImageEnhancers(true);
|
||||
break;
|
||||
}
|
||||
case LOW_QUALITY: {
|
||||
options.setQuality(60);
|
||||
options.setMaxHeight(300);
|
||||
options.setQuality(100);
|
||||
options.setMaxHeight(400);
|
||||
options.setEnableImageEnhancers(true);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,9 @@ public class Song implements Parcelable {
|
|||
@Ignore
|
||||
public static final String BY_ARTIST = "BY_ARTIST";
|
||||
|
||||
@Ignore
|
||||
public static final String BY_YEAR = "BY_YEAR";
|
||||
|
||||
@NonNull
|
||||
@PrimaryKey
|
||||
@ColumnInfo(name = "id")
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ public class SongRepository {
|
|||
private LiveData<List<Song>> listLiveAlbumSongs;
|
||||
private LiveData<List<Song>> listLiveSongByGenre;
|
||||
private LiveData<List<Song>> listLiveFilteredSongs;
|
||||
private LiveData<List<Song>> listLiveSongByYear;
|
||||
|
||||
|
||||
public SongRepository(Application application) {
|
||||
|
|
@ -115,6 +116,28 @@ public class SongRepository {
|
|||
return catalogue;
|
||||
}
|
||||
|
||||
public List<Integer> getYearList() {
|
||||
List<Integer> years = new ArrayList<>();
|
||||
|
||||
GetYearListThreadSafe getYearListThreadSafe = new GetYearListThreadSafe(songDao);
|
||||
Thread thread = new Thread(getYearListThreadSafe);
|
||||
thread.start();
|
||||
|
||||
try {
|
||||
thread.join();
|
||||
years = getYearListThreadSafe.getYearList();
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return years;
|
||||
}
|
||||
|
||||
public LiveData<List<Song>> getSongByYearListLive(int year) {
|
||||
listLiveSongByYear = songDao.getSongsByYear(year);
|
||||
return listLiveSongByYear;
|
||||
}
|
||||
|
||||
public boolean exist(Song song) {
|
||||
boolean exist = false;
|
||||
|
||||
|
|
@ -383,4 +406,33 @@ public class SongRepository {
|
|||
songGenreCrossDao.deleteAll();
|
||||
}
|
||||
}
|
||||
|
||||
private static class GetYearListThreadSafe implements Runnable {
|
||||
private SongDao songDao;
|
||||
private List<Integer> years = new ArrayList<>();
|
||||
private List<Integer> decades = new ArrayList<>();
|
||||
|
||||
public GetYearListThreadSafe(SongDao songDao) {
|
||||
this.songDao = songDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
years = songDao.getYearList();
|
||||
|
||||
for(int year : years) {
|
||||
if(!decades.contains(year - year % 10)) {
|
||||
decades.add(year);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<Integer> getYearList() {
|
||||
return years;
|
||||
}
|
||||
|
||||
public List<Integer> getDecadeList() {
|
||||
return decades;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,8 +16,6 @@ import com.cappielloantonio.play.helper.recyclerview.ItemDecoration;
|
|||
import com.cappielloantonio.play.ui.activities.MainActivity;
|
||||
import com.cappielloantonio.play.viewmodel.AlbumCatalogueViewModel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class AlbumCatalogueFragment extends Fragment {
|
||||
private static final String TAG = "ArtistCatalogueFragment";
|
||||
|
||||
|
|
@ -51,7 +49,7 @@ public class AlbumCatalogueFragment extends Fragment {
|
|||
bind.albumCatalogueRecyclerView.addItemDecoration(new ItemDecoration(2, 20, false));
|
||||
bind.albumCatalogueRecyclerView.setHasFixedSize(true);
|
||||
|
||||
albumAdapter = new AlbumCatalogueAdapter(requireContext(), new ArrayList<>());
|
||||
albumAdapter = new AlbumCatalogueAdapter(requireContext());
|
||||
albumAdapter.setClickListener((view, position) -> {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putParcelable("album_object", albumAdapter.getItem(position));
|
||||
|
|
|
|||
|
|
@ -16,8 +16,6 @@ import com.cappielloantonio.play.helper.recyclerview.ItemDecoration;
|
|||
import com.cappielloantonio.play.ui.activities.MainActivity;
|
||||
import com.cappielloantonio.play.viewmodel.ArtistCatalogueViewModel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class ArtistCatalogueFragment extends Fragment {
|
||||
private static final String TAG = "ArtistCatalogueFragment";
|
||||
|
||||
|
|
@ -51,7 +49,7 @@ public class ArtistCatalogueFragment extends Fragment {
|
|||
bind.artistCatalogueRecyclerView.addItemDecoration(new ItemDecoration(2, 20, false));
|
||||
bind.artistCatalogueRecyclerView.setHasFixedSize(true);
|
||||
|
||||
artistAdapter = new ArtistCatalogueAdapter(requireContext(), new ArrayList<>());
|
||||
artistAdapter = new ArtistCatalogueAdapter(requireContext());
|
||||
artistAdapter.setClickListener((view, position) -> {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putParcelable("artist_object", artistAdapter.getItem(position));
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ public class ArtistPageFragment extends Fragment {
|
|||
bind.albumsRecyclerView.setLayoutManager(new LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false));
|
||||
bind.albumsRecyclerView.setHasFixedSize(true);
|
||||
|
||||
albumArtistPageAdapter = new AlbumArtistPageAdapter(requireContext(), new ArrayList<>());
|
||||
albumArtistPageAdapter = new AlbumArtistPageAdapter(requireContext());
|
||||
albumArtistPageAdapter.setClickListener((view, position) -> {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putParcelable("album_object", albumArtistPageAdapter.getItem(position));
|
||||
|
|
|
|||
|
|
@ -17,8 +17,6 @@ import com.cappielloantonio.play.model.Song;
|
|||
import com.cappielloantonio.play.ui.activities.MainActivity;
|
||||
import com.cappielloantonio.play.viewmodel.GenreCatalogueViewModel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class GenreCatalogueFragment extends Fragment {
|
||||
private static final String TAG = "GenreCatalogueFragment";;
|
||||
|
||||
|
|
@ -57,7 +55,7 @@ public class GenreCatalogueFragment extends Fragment {
|
|||
bind.genreCatalogueRecyclerView.addItemDecoration(new ItemDecoration(2, 16, false));
|
||||
bind.genreCatalogueRecyclerView.setHasFixedSize(true);
|
||||
|
||||
genreCatalogueAdapter = new GenreCatalogueAdapter(requireContext(), new ArrayList<>());
|
||||
genreCatalogueAdapter = new GenreCatalogueAdapter(requireContext());
|
||||
genreCatalogueAdapter.setClickListener((view, position) -> {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(Song.BY_GENRE, Song.BY_GENRE);
|
||||
|
|
|
|||
|
|
@ -16,14 +16,13 @@ import androidx.viewpager2.widget.ViewPager2;
|
|||
import com.cappielloantonio.play.R;
|
||||
import com.cappielloantonio.play.adapter.DiscoverSongAdapter;
|
||||
import com.cappielloantonio.play.adapter.RecentMusicAdapter;
|
||||
import com.cappielloantonio.play.adapter.YearAdapter;
|
||||
import com.cappielloantonio.play.databinding.FragmentHomeBinding;
|
||||
import com.cappielloantonio.play.model.Song;
|
||||
import com.cappielloantonio.play.ui.activities.MainActivity;
|
||||
import com.cappielloantonio.play.util.PreferenceUtil;
|
||||
import com.cappielloantonio.play.viewmodel.HomeViewModel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class HomeFragment extends Fragment {
|
||||
private static final String TAG = "CategoriesFragment";
|
||||
|
||||
|
|
@ -33,6 +32,7 @@ public class HomeFragment extends Fragment {
|
|||
|
||||
private DiscoverSongAdapter discoverSongAdapter;
|
||||
private RecentMusicAdapter recentlyAddedMusicAdapter;
|
||||
private YearAdapter yearAdapter;
|
||||
private RecentMusicAdapter recentlyPlayedMusicAdapter;
|
||||
private RecentMusicAdapter mostPlayedMusicAdapter;
|
||||
|
||||
|
|
@ -48,6 +48,7 @@ public class HomeFragment extends Fragment {
|
|||
init();
|
||||
initDiscoverSongSlideView();
|
||||
initRecentAddedSongView();
|
||||
initYearSongView();
|
||||
initRecentPlayedSongView();
|
||||
initMostPlayedSongView();
|
||||
|
||||
|
|
@ -99,16 +100,30 @@ public class HomeFragment extends Fragment {
|
|||
bind.recentlyAddedTracksRecyclerView.setLayoutManager(new LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false));
|
||||
bind.recentlyAddedTracksRecyclerView.setHasFixedSize(true);
|
||||
|
||||
recentlyAddedMusicAdapter = new RecentMusicAdapter(requireContext(), new ArrayList<>());
|
||||
recentlyAddedMusicAdapter = new RecentMusicAdapter(requireContext());
|
||||
bind.recentlyAddedTracksRecyclerView.setAdapter(recentlyAddedMusicAdapter);
|
||||
homeViewModel.getRecentlyAddedSongList().observe(requireActivity(), songs -> recentlyAddedMusicAdapter.setItems(songs));
|
||||
}
|
||||
|
||||
private void initYearSongView() {
|
||||
bind.yearsRecyclerView.setLayoutManager(new LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false));
|
||||
bind.yearsRecyclerView.setHasFixedSize(true);
|
||||
|
||||
yearAdapter = new YearAdapter(requireContext(), homeViewModel.getYearList());
|
||||
yearAdapter.setClickListener((view, position) -> {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(Song.BY_YEAR, Song.BY_YEAR);
|
||||
bundle.putInt("year_object", yearAdapter.getItem(position));
|
||||
activity.navController.navigate(R.id.action_homeFragment_to_songListPageFragment, bundle);
|
||||
});
|
||||
bind.yearsRecyclerView.setAdapter(yearAdapter);
|
||||
}
|
||||
|
||||
private void initRecentPlayedSongView() {
|
||||
bind.recentlyPlayedTracksRecyclerView.setLayoutManager(new LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false));
|
||||
bind.recentlyPlayedTracksRecyclerView.setHasFixedSize(true);
|
||||
|
||||
recentlyPlayedMusicAdapter = new RecentMusicAdapter(requireContext(), new ArrayList<>());
|
||||
recentlyPlayedMusicAdapter = new RecentMusicAdapter(requireContext());
|
||||
bind.recentlyPlayedTracksRecyclerView.setAdapter(recentlyPlayedMusicAdapter);
|
||||
homeViewModel.getRecentlyPlayedSongList().observe(requireActivity(), songs -> recentlyPlayedMusicAdapter.setItems(songs));
|
||||
}
|
||||
|
|
@ -117,7 +132,7 @@ public class HomeFragment extends Fragment {
|
|||
bind.mostPlayedTracksRecyclerView.setLayoutManager(new LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false));
|
||||
bind.mostPlayedTracksRecyclerView.setHasFixedSize(true);
|
||||
|
||||
mostPlayedMusicAdapter = new RecentMusicAdapter(requireContext(), new ArrayList<>());
|
||||
mostPlayedMusicAdapter = new RecentMusicAdapter(requireContext());
|
||||
bind.mostPlayedTracksRecyclerView.setAdapter(mostPlayedMusicAdapter);
|
||||
homeViewModel.getMostPlayedSongList().observe(requireActivity(), songs -> mostPlayedMusicAdapter.setItems(songs));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,8 +25,6 @@ import com.cappielloantonio.play.ui.activities.MainActivity;
|
|||
import com.cappielloantonio.play.util.PreferenceUtil;
|
||||
import com.cappielloantonio.play.viewmodel.LibraryViewModel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class LibraryFragment extends Fragment {
|
||||
private static final String TAG = "LibraryFragment";
|
||||
|
||||
|
|
@ -75,7 +73,7 @@ public class LibraryFragment extends Fragment {
|
|||
bind.albumRecyclerView.setLayoutManager(new LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false));
|
||||
bind.albumRecyclerView.setHasFixedSize(true);
|
||||
|
||||
albumAdapter = new AlbumAdapter(requireContext(), new ArrayList<>());
|
||||
albumAdapter = new AlbumAdapter(requireContext());
|
||||
albumAdapter.setClickListener((view, position) -> {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putParcelable("album_object", albumAdapter.getItem(position));
|
||||
|
|
@ -89,7 +87,7 @@ public class LibraryFragment extends Fragment {
|
|||
bind.artistRecyclerView.setLayoutManager(new LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false));
|
||||
bind.artistRecyclerView.setHasFixedSize(true);
|
||||
|
||||
artistAdapter = new ArtistAdapter(requireContext(), new ArrayList<>());
|
||||
artistAdapter = new ArtistAdapter(requireContext());
|
||||
artistAdapter.setClickListener((view, position) -> {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putParcelable("artist_object", artistAdapter.getItem(position));
|
||||
|
|
@ -103,7 +101,7 @@ public class LibraryFragment extends Fragment {
|
|||
bind.genreRecyclerView.setLayoutManager(new GridLayoutManager(requireContext(), 3, GridLayoutManager.HORIZONTAL, false));
|
||||
bind.genreRecyclerView.setHasFixedSize(true);
|
||||
|
||||
genreAdapter = new GenreAdapter(requireContext(), new ArrayList<>());
|
||||
genreAdapter = new GenreAdapter(requireContext());
|
||||
genreAdapter.setClickListener((view, position) -> {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(Song.BY_GENRE, Song.BY_GENRE);
|
||||
|
|
@ -118,7 +116,7 @@ public class LibraryFragment extends Fragment {
|
|||
bind.playlistRecyclerView.setLayoutManager(new GridLayoutManager(requireContext(), 2));
|
||||
bind.playlistRecyclerView.setHasFixedSize(true);
|
||||
|
||||
playlistAdapter = new PlaylistAdapter(requireContext(), new ArrayList<>());
|
||||
playlistAdapter = new PlaylistAdapter(requireContext());
|
||||
playlistAdapter.setClickListener((view, position) -> Toast.makeText(requireContext(), "Playlist: " + position, Toast.LENGTH_SHORT).show());
|
||||
bind.playlistRecyclerView.setAdapter(playlistAdapter);
|
||||
libraryViewModel.getPlaylistList().observe(requireActivity(), playlists -> playlistAdapter.setItems(playlists));
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ public class SearchFragment extends Fragment {
|
|||
bind.recentlySearchedTracksRecyclerView.setLayoutManager(new LinearLayoutManager(requireContext()));
|
||||
bind.recentlySearchedTracksRecyclerView.setHasFixedSize(true);
|
||||
|
||||
recentSearchAdapter = new RecentSearchAdapter(requireContext(), new ArrayList<>());
|
||||
recentSearchAdapter = new RecentSearchAdapter(requireContext());
|
||||
recentSearchAdapter.setClickListener((view, position) -> {
|
||||
RecentSearch search = recentSearchAdapter.getItem(position);
|
||||
search(search.getSearch());
|
||||
|
|
@ -95,7 +95,7 @@ public class SearchFragment extends Fragment {
|
|||
bind.searchResultAlbumRecyclerView.addItemDecoration(new ItemDecoration(2, 20, false));
|
||||
bind.searchResultAlbumRecyclerView.setHasFixedSize(true);
|
||||
|
||||
albumResultSearchAdapter = new AlbumCatalogueAdapter(requireContext(), new ArrayList<>());
|
||||
albumResultSearchAdapter = new AlbumCatalogueAdapter(requireContext());
|
||||
albumResultSearchAdapter.setClickListener((view, position) -> {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putParcelable("album_object", albumResultSearchAdapter.getItem(position));
|
||||
|
|
@ -108,7 +108,7 @@ public class SearchFragment extends Fragment {
|
|||
bind.searchResultArtistRecyclerView.addItemDecoration(new ItemDecoration(2, 20, false));
|
||||
bind.searchResultArtistRecyclerView.setHasFixedSize(true);
|
||||
|
||||
artistResultSearchAdapter = new ArtistCatalogueAdapter(requireContext(), new ArrayList<>());
|
||||
artistResultSearchAdapter = new ArtistCatalogueAdapter(requireContext());
|
||||
artistResultSearchAdapter.setClickListener((view, position) -> {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putParcelable("artist_object", artistResultSearchAdapter.getItem(position));
|
||||
|
|
|
|||
|
|
@ -74,6 +74,11 @@ public class SongListPageFragment extends Fragment {
|
|||
songListPageViewModel.filterNames = getArguments().getStringArrayList("filter_name_list");
|
||||
bind.pageTitleLabel.setText(songListPageViewModel.getFiltersTitle());
|
||||
}
|
||||
else if(getArguments().getString(Song.BY_YEAR) != null) {
|
||||
songListPageViewModel.title = Song.BY_YEAR;
|
||||
songListPageViewModel.year = getArguments().getInt("year_object");
|
||||
bind.pageTitleLabel.setText("Year " + songListPageViewModel.year);
|
||||
}
|
||||
}
|
||||
|
||||
private void initSongListView() {
|
||||
|
|
|
|||
|
|
@ -7,16 +7,13 @@ import androidx.lifecycle.AndroidViewModel;
|
|||
import androidx.lifecycle.LiveData;
|
||||
|
||||
import com.cappielloantonio.play.model.Album;
|
||||
import com.cappielloantonio.play.model.Artist;
|
||||
import com.cappielloantonio.play.repository.AlbumRepository;
|
||||
import com.cappielloantonio.play.repository.ArtistRepository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class AlbumCatalogueViewModel extends AndroidViewModel {
|
||||
private AlbumRepository albumRepository;
|
||||
|
||||
private LiveData<List<Album>> albumList;
|
||||
public LiveData<List<Album>> albumList;
|
||||
|
||||
public AlbumCatalogueViewModel(@NonNull Application application) {
|
||||
super(application);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.cappielloantonio.play.viewmodel;
|
||||
|
||||
import android.app.Application;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.AndroidViewModel;
|
||||
|
|
@ -19,6 +20,7 @@ public class HomeViewModel extends AndroidViewModel {
|
|||
private LiveData<List<Song>> recentlyPlayedSongSample;
|
||||
private LiveData<List<Song>> recentlyAddedSongSample;
|
||||
private LiveData<List<Song>> mostPlayedSongSample;
|
||||
private List<Integer> years;
|
||||
|
||||
public HomeViewModel(@NonNull Application application) {
|
||||
super(application);
|
||||
|
|
@ -29,6 +31,7 @@ public class HomeViewModel extends AndroidViewModel {
|
|||
recentlyPlayedSongSample = songRepository.getListLiveRecentlyPlayedSampleSong(20);
|
||||
recentlyAddedSongSample = songRepository.getListLiveRecentlyAddedSampleSong(20);
|
||||
mostPlayedSongSample = songRepository.getListLiveMostPlayedSampleSong(20);
|
||||
years = songRepository.getYearList();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -51,4 +54,9 @@ public class HomeViewModel extends AndroidViewModel {
|
|||
public LiveData<List<Song>> getMostPlayedSongList() {
|
||||
return mostPlayedSongSample;
|
||||
}
|
||||
|
||||
public List<Integer> getYearList() {
|
||||
Log.d(TAG, "getYearList: " + years.toString());
|
||||
return years;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ public class SongListPageViewModel extends AndroidViewModel {
|
|||
public Artist artist;
|
||||
public ArrayList<String> filters = new ArrayList<>();
|
||||
public ArrayList<String> filterNames = new ArrayList<>();
|
||||
public int year = 0;
|
||||
|
||||
public SongListPageViewModel(@NonNull Application application) {
|
||||
super(application);
|
||||
|
|
@ -52,6 +53,9 @@ public class SongListPageViewModel extends AndroidViewModel {
|
|||
case Song.BY_GENRES:
|
||||
songList = songRepository.getFilteredListLiveSong(filters);
|
||||
break;
|
||||
case Song.BY_YEAR:
|
||||
songList = songRepository.getSongByYearListLive(year);
|
||||
break;
|
||||
}
|
||||
|
||||
return songList;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,8 @@
|
|||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:paddingTop="20dp">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/loading_progress_bar"
|
||||
|
|
@ -12,7 +13,8 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:indeterminate="true"
|
||||
android:minWidth="128dp"
|
||||
android:layout_centerInParent="true"/>
|
||||
android:layout_centerInParent="true"
|
||||
android:visibility="visible"/>
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:id="@+id/album_catalogue_container"
|
||||
|
|
|
|||
|
|
@ -4,7 +4,8 @@
|
|||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:paddingTop="20dp">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/loading_progress_bar"
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
android:paddingStart="16dp"
|
||||
android:paddingTop="20dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:text="Discover Music"
|
||||
android:text="Music discovery"
|
||||
android:textColor="@color/titleTextColor"
|
||||
android:textSize="22sp"
|
||||
android:textStyle="bold" />
|
||||
|
|
@ -63,7 +63,7 @@
|
|||
android:paddingStart="8dp"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:text="Recently added tracks"
|
||||
android:text="Recently added"
|
||||
android:textColor="@color/titleTextColor"
|
||||
android:textSize="22sp"
|
||||
android:textStyle="bold" />
|
||||
|
|
@ -96,6 +96,38 @@
|
|||
android:paddingBottom="8dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Recently added tracks -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<!-- Label and button -->
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/open_sans_font_family"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingTop="20dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:text="Flashback"
|
||||
android:textColor="@color/titleTextColor"
|
||||
android:textSize="22sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/years_recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:clipToPadding="false"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:paddingBottom="8dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Recently played tracks -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
|
@ -119,7 +151,7 @@
|
|||
android:paddingStart="8dp"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:text="Recently played tracks"
|
||||
android:text="Last played"
|
||||
android:textColor="@color/titleTextColor"
|
||||
android:textSize="22sp"
|
||||
android:textStyle="bold" />
|
||||
|
|
@ -175,7 +207,7 @@
|
|||
android:paddingStart="8dp"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:text="Most played tracks"
|
||||
android:text="Most played"
|
||||
android:textColor="@color/titleTextColor"
|
||||
android:textSize="22sp"
|
||||
android:textStyle="bold" />
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
android:paddingStart="8dp"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:text="My Albums"
|
||||
android:text="Albums"
|
||||
android:textColor="@color/titleTextColor"
|
||||
android:textSize="22sp"
|
||||
android:textStyle="bold" />
|
||||
|
|
@ -104,7 +104,7 @@
|
|||
android:paddingStart="8dp"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:text="My Artists"
|
||||
android:text="Artists"
|
||||
android:textColor="@color/titleTextColor"
|
||||
android:textSize="22sp"
|
||||
android:textStyle="bold" />
|
||||
|
|
@ -167,7 +167,7 @@
|
|||
android:paddingStart="8dp"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:text="Music by genre"
|
||||
android:text="Genres"
|
||||
android:textColor="@color/titleTextColor"
|
||||
android:textSize="22sp"
|
||||
android:textStyle="bold" />
|
||||
|
|
|
|||
47
app/src/main/res/layout/item_home_year.xml
Normal file
47
app/src/main/res/layout/item_home_year.xml
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingEnd="12dp"
|
||||
android:paddingBottom="8dp">
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
xmlns:card_view="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/card_view"
|
||||
android:layout_width="172dp"
|
||||
android:layout_height="72dp"
|
||||
android:layout_gravity="center"
|
||||
android:backgroundTint="@color/cardColor"
|
||||
card_view:cardCornerRadius="4dp"
|
||||
card_view:cardElevation="2dp"
|
||||
card_view:cardPreventCornerOverlap="false"
|
||||
card_view:cardUseCompatPadding="true">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<View
|
||||
android:layout_width="6dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/colorAccent"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/year_label"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:layout_gravity="center"
|
||||
android:fontFamily="@font/open_sans_font_family"
|
||||
android:paddingStart="8dp"
|
||||
android:text="@string/label_placeholder"
|
||||
android:textColor="@color/titleTextColor"
|
||||
android:textSize="14sp"
|
||||
android:textStyle="bold"
|
||||
android:textAlignment="gravity"/>
|
||||
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
</LinearLayout>
|
||||
Loading…
Add table
Add a link
Reference in a new issue