mirror of
https://github.com/antebudimir/tempus.git
synced 2025-12-31 17:43:32 +00:00
Add favorite view
This commit is contained in:
parent
ae23d268cd
commit
01bdbf49b2
52 changed files with 1064 additions and 317 deletions
|
|
@ -6,7 +6,6 @@
|
|||
<uses-permission
|
||||
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
|
||||
tools:ignore="ScopedStorage" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import com.cappielloantonio.play.R;
|
|||
import com.cappielloantonio.play.glide.CustomGlideRequest;
|
||||
import com.cappielloantonio.play.model.Album;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class AlbumAdapter extends RecyclerView.Adapter<AlbumAdapter.ViewHolder> {
|
||||
|
|
@ -26,6 +27,7 @@ public class AlbumAdapter extends RecyclerView.Adapter<AlbumAdapter.ViewHolder>
|
|||
public AlbumAdapter(Context context) {
|
||||
this.context = context;
|
||||
this.inflater = LayoutInflater.from(context);
|
||||
this.albums = new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import com.cappielloantonio.play.R;
|
|||
import com.cappielloantonio.play.glide.CustomGlideRequest;
|
||||
import com.cappielloantonio.play.model.Album;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class AlbumArtistPageAdapter extends RecyclerView.Adapter<AlbumArtistPageAdapter.ViewHolder> {
|
||||
|
|
@ -26,6 +27,7 @@ public class AlbumArtistPageAdapter extends RecyclerView.Adapter<AlbumArtistPage
|
|||
public AlbumArtistPageAdapter(Context context) {
|
||||
this.context = context;
|
||||
this.inflater = LayoutInflater.from(context);
|
||||
this.albums = new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import com.cappielloantonio.play.R;
|
|||
import com.cappielloantonio.play.glide.CustomGlideRequest;
|
||||
import com.cappielloantonio.play.model.Album;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class AlbumCatalogueAdapter extends RecyclerView.Adapter<AlbumCatalogueAdapter.ViewHolder> {
|
||||
|
|
@ -26,6 +27,7 @@ public class AlbumCatalogueAdapter extends RecyclerView.Adapter<AlbumCatalogueAd
|
|||
public AlbumCatalogueAdapter(Context context) {
|
||||
this.context = context;
|
||||
this.inflater = LayoutInflater.from(context);
|
||||
this.albums = new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import com.cappielloantonio.play.R;
|
|||
import com.cappielloantonio.play.glide.CustomGlideRequest;
|
||||
import com.cappielloantonio.play.model.Artist;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ArtistAdapter extends RecyclerView.Adapter<ArtistAdapter.ViewHolder> {
|
||||
|
|
@ -26,6 +27,7 @@ public class ArtistAdapter extends RecyclerView.Adapter<ArtistAdapter.ViewHolder
|
|||
public ArtistAdapter(Context context) {
|
||||
this.context = context;
|
||||
this.inflater = LayoutInflater.from(context);
|
||||
this.artists = new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import com.cappielloantonio.play.R;
|
|||
import com.cappielloantonio.play.glide.CustomGlideRequest;
|
||||
import com.cappielloantonio.play.model.Artist;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ArtistCatalogueAdapter extends RecyclerView.Adapter<ArtistCatalogueAdapter.ViewHolder> {
|
||||
|
|
@ -26,6 +27,7 @@ public class ArtistCatalogueAdapter extends RecyclerView.Adapter<ArtistCatalogue
|
|||
public ArtistCatalogueAdapter(Context context) {
|
||||
this.context = context;
|
||||
this.inflater = LayoutInflater.from(context);
|
||||
this.artists = new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ public class DiscoverSongAdapter extends RecyclerView.Adapter<DiscoverSongAdapte
|
|||
@Override
|
||||
public void onClick(View view) {
|
||||
SongRepository songRepository = new SongRepository(App.getInstance());
|
||||
songRepository.update(songs.get(getAdapterPosition()));
|
||||
songRepository.increasePlayCount(songs.get(getAdapterPosition()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||
import com.cappielloantonio.play.R;
|
||||
import com.cappielloantonio.play.model.Genre;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class GenreAdapter extends RecyclerView.Adapter<GenreAdapter.ViewHolder> {
|
||||
|
|
@ -24,6 +25,7 @@ public class GenreAdapter extends RecyclerView.Adapter<GenreAdapter.ViewHolder>
|
|||
public GenreAdapter(Context context) {
|
||||
this.context = context;
|
||||
this.mInflater = LayoutInflater.from(context);
|
||||
this.genres = new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||
import com.cappielloantonio.play.R;
|
||||
import com.cappielloantonio.play.model.Genre;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class GenreCatalogueAdapter extends RecyclerView.Adapter<GenreCatalogueAdapter.ViewHolder> {
|
||||
|
|
@ -24,6 +25,7 @@ public class GenreCatalogueAdapter extends RecyclerView.Adapter<GenreCatalogueAd
|
|||
public GenreCatalogueAdapter(Context context) {
|
||||
this.context = context;
|
||||
this.mInflater = LayoutInflater.from(context);
|
||||
this.genres = new ArrayList<>();
|
||||
}
|
||||
|
||||
// inflates the row layout from xml when needed
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||
import com.cappielloantonio.play.R;
|
||||
import com.cappielloantonio.play.model.Playlist;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class PlaylistAdapter extends RecyclerView.Adapter<PlaylistAdapter.ViewHolder> {
|
||||
|
|
@ -24,6 +25,7 @@ public class PlaylistAdapter extends RecyclerView.Adapter<PlaylistAdapter.ViewHo
|
|||
public PlaylistAdapter(Context context) {
|
||||
this.context = context;
|
||||
this.mInflater = LayoutInflater.from(context);
|
||||
this.playlists = new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import com.cappielloantonio.play.glide.CustomGlideRequest;
|
|||
import com.cappielloantonio.play.model.Song;
|
||||
import com.cappielloantonio.play.repository.SongRepository;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -30,6 +31,7 @@ public class RecentMusicAdapter extends RecyclerView.Adapter<RecentMusicAdapter.
|
|||
public RecentMusicAdapter(Context context) {
|
||||
this.context = context;
|
||||
this.mInflater = LayoutInflater.from(context);
|
||||
this.songs = new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -74,7 +76,7 @@ public class RecentMusicAdapter extends RecyclerView.Adapter<RecentMusicAdapter.
|
|||
@Override
|
||||
public void onClick(View view) {
|
||||
SongRepository songRepository = new SongRepository(App.getInstance());
|
||||
songRepository.update(songs.get(getAdapterPosition()));
|
||||
songRepository.increasePlayCount(songs.get(getAdapterPosition()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||
import com.cappielloantonio.play.R;
|
||||
import com.cappielloantonio.play.model.RecentSearch;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class RecentSearchAdapter extends RecyclerView.Adapter<RecentSearchAdapter.ViewHolder> {
|
||||
|
|
@ -24,6 +25,7 @@ public class RecentSearchAdapter extends RecyclerView.Adapter<RecentSearchAdapte
|
|||
public RecentSearchAdapter(Context context) {
|
||||
this.context = context;
|
||||
this.mInflater = LayoutInflater.from(context);
|
||||
this.searches = new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import android.view.ViewGroup;
|
|||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.cappielloantonio.play.App;
|
||||
|
|
@ -14,8 +15,10 @@ import com.cappielloantonio.play.R;
|
|||
import com.cappielloantonio.play.glide.CustomGlideRequest;
|
||||
import com.cappielloantonio.play.model.Song;
|
||||
import com.cappielloantonio.play.repository.SongRepository;
|
||||
import com.cappielloantonio.play.ui.fragment.bottomsheetdialog.SongBottomSheetDialog;
|
||||
import com.cappielloantonio.play.util.Util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -27,10 +30,13 @@ public class SongResultSearchAdapter extends RecyclerView.Adapter<SongResultSear
|
|||
private List<Song> songs;
|
||||
private LayoutInflater mInflater;
|
||||
private Context context;
|
||||
private FragmentManager fragmentManager;
|
||||
|
||||
public SongResultSearchAdapter(Context context) {
|
||||
public SongResultSearchAdapter(Context context, FragmentManager fragmentManager) {
|
||||
this.context = context;
|
||||
this.fragmentManager = fragmentManager;
|
||||
this.mInflater = LayoutInflater.from(context);
|
||||
this.songs = new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -58,7 +64,7 @@ public class SongResultSearchAdapter extends RecyclerView.Adapter<SongResultSear
|
|||
return songs.size();
|
||||
}
|
||||
|
||||
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
|
||||
public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener {
|
||||
TextView songTitle;
|
||||
TextView songArtist;
|
||||
TextView songDuration;
|
||||
|
|
@ -73,12 +79,20 @@ public class SongResultSearchAdapter extends RecyclerView.Adapter<SongResultSear
|
|||
cover = itemView.findViewById(R.id.song_cover_image_view);
|
||||
|
||||
itemView.setOnClickListener(this);
|
||||
itemView.setOnLongClickListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
SongRepository songRepository = new SongRepository(App.getInstance());
|
||||
songRepository.update(songs.get(getAdapterPosition()));
|
||||
songRepository.increasePlayCount(songs.get(getAdapterPosition()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
SongBottomSheetDialog songBottomSheetDialog = new SongBottomSheetDialog(songs.get(getAdapterPosition()));
|
||||
songBottomSheetDialog.show(fragmentManager, null);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -90,4 +104,5 @@ public class SongResultSearchAdapter extends RecyclerView.Adapter<SongResultSear
|
|||
public Song getItem(int id) {
|
||||
return songs.get(id);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,30 @@
|
|||
package com.cappielloantonio.play.broadcast.receiver;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.view.View;
|
||||
|
||||
import com.cappielloantonio.play.ui.activities.MainActivity;
|
||||
|
||||
public class ConnectivityStatusBroadcastReceiver extends BroadcastReceiver {
|
||||
private MainActivity activity;
|
||||
|
||||
public ConnectivityStatusBroadcastReceiver(MainActivity activity) {
|
||||
this.activity = activity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (ConnectivityManager.CONNECTIVITY_ACTION.equals(intent.getAction())) {
|
||||
boolean noConnectivity = intent.getBooleanExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, false);
|
||||
|
||||
if (noConnectivity) {
|
||||
activity.activityMainBinding.offlineModeLinearLayout.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
activity.activityMainBinding.offlineModeLinearLayout.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -18,6 +18,9 @@ public interface SongDao {
|
|||
@Query("SELECT * FROM song")
|
||||
LiveData<List<Song>> getAll();
|
||||
|
||||
@Query("SELECT * FROM song WHERE id = :id")
|
||||
LiveData<Song> getOne(String id);
|
||||
|
||||
@Query("SELECT * FROM song")
|
||||
List<Song> getAllList();
|
||||
|
||||
|
|
@ -33,7 +36,7 @@ public interface SongDao {
|
|||
@Query("SELECT * FROM song WHERE play_count != 0 ORDER BY play_count DESC LIMIT :number")
|
||||
LiveData<List<Song>> getMostPlayedSample(int number);
|
||||
|
||||
@Query("SELECT * FROM song WHERE play_count != 0 AND artistId = :artistID ORDER BY play_count DESC LIMIT :number")
|
||||
@Query("SELECT * FROM song WHERE artistId = :artistID ORDER BY play_count DESC LIMIT :number")
|
||||
LiveData<List<Song>> getArtistTopSongsSample(String artistID, int number);
|
||||
|
||||
@Query("SELECT * FROM song WHERE artistId = :artistID ORDER BY play_count DESC")
|
||||
|
|
@ -48,6 +51,12 @@ public interface SongDao {
|
|||
@Query("SELECT * FROM song INNER Join song_genre_cross ON song.id = song_genre_cross.song_id AND song_genre_cross.genre_id IN (:filters) GROUP BY song.id")
|
||||
LiveData<List<Song>> getFilteredSong(ArrayList<String> filters);
|
||||
|
||||
@Query("SELECT * FROM song WHERE favorite = 1 ORDER BY play_count DESC LIMIT :number")
|
||||
LiveData<List<Song>> getFavoriteSongSample(int number);
|
||||
|
||||
@Query("SELECT * FROM song WHERE favorite = 1 ORDER BY play_count DESC")
|
||||
LiveData<List<Song>> getFavoriteSong();
|
||||
|
||||
@Query("SELECT EXISTS(SELECT * FROM song WHERE id = :id)")
|
||||
boolean exist(String id);
|
||||
|
||||
|
|
|
|||
|
|
@ -40,6 +40,9 @@ public class Song implements Parcelable {
|
|||
@Ignore
|
||||
public static final String BY_YEAR = "BY_YEAR";
|
||||
|
||||
@Ignore
|
||||
public static final String IS_FAVORITE = "IS_FAVORITE";
|
||||
|
||||
@NonNull
|
||||
@PrimaryKey
|
||||
@ColumnInfo(name = "id")
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ public class SongRepository {
|
|||
private SongDao songDao;
|
||||
private SongGenreCrossDao songGenreCrossDao;
|
||||
private LiveData<List<Song>> searchListLiveSongs;
|
||||
private LiveData<Song> liveDataSong;
|
||||
private LiveData<List<Song>> listLiveSampleRecentlyAddedSongs;
|
||||
private LiveData<List<Song>> listLiveSampleRecentlyPlayedSongs;
|
||||
private LiveData<List<Song>> listLiveSampleMostPlayedSongs;
|
||||
|
|
@ -25,6 +26,8 @@ public class SongRepository {
|
|||
private LiveData<List<Song>> listLiveSongByGenre;
|
||||
private LiveData<List<Song>> listLiveFilteredSongs;
|
||||
private LiveData<List<Song>> listLiveSongByYear;
|
||||
private LiveData<List<Song>> listLiveSampleFavoritesSong;
|
||||
private LiveData<List<Song>> listLiveFavoritesSong;
|
||||
|
||||
|
||||
public SongRepository(Application application) {
|
||||
|
|
@ -38,6 +41,11 @@ public class SongRepository {
|
|||
return searchListLiveSongs;
|
||||
}
|
||||
|
||||
public LiveData<Song> getLiveDataSong(String id) {
|
||||
liveDataSong = songDao.getOne(id);
|
||||
return liveDataSong;
|
||||
}
|
||||
|
||||
public LiveData<List<Song>> getListLiveRecentlyAddedSampleSong(int number) {
|
||||
listLiveSampleRecentlyAddedSongs = songDao.getRecentlyAddedSample(number);
|
||||
return listLiveSampleRecentlyAddedSongs;
|
||||
|
|
@ -138,6 +146,16 @@ public class SongRepository {
|
|||
return listLiveSongByYear;
|
||||
}
|
||||
|
||||
public LiveData<List<Song>> getListLiveFavoritesSampleSong(int number) {
|
||||
listLiveSampleFavoritesSong = songDao.getFavoriteSongSample(number);
|
||||
return listLiveSampleFavoritesSong;
|
||||
}
|
||||
|
||||
public LiveData<List<Song>> getListLiveFavoritesSong() {
|
||||
listLiveFavoritesSong = songDao.getFavoriteSong();
|
||||
return listLiveFavoritesSong;
|
||||
}
|
||||
|
||||
public boolean exist(Song song) {
|
||||
boolean exist = false;
|
||||
|
||||
|
|
@ -173,7 +191,7 @@ public class SongRepository {
|
|||
thread.start();
|
||||
}
|
||||
|
||||
public void update(Song song) {
|
||||
public void increasePlayCount(Song song) {
|
||||
song.nowPlaying();
|
||||
|
||||
UpdateThreadSafe update = new UpdateThreadSafe(songDao, song);
|
||||
|
|
@ -181,6 +199,12 @@ public class SongRepository {
|
|||
thread.start();
|
||||
}
|
||||
|
||||
public void setFavoriteStatus(Song song) {
|
||||
UpdateThreadSafe update = new UpdateThreadSafe(songDao, song);
|
||||
Thread thread = new Thread(update);
|
||||
thread.start();
|
||||
}
|
||||
|
||||
public void getAll() {
|
||||
GetCatalogueThreadSafe catalogue = new GetCatalogueThreadSafe(songDao);
|
||||
Thread thread = new Thread(catalogue);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package com.cappielloantonio.play.ui.activities;
|
||||
|
||||
import android.content.IntentFilter;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
|
|
@ -10,6 +12,7 @@ import androidx.navigation.ui.NavigationUI;
|
|||
|
||||
import com.cappielloantonio.play.App;
|
||||
import com.cappielloantonio.play.R;
|
||||
import com.cappielloantonio.play.broadcast.receiver.ConnectivityStatusBroadcastReceiver;
|
||||
import com.cappielloantonio.play.databinding.ActivityMainBinding;
|
||||
import com.cappielloantonio.play.ui.activities.base.BaseActivity;
|
||||
import com.cappielloantonio.play.util.PreferenceUtil;
|
||||
|
|
@ -26,23 +29,33 @@ import java.util.Objects;
|
|||
public class MainActivity extends BaseActivity {
|
||||
private static final String TAG = "MainActivity";
|
||||
|
||||
private ActivityMainBinding activityMainBinding;
|
||||
public ActivityMainBinding activityMainBinding;
|
||||
|
||||
private FragmentManager fragmentManager;
|
||||
private NavHostFragment navHostFragment;
|
||||
private BottomNavigationView bottomNavigationView;
|
||||
public NavController navController;
|
||||
|
||||
ConnectivityStatusBroadcastReceiver connectivityStatusBroadcastReceiver;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
activityMainBinding = ActivityMainBinding.inflate(getLayoutInflater());
|
||||
View view = activityMainBinding.getRoot();
|
||||
setContentView(view);
|
||||
connectivityStatusBroadcastReceiver = new ConnectivityStatusBroadcastReceiver(this);
|
||||
connectivityStatusReceiverManager(true);
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
connectivityStatusReceiverManager(false);
|
||||
}
|
||||
|
||||
public void init() {
|
||||
fragmentManager = getSupportFragmentManager();
|
||||
bottomNavigationView = findViewById(R.id.bottom_navigation);
|
||||
|
|
@ -76,7 +89,7 @@ public class MainActivity extends BaseActivity {
|
|||
|
||||
@Override
|
||||
public void onError(Exception exception) {
|
||||
goToLogin();
|
||||
goFromLogin();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -130,4 +143,14 @@ public class MainActivity extends BaseActivity {
|
|||
goToSync();
|
||||
}
|
||||
}
|
||||
|
||||
private void connectivityStatusReceiverManager(boolean isActive) {
|
||||
if(isActive) {
|
||||
IntentFilter filter = new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION);
|
||||
registerReceiver(connectivityStatusBroadcastReceiver, filter);
|
||||
}
|
||||
else {
|
||||
unregisterReceiver(connectivityStatusBroadcastReceiver);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -38,6 +38,12 @@ public class AlbumCatalogueFragment extends Fragment {
|
|||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
activity.setBottomNavigationBarVisibility(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
|
|
|
|||
|
|
@ -13,10 +13,9 @@ import com.cappielloantonio.play.adapter.SongResultSearchAdapter;
|
|||
import com.cappielloantonio.play.databinding.FragmentAlbumPageBinding;
|
||||
import com.cappielloantonio.play.glide.CustomGlideRequest;
|
||||
import com.cappielloantonio.play.ui.activities.MainActivity;
|
||||
import com.cappielloantonio.play.ui.fragment.bottomsheetdialog.AlbumBottomSheetDialog;
|
||||
import com.cappielloantonio.play.viewmodel.AlbumPageViewModel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class AlbumPageFragment extends Fragment {
|
||||
|
||||
private FragmentAlbumPageBinding bind;
|
||||
|
|
@ -26,7 +25,7 @@ public class AlbumPageFragment extends Fragment {
|
|||
private SongResultSearchAdapter songResultSearchAdapter;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
activity = (MainActivity) getActivity();
|
||||
|
||||
bind = FragmentAlbumPageBinding.inflate(inflater, container, false);
|
||||
|
|
@ -34,12 +33,19 @@ public class AlbumPageFragment extends Fragment {
|
|||
albumPageViewModel = new ViewModelProvider(requireActivity()).get(AlbumPageViewModel.class);
|
||||
|
||||
init();
|
||||
initBottomSheetDialog();
|
||||
initBackCover();
|
||||
initSongsView();
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
activity.setBottomNavigationBarVisibility(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
|
|
@ -59,11 +65,18 @@ public class AlbumPageFragment extends Fragment {
|
|||
bind.albumTitleLabel.setText(albumPageViewModel.getAlbum().getTitle());
|
||||
}
|
||||
|
||||
private void initBottomSheetDialog() {
|
||||
bind.albumSettingsImageButton.setOnClickListener(v -> {
|
||||
AlbumBottomSheetDialog albumBottomSheetDialog = new AlbumBottomSheetDialog(albumPageViewModel.getAlbum());
|
||||
albumBottomSheetDialog.show(this.getChildFragmentManager(), null);
|
||||
});
|
||||
}
|
||||
|
||||
private void initSongsView() {
|
||||
bind.songRecyclerView.setLayoutManager(new LinearLayoutManager(requireContext()));
|
||||
bind.songRecyclerView.setHasFixedSize(true);
|
||||
|
||||
songResultSearchAdapter = new SongResultSearchAdapter(requireContext(), new ArrayList<>());
|
||||
songResultSearchAdapter = new SongResultSearchAdapter(requireContext(), getChildFragmentManager());
|
||||
bind.songRecyclerView.setAdapter(songResultSearchAdapter);
|
||||
albumPageViewModel.getAlbumSongList().observe(requireActivity(), songs -> songResultSearchAdapter.setItems(songs));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,6 +38,12 @@ public class ArtistCatalogueFragment extends Fragment {
|
|||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
activity.setBottomNavigationBarVisibility(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
|
|
|
|||
|
|
@ -18,8 +18,6 @@ import com.cappielloantonio.play.model.Song;
|
|||
import com.cappielloantonio.play.ui.activities.MainActivity;
|
||||
import com.cappielloantonio.play.viewmodel.ArtistPageViewModel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class ArtistPageFragment extends Fragment {
|
||||
|
||||
private FragmentArtistPageBinding bind;
|
||||
|
|
@ -45,6 +43,13 @@ public class ArtistPageFragment extends Fragment {
|
|||
return view;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
activity.setBottomNavigationBarVisibility(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
|
|
@ -74,7 +79,7 @@ public class ArtistPageFragment extends Fragment {
|
|||
bind.mostStreamedSongRecyclerView.setLayoutManager(new LinearLayoutManager(requireContext()));
|
||||
bind.mostStreamedSongRecyclerView.setHasFixedSize(true);
|
||||
|
||||
songResultSearchAdapter = new SongResultSearchAdapter(requireContext(), new ArrayList<>());
|
||||
songResultSearchAdapter = new SongResultSearchAdapter(requireContext(), getChildFragmentManager());
|
||||
bind.mostStreamedSongRecyclerView.setAdapter(songResultSearchAdapter);
|
||||
artistPageViewModel.getArtistTopSongList().observe(requireActivity(), songs -> songResultSearchAdapter.setItems(songs));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import android.os.Bundle;
|
|||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
|
@ -41,6 +40,12 @@ public class FilterFragment extends Fragment {
|
|||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
activity.setBottomNavigationBarVisibility(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
|
|
|
|||
|
|
@ -40,6 +40,12 @@ public class GenreCatalogueFragment extends Fragment {
|
|||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
activity.setBottomNavigationBarVisibility(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
|
|
|
|||
|
|
@ -7,15 +7,18 @@ import android.view.ViewGroup;
|
|||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
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.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.SongResultSearchAdapter;
|
||||
import com.cappielloantonio.play.adapter.YearAdapter;
|
||||
import com.cappielloantonio.play.databinding.FragmentHomeBinding;
|
||||
import com.cappielloantonio.play.model.Song;
|
||||
|
|
@ -33,6 +36,7 @@ public class HomeFragment extends Fragment {
|
|||
private DiscoverSongAdapter discoverSongAdapter;
|
||||
private RecentMusicAdapter recentlyAddedMusicAdapter;
|
||||
private YearAdapter yearAdapter;
|
||||
private SongResultSearchAdapter favoriteSongAdapter;
|
||||
private RecentMusicAdapter recentlyPlayedMusicAdapter;
|
||||
private RecentMusicAdapter mostPlayedMusicAdapter;
|
||||
|
||||
|
|
@ -46,15 +50,23 @@ public class HomeFragment extends Fragment {
|
|||
homeViewModel = new ViewModelProvider(requireActivity()).get(HomeViewModel.class);
|
||||
|
||||
init();
|
||||
initSwipeToRefresh();
|
||||
initDiscoverSongSlideView();
|
||||
initRecentAddedSongView();
|
||||
initFavoritesSongView();
|
||||
initYearSongView();
|
||||
initRecentPlayedSongView();
|
||||
initMostPlayedSongView();
|
||||
initRecentPlayedSongView();
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
activity.setBottomNavigationBarVisibility(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
|
|
@ -62,12 +74,6 @@ public class HomeFragment extends Fragment {
|
|||
}
|
||||
|
||||
private void init() {
|
||||
bind.resyncButton.setOnClickListener(v -> {
|
||||
PreferenceUtil.getInstance(requireContext()).setSync(false);
|
||||
PreferenceUtil.getInstance(requireContext()).setSongGenreSync(false);
|
||||
activity.goToSync();
|
||||
});
|
||||
|
||||
bind.recentlyAddedTracksTextViewClickable.setOnClickListener(v -> {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(Song.RECENTLY_ADDED, Song.RECENTLY_ADDED);
|
||||
|
|
@ -85,6 +91,29 @@ public class HomeFragment extends Fragment {
|
|||
bundle.putString(Song.MOST_PLAYED, Song.MOST_PLAYED);
|
||||
activity.navController.navigate(R.id.action_homeFragment_to_songListPageFragment, bundle);
|
||||
});
|
||||
|
||||
bind.favoritesTracksTextViewClickable.setOnClickListener(v -> {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(Song.IS_FAVORITE, Song.IS_FAVORITE);
|
||||
activity.navController.navigate(R.id.action_homeFragment_to_songListPageFragment, bundle);
|
||||
});
|
||||
}
|
||||
|
||||
private void initSwipeToRefresh() {
|
||||
bind.pullToRefreshLayout.setOnRefreshListener(() -> {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(requireContext());
|
||||
builder.setMessage("Force reload your entire music library")
|
||||
.setTitle("Force sync")
|
||||
.setNegativeButton(R.string.ignore, null)
|
||||
.setPositiveButton("Sync", (dialog, id) -> {
|
||||
PreferenceUtil.getInstance(requireContext()).setSync(false);
|
||||
PreferenceUtil.getInstance(requireContext()).setSongGenreSync(false);
|
||||
activity.goToSync();
|
||||
})
|
||||
.show();
|
||||
|
||||
bind.pullToRefreshLayout.setRefreshing(false);
|
||||
});
|
||||
}
|
||||
|
||||
private void initDiscoverSongSlideView() {
|
||||
|
|
@ -119,13 +148,13 @@ public class HomeFragment extends Fragment {
|
|||
bind.yearsRecyclerView.setAdapter(yearAdapter);
|
||||
}
|
||||
|
||||
private void initRecentPlayedSongView() {
|
||||
bind.recentlyPlayedTracksRecyclerView.setLayoutManager(new LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false));
|
||||
bind.recentlyPlayedTracksRecyclerView.setHasFixedSize(true);
|
||||
private void initFavoritesSongView() {
|
||||
bind.favoritesTracksRecyclerView.setLayoutManager(new GridLayoutManager(requireContext(), 3, GridLayoutManager.HORIZONTAL, false));
|
||||
bind.favoritesTracksRecyclerView.setHasFixedSize(true);
|
||||
|
||||
recentlyPlayedMusicAdapter = new RecentMusicAdapter(requireContext());
|
||||
bind.recentlyPlayedTracksRecyclerView.setAdapter(recentlyPlayedMusicAdapter);
|
||||
homeViewModel.getRecentlyPlayedSongList().observe(requireActivity(), songs -> recentlyPlayedMusicAdapter.setItems(songs));
|
||||
favoriteSongAdapter = new SongResultSearchAdapter(requireContext(), getChildFragmentManager());
|
||||
bind.favoritesTracksRecyclerView.setAdapter(favoriteSongAdapter);
|
||||
homeViewModel.getFavorites().observe(requireActivity(), songs -> favoriteSongAdapter.setItems(songs));
|
||||
}
|
||||
|
||||
private void initMostPlayedSongView() {
|
||||
|
|
@ -137,6 +166,15 @@ public class HomeFragment extends Fragment {
|
|||
homeViewModel.getMostPlayedSongList().observe(requireActivity(), songs -> mostPlayedMusicAdapter.setItems(songs));
|
||||
}
|
||||
|
||||
private void initRecentPlayedSongView() {
|
||||
bind.recentlyPlayedTracksRecyclerView.setLayoutManager(new LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false));
|
||||
bind.recentlyPlayedTracksRecyclerView.setHasFixedSize(true);
|
||||
|
||||
recentlyPlayedMusicAdapter = new RecentMusicAdapter(requireContext());
|
||||
bind.recentlyPlayedTracksRecyclerView.setAdapter(recentlyPlayedMusicAdapter);
|
||||
homeViewModel.getRecentlyPlayedSongList().observe(requireActivity(), songs -> recentlyPlayedMusicAdapter.setItems(songs));
|
||||
}
|
||||
|
||||
private void settDiscoverSongSlideViewOffset(float pageOffset, float pageMargin) {
|
||||
bind.discoverSongViewPager.setPageTransformer((page, position) -> {
|
||||
float myOffset = position * -(2 * pageOffset + pageMargin);
|
||||
|
|
|
|||
|
|
@ -56,6 +56,12 @@ public class LibraryFragment extends Fragment {
|
|||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
activity.setBottomNavigationBarVisibility(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
|
|
@ -66,7 +72,6 @@ public class LibraryFragment extends Fragment {
|
|||
bind.albumCatalogueTextViewClickable.setOnClickListener(v -> activity.navController.navigate(R.id.action_libraryFragment_to_albumCatalogueFragment));
|
||||
bind.artistCatalogueTextViewClickable.setOnClickListener(v -> activity.navController.navigate(R.id.action_libraryFragment_to_artistCatalogueFragment));
|
||||
bind.genreCatalogueTextViewClickable.setOnClickListener(v -> activity.navController.navigate(R.id.action_libraryFragment_to_genreCatalogueFragment));
|
||||
bind.syncGenreButton.setOnClickListener(v -> syncSongsPerGenre());
|
||||
}
|
||||
|
||||
private void initAlbumView() {
|
||||
|
|
|
|||
|
|
@ -58,6 +58,12 @@ public class SearchFragment extends Fragment {
|
|||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
activity.setBottomNavigationBarVisibility(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
|
|
@ -87,7 +93,7 @@ public class SearchFragment extends Fragment {
|
|||
bind.searchResultTracksRecyclerView.setLayoutManager(new LinearLayoutManager(requireContext()));
|
||||
bind.searchResultTracksRecyclerView.setHasFixedSize(true);
|
||||
|
||||
songResultSearchAdapter = new SongResultSearchAdapter(requireContext(), new ArrayList<>());
|
||||
songResultSearchAdapter = new SongResultSearchAdapter(requireContext(), getChildFragmentManager());
|
||||
bind.searchResultTracksRecyclerView.setAdapter(songResultSearchAdapter);
|
||||
|
||||
// Albums
|
||||
|
|
|
|||
|
|
@ -15,8 +15,6 @@ import com.cappielloantonio.play.model.Song;
|
|||
import com.cappielloantonio.play.ui.activities.MainActivity;
|
||||
import com.cappielloantonio.play.viewmodel.SongListPageViewModel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class SongListPageFragment extends Fragment {
|
||||
|
||||
private FragmentSongListPageBinding bind;
|
||||
|
|
@ -39,6 +37,12 @@ public class SongListPageFragment extends Fragment {
|
|||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart() {
|
||||
super.onStart();
|
||||
activity.setBottomNavigationBarVisibility(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
|
|
@ -79,13 +83,17 @@ public class SongListPageFragment extends Fragment {
|
|||
songListPageViewModel.year = getArguments().getInt("year_object");
|
||||
bind.pageTitleLabel.setText("Year " + songListPageViewModel.year);
|
||||
}
|
||||
else if(getArguments().getString(Song.IS_FAVORITE) != null) {
|
||||
songListPageViewModel.title = Song.IS_FAVORITE;
|
||||
bind.pageTitleLabel.setText("Favourite song");
|
||||
}
|
||||
}
|
||||
|
||||
private void initSongListView() {
|
||||
bind.songListRecyclerView.setLayoutManager(new LinearLayoutManager(requireContext()));
|
||||
bind.songListRecyclerView.setHasFixedSize(true);
|
||||
|
||||
songResultSearchAdapter = new SongResultSearchAdapter(requireContext(), new ArrayList<>());
|
||||
songResultSearchAdapter = new SongResultSearchAdapter(requireContext(), getChildFragmentManager());
|
||||
bind.songListRecyclerView.setAdapter(songResultSearchAdapter);
|
||||
songListPageViewModel.getSongList().observe(requireActivity(), songs -> songResultSearchAdapter.setItems(songs));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,7 +99,6 @@ public class SyncFragment extends Fragment {
|
|||
}
|
||||
|
||||
private void syncAlbums() {
|
||||
Log.d(TAG, "syncAlbums");
|
||||
SyncUtil.getAlbums(requireContext(), new MediaCallback() {
|
||||
@Override
|
||||
public void onError(Exception exception) {
|
||||
|
|
@ -117,7 +116,6 @@ public class SyncFragment extends Fragment {
|
|||
}
|
||||
|
||||
private void syncArtists() {
|
||||
Log.d(TAG, "syncArtists");
|
||||
SyncUtil.getArtists(requireContext(), new MediaCallback() {
|
||||
@Override
|
||||
public void onError(Exception exception) {
|
||||
|
|
@ -135,7 +133,6 @@ public class SyncFragment extends Fragment {
|
|||
}
|
||||
|
||||
private void syncGenres() {
|
||||
Log.d(TAG, "syncGenres");
|
||||
SyncUtil.getGenres(requireContext(), new MediaCallback() {
|
||||
@Override
|
||||
public void onError(Exception exception) {
|
||||
|
|
@ -156,7 +153,6 @@ public class SyncFragment extends Fragment {
|
|||
}
|
||||
|
||||
private void syncPlaylist() {
|
||||
Log.d(TAG, "syncPlaylist");
|
||||
SyncUtil.getPlaylists(requireContext(), new MediaCallback() {
|
||||
@Override
|
||||
public void onError(Exception exception) {
|
||||
|
|
@ -174,7 +170,6 @@ public class SyncFragment extends Fragment {
|
|||
}
|
||||
|
||||
private void syncSongs() {
|
||||
Log.d(TAG, "syncSongs");
|
||||
SyncUtil.getSongs(requireContext(), syncViewModel.getCatalogue(), new MediaCallback() {
|
||||
@Override
|
||||
public void onError(Exception exception) {
|
||||
|
|
@ -193,8 +188,6 @@ public class SyncFragment extends Fragment {
|
|||
}
|
||||
|
||||
private void syncSongsPerGenre(List<Genre> genres) {
|
||||
Log.d(TAG, "syncSongsPerGenre");
|
||||
|
||||
for (Genre genre : genres) {
|
||||
SyncUtil.getSongsPerGenre(requireContext(), new MediaCallback() {
|
||||
@Override
|
||||
|
|
@ -210,29 +203,23 @@ public class SyncFragment extends Fragment {
|
|||
}, genre.id);
|
||||
}
|
||||
|
||||
Log.d(TAG, "syncSongsPerGenre: set progress");
|
||||
|
||||
animateProgressBar(true);
|
||||
PreferenceUtil.getInstance(requireContext()).setSongGenreSync(true);
|
||||
}
|
||||
|
||||
|
||||
private void animateProgressBar(boolean step) {
|
||||
Log.d(TAG, "animateProgressBar: PROGRESS " + step);
|
||||
syncViewModel.setProgress(step);
|
||||
bind.loadingProgressBar.setProgress(syncViewModel.getProgressBarInfo(), true);
|
||||
countProgress();
|
||||
}
|
||||
|
||||
private void countProgress() {
|
||||
Log.d(TAG, "countProgress = " + syncViewModel.getProgress());
|
||||
Log.d(TAG, "progressbar = " + syncViewModel.getProgressBarInfo());
|
||||
|
||||
if (syncViewModel.getProgress() == syncViewModel.getStep()) {
|
||||
if (syncViewModel.getProgressBarInfo() >= 100)
|
||||
terminate();
|
||||
else
|
||||
if (syncViewModel.getProgressBarInfo() < 100)
|
||||
Toast.makeText(requireContext(), "Sync error", Toast.LENGTH_SHORT).show();
|
||||
|
||||
terminate();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,54 @@
|
|||
package com.cappielloantonio.play.ui.fragment.bottomsheetdialog;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.cappielloantonio.play.R;
|
||||
import com.cappielloantonio.play.model.Album;
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
||||
|
||||
public class AlbumBottomSheetDialog extends BottomSheetDialogFragment implements View.OnClickListener {
|
||||
private static final String TAG = "AlbumBottomSheetDialog";
|
||||
|
||||
private Album album;
|
||||
|
||||
public AlbumBottomSheetDialog(Album album) {
|
||||
this.album = album;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.bottom_sheet_album_dialog, container, false);
|
||||
|
||||
init(view);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
private void init(View view) {
|
||||
Button button1 = view.findViewById(R.id.button1);
|
||||
Button button2 = view.findViewById(R.id.button2);
|
||||
|
||||
button1.setOnClickListener(v -> {
|
||||
Toast.makeText(requireContext(), album.getTitle(), Toast.LENGTH_SHORT).show();
|
||||
dismiss();
|
||||
});
|
||||
|
||||
button2.setOnClickListener(v -> {
|
||||
Toast.makeText(requireContext(), album.getArtistName(), Toast.LENGTH_SHORT).show();
|
||||
dismiss();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
dismiss();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,121 @@
|
|||
package com.cappielloantonio.play.ui.fragment.bottomsheetdialog;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import android.widget.ToggleButton;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.lifecycle.ViewModelProvider;
|
||||
|
||||
import com.cappielloantonio.play.R;
|
||||
import com.cappielloantonio.play.glide.CustomGlideRequest;
|
||||
import com.cappielloantonio.play.model.Song;
|
||||
import com.cappielloantonio.play.viewmodel.AlbumBottomSheetViewModel;
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
||||
|
||||
public class SongBottomSheetDialog extends BottomSheetDialogFragment implements View.OnClickListener {
|
||||
private static final String TAG = "AlbumBottomSheetDialog";
|
||||
|
||||
private AlbumBottomSheetViewModel albumBottomSheetViewModel;
|
||||
private Song song;
|
||||
|
||||
private ImageView coverSong;
|
||||
private TextView titleSong;
|
||||
private TextView artistSong;
|
||||
private ToggleButton thumbToggle;
|
||||
|
||||
private TextView playRadio;
|
||||
private TextView playNext;
|
||||
private TextView addToQueue;
|
||||
private TextView Download;
|
||||
private TextView addToPlaylist;
|
||||
private TextView goToArtist;
|
||||
|
||||
|
||||
public SongBottomSheetDialog(Song song) {
|
||||
this.song = song;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.bottom_sheet_song_dialog, container, false);
|
||||
albumBottomSheetViewModel = new ViewModelProvider(requireActivity()).get(AlbumBottomSheetViewModel.class);
|
||||
albumBottomSheetViewModel.setSong(song);
|
||||
|
||||
init(view);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
private void init(View view) {
|
||||
coverSong = view.findViewById(R.id.song_cover_image_view);
|
||||
CustomGlideRequest.Builder
|
||||
.from(requireContext(), albumBottomSheetViewModel.getSong().getPrimary(), albumBottomSheetViewModel.getSong().getBlurHash(), CustomGlideRequest.PRIMARY, CustomGlideRequest.TOP_QUALITY)
|
||||
.build()
|
||||
.into(coverSong);
|
||||
|
||||
titleSong = view.findViewById(R.id.song_title_text_view);
|
||||
titleSong.setText(albumBottomSheetViewModel.getSong().getTitle());
|
||||
|
||||
artistSong = view.findViewById(R.id.song_artist_text_view);
|
||||
artistSong.setText(albumBottomSheetViewModel.getSong().getArtistName());
|
||||
|
||||
thumbToggle = view.findViewById(R.id.button_favorite);
|
||||
thumbToggle.setChecked(albumBottomSheetViewModel.getSong().isFavorite());
|
||||
thumbToggle.setOnClickListener(v -> {
|
||||
albumBottomSheetViewModel.setFavorite();
|
||||
dismissBottomSheet();
|
||||
});
|
||||
|
||||
playRadio = view.findViewById(R.id.play_radio_text_view);
|
||||
playRadio.setOnClickListener(v -> {
|
||||
Toast.makeText(requireContext(), "Play radio", Toast.LENGTH_SHORT).show();
|
||||
dismissBottomSheet();
|
||||
});
|
||||
|
||||
playNext = view.findViewById(R.id.play_next_text_view);
|
||||
playNext.setOnClickListener(v -> {
|
||||
Toast.makeText(requireContext(), "Play next", Toast.LENGTH_SHORT).show();
|
||||
dismissBottomSheet();
|
||||
});
|
||||
|
||||
addToQueue = view.findViewById(R.id.add_to_queue_text_view);
|
||||
addToQueue.setOnClickListener(v -> {
|
||||
Toast.makeText(requireContext(), "Add to queue", Toast.LENGTH_SHORT).show();
|
||||
dismissBottomSheet();
|
||||
});
|
||||
|
||||
Download = view.findViewById(R.id.download_text_view);
|
||||
Download.setOnClickListener(v -> {
|
||||
Toast.makeText(requireContext(), "Download", Toast.LENGTH_SHORT).show();
|
||||
dismissBottomSheet();
|
||||
});
|
||||
|
||||
addToPlaylist = view.findViewById(R.id.add_to_playlist_text_view);
|
||||
addToPlaylist.setOnClickListener(v -> {
|
||||
Toast.makeText(requireContext(), "Add to playlist", Toast.LENGTH_SHORT).show();
|
||||
dismissBottomSheet();
|
||||
});
|
||||
|
||||
goToArtist = view.findViewById(R.id.go_to_artist_text_view);
|
||||
goToArtist.setOnClickListener(v -> {
|
||||
Toast.makeText(requireContext(), "Go to artist", Toast.LENGTH_SHORT).show();
|
||||
dismissBottomSheet();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
dismissBottomSheet();
|
||||
}
|
||||
|
||||
private void dismissBottomSheet() {
|
||||
dismiss();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
package com.cappielloantonio.play.viewmodel;
|
||||
|
||||
import android.app.Application;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.AndroidViewModel;
|
||||
|
||||
import com.cappielloantonio.play.model.Song;
|
||||
import com.cappielloantonio.play.repository.SongRepository;
|
||||
|
||||
public class AlbumBottomSheetViewModel extends AndroidViewModel {
|
||||
private SongRepository songRepository;
|
||||
private Song song;
|
||||
|
||||
public AlbumBottomSheetViewModel(@NonNull Application application) {
|
||||
super(application);
|
||||
|
||||
songRepository = new SongRepository(application);
|
||||
}
|
||||
|
||||
public void setSong(Song song) {
|
||||
this.song = song;
|
||||
}
|
||||
|
||||
public Song getSong() {
|
||||
return song;
|
||||
}
|
||||
|
||||
public void setFavorite() {
|
||||
if(song.isFavorite()) {
|
||||
song.setFavorite(false);
|
||||
}
|
||||
else {
|
||||
song.setFavorite(true);
|
||||
}
|
||||
|
||||
songRepository.setFavoriteStatus(song);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
package com.cappielloantonio.play.viewmodel;
|
||||
|
||||
import android.app.Application;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.AndroidViewModel;
|
||||
|
|
@ -20,6 +19,7 @@ public class HomeViewModel extends AndroidViewModel {
|
|||
private LiveData<List<Song>> recentlyPlayedSongSample;
|
||||
private LiveData<List<Song>> recentlyAddedSongSample;
|
||||
private LiveData<List<Song>> mostPlayedSongSample;
|
||||
private LiveData<List<Song>> favoritesSongSample;
|
||||
private List<Integer> years;
|
||||
|
||||
public HomeViewModel(@NonNull Application application) {
|
||||
|
|
@ -31,6 +31,7 @@ public class HomeViewModel extends AndroidViewModel {
|
|||
recentlyPlayedSongSample = songRepository.getListLiveRecentlyPlayedSampleSong(20);
|
||||
recentlyAddedSongSample = songRepository.getListLiveRecentlyAddedSampleSong(20);
|
||||
mostPlayedSongSample = songRepository.getListLiveMostPlayedSampleSong(20);
|
||||
favoritesSongSample = songRepository.getListLiveFavoritesSampleSong(20);
|
||||
years = songRepository.getYearList();
|
||||
}
|
||||
|
||||
|
|
@ -56,7 +57,10 @@ public class HomeViewModel extends AndroidViewModel {
|
|||
}
|
||||
|
||||
public List<Integer> getYearList() {
|
||||
Log.d(TAG, "getYearList: " + years.toString());
|
||||
return years;
|
||||
}
|
||||
|
||||
public LiveData<List<Song>> getFavorites() {
|
||||
return favoritesSongSample;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,6 +56,9 @@ public class SongListPageViewModel extends AndroidViewModel {
|
|||
case Song.BY_YEAR:
|
||||
songList = songRepository.getSongByYearListLive(year);
|
||||
break;
|
||||
case Song.IS_FAVORITE:
|
||||
songList = songRepository.getListLiveFavoritesSong();
|
||||
break;
|
||||
}
|
||||
|
||||
return songList;
|
||||
|
|
|
|||
5
app/src/main/res/drawable/button_favorite_selector.xml
Normal file
5
app/src/main/res/drawable/button_favorite_selector.xml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/ic_thumb_up" android:state_checked="true" android:color="@color/titleTextColor"/>
|
||||
<item android:drawable="@drawable/ic_thumb_up_outlined" android:state_checked="false" android:color="@color/titleTextColor" />
|
||||
</selector>
|
||||
9
app/src/main/res/drawable/ic_more.xml
Normal file
9
app/src/main/res/drawable/ic_more.xml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M12,8c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM12,10c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2zM12,16c-1.1,0 -2,0.9 -2,2s0.9,2 2,2 2,-0.9 2,-2 -0.9,-2 -2,-2z"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/ic_play.xml
Normal file
9
app/src/main/res/drawable/ic_play.xml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M8,6.82v10.36c0,0.79 0.87,1.27 1.54,0.84l8.14,-5.18c0.62,-0.39 0.62,-1.29 0,-1.69L9.54,5.98C8.87,5.55 8,6.03 8,6.82z"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/ic_shuffle.xml
Normal file
9
app/src/main/res/drawable/ic_shuffle.xml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M10.59,9.17L6.12,4.7c-0.39,-0.39 -1.02,-0.39 -1.41,0 -0.39,0.39 -0.39,1.02 0,1.41l4.46,4.46 1.42,-1.4zM15.35,4.85l1.19,1.19L4.7,17.88c-0.39,0.39 -0.39,1.02 0,1.41 0.39,0.39 1.02,0.39 1.41,0L17.96,7.46l1.19,1.19c0.31,0.31 0.85,0.09 0.85,-0.36L20,4.5c0,-0.28 -0.22,-0.5 -0.5,-0.5h-3.79c-0.45,0 -0.67,0.54 -0.36,0.85zM14.83,13.41l-1.41,1.41 3.13,3.13 -1.2,1.2c-0.31,0.31 -0.09,0.85 0.36,0.85h3.79c0.28,0 0.5,-0.22 0.5,-0.5v-3.79c0,-0.45 -0.54,-0.67 -0.85,-0.35l-1.19,1.19 -3.13,-3.14z"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/ic_thumb_up.xml
Normal file
9
app/src/main/res/drawable/ic_thumb_up.xml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M1,21h4L5,9L1,9v12zM23,10c0,-1.1 -0.9,-2 -2,-2h-6.31l0.95,-4.57 0.03,-0.32c0,-0.41 -0.17,-0.79 -0.44,-1.06L14.17,1 7.59,7.59C7.22,7.95 7,8.45 7,9v10c0,1.1 0.9,2 2,2h9c0.83,0 1.54,-0.5 1.84,-1.22l3.02,-7.05c0.09,-0.23 0.14,-0.47 0.14,-0.73v-2z"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/ic_thumb_up_outlined.xml
Normal file
9
app/src/main/res/drawable/ic_thumb_up_outlined.xml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M9,21h9c0.83,0 1.54,-0.5 1.84,-1.22l3.02,-7.05c0.09,-0.23 0.14,-0.47 0.14,-0.73v-2c0,-1.1 -0.9,-2 -2,-2h-6.31l0.95,-4.57 0.03,-0.32c0,-0.41 -0.17,-0.79 -0.44,-1.06L14.17,1 7.58,7.59C7.22,7.95 7,8.45 7,9v10c0,1.1 0.9,2 2,2zM9,9l4.34,-4.34L12,10h9v2l-3,7H9V9zM1,9h4v12H1z"/>
|
||||
</vector>
|
||||
|
|
@ -28,5 +28,23 @@
|
|||
app:labelVisibilityMode="unlabeled"
|
||||
app:layout_behavior="@string/hide_bottom_view_on_scroll_behavior"
|
||||
app:layout_scrollFlags="scroll|enterAlways|snap"
|
||||
app:menu="@menu/bottom_nav_menu" />
|
||||
app:menu="@menu/bottom_nav_menu">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/offline_mode_linear_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@color/colorAccent"
|
||||
android:layout_gravity="bottom"
|
||||
android:gravity="center"
|
||||
android:visibility="gone">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="6dp"
|
||||
android:text="Offline mode"/>
|
||||
</LinearLayout>
|
||||
</com.google.android.material.bottomnavigation.BottomNavigationView>
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
23
app/src/main/res/layout/bottom_sheet_album_dialog.xml
Normal file
23
app/src/main/res/layout/bottom_sheet_album_dialog.xml
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="This is a BottomSheet"
|
||||
android:textSize="25sp" />
|
||||
<Button
|
||||
android:id="@+id/button1"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="button 1" />
|
||||
<Button
|
||||
android:id="@+id/button2"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="button 2" />
|
||||
</LinearLayout>
|
||||
191
app/src/main/res/layout/bottom_sheet_song_dialog.xml
Normal file
191
app/src/main/res/layout/bottom_sheet_song_dialog.xml
Normal file
|
|
@ -0,0 +1,191 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:card_view="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:background="@color/cardColor">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp">
|
||||
|
||||
<!-- Header -->
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/imageView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="2dp"
|
||||
android:backgroundTint="@color/cardColor"
|
||||
android:paddingTop="16dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:tint="@color/subtitleTextColor"
|
||||
card_view:cardCornerRadius="4dp"
|
||||
card_view:cardElevation="0dp"
|
||||
card_view:cardPreventCornerOverlap="false"
|
||||
card_view:cardUseCompatPadding="false">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/song_cover_image_view"
|
||||
android:layout_width="54dp"
|
||||
android:layout_height="54dp" />
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/button_favorite"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:background="@drawable/button_favorite_selector"
|
||||
android:checked="false"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingTop="4dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:text=""
|
||||
android:textOff=""
|
||||
android:textOn=""
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/song_title_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:fontFamily="@font/open_sans_font_family"
|
||||
android:maxLines="1"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingStart="12dp"
|
||||
android:paddingEnd="12dp"
|
||||
android:text="@string/label_placeholder"
|
||||
android:textColor="@color/titleTextColor"
|
||||
android:textSize="18sp"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintStart_toEndOf="@+id/imageView"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/song_artist_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/open_sans_font_family"
|
||||
android:paddingStart="12dp"
|
||||
android:text="@string/label_placeholder"
|
||||
android:textColor="@color/subtitleTextColor"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintStart_toEndOf="@+id/imageView"
|
||||
app:layout_constraintTop_toBottomOf="@+id/song_title_text_view" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/option_linear_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="12dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/play_radio_text_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Avvia radio"
|
||||
android:fontFamily="@font/open_sans_font_family"
|
||||
android:textFontWeight="700"
|
||||
android:textSize="15dp"
|
||||
android:textColor="@color/titleTextColor"
|
||||
android:paddingTop="14dp"
|
||||
android:paddingBottom="14dp"
|
||||
android:paddingStart="20dp"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:clickable="true"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/play_next_text_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="14dp"
|
||||
android:paddingBottom="14dp"
|
||||
android:text="Riproduci dopo"
|
||||
android:paddingStart="20dp"
|
||||
android:fontFamily="@font/open_sans_font_family"
|
||||
android:textFontWeight="700"
|
||||
android:textSize="15dp"
|
||||
android:textColor="@color/titleTextColor"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:clickable="true" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/add_to_queue_text_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="14dp"
|
||||
android:paddingBottom="14dp"
|
||||
android:text="Aggiungi alla coda"
|
||||
android:paddingStart="20dp"
|
||||
android:fontFamily="@font/open_sans_font_family"
|
||||
android:textFontWeight="700"
|
||||
android:textSize="15dp"
|
||||
android:textColor="@color/titleTextColor"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:clickable="true"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/download_text_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="14dp"
|
||||
android:paddingBottom="14dp"
|
||||
android:text="Scarica"
|
||||
android:paddingStart="20dp"
|
||||
android:fontFamily="@font/open_sans_font_family"
|
||||
android:textFontWeight="700"
|
||||
android:textSize="15dp"
|
||||
android:textColor="@color/titleTextColor"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/add_to_playlist_text_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="14dp"
|
||||
android:paddingBottom="14dp"
|
||||
android:text="Aggiungi alla playlist"
|
||||
android:paddingStart="20dp"
|
||||
android:fontFamily="@font/open_sans_font_family"
|
||||
android:textFontWeight="700"
|
||||
android:textSize="15dp"
|
||||
android:textColor="@color/titleTextColor"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:clickable="true"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/go_to_artist_text_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="14dp"
|
||||
android:paddingBottom="14dp"
|
||||
android:text="Vai all'artista"
|
||||
android:paddingStart="20dp"
|
||||
android:fontFamily="@font/open_sans_font_family"
|
||||
android:textFontWeight="700"
|
||||
android:textSize="15dp"
|
||||
android:textColor="@color/titleTextColor"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:clickable="true"/>
|
||||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.core.widget.NestedScrollView
|
||||
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="wrap_content">
|
||||
|
|
@ -21,7 +22,8 @@
|
|||
app:layout_constraintDimensionRatio="W, 4:5"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:cardCornerRadius="0dp">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
|
|
@ -47,7 +49,6 @@
|
|||
android:id="@+id/album_title_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="60dp"
|
||||
android:elevation="4dp"
|
||||
android:fontFamily="@font/open_sans_font_family"
|
||||
android:paddingStart="20dp"
|
||||
|
|
@ -62,27 +63,41 @@
|
|||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="86dp"
|
||||
android:background="@drawable/gradient_backdrop_fading_down_background_image"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/card_view" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<!-- Label and button -->
|
||||
<TextView
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="-54dp"
|
||||
android:fontFamily="@font/open_sans_font_family"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:text="Song"
|
||||
android:textColor="@color/titleTextColor"
|
||||
android:textSize="22sp"
|
||||
android:textStyle="bold" />
|
||||
android:layout_marginTop="12dp"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingEnd="8dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:fontFamily="@font/open_sans_font_family"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:text="Songs"
|
||||
android:textColor="@color/titleTextColor"
|
||||
android:textSize="22sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/album_settings_image_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:layout_marginTop="-6dp"
|
||||
android:backgroundTint="@android:color/transparent"
|
||||
android:tint="@color/titleTextColor"
|
||||
android:src="@drawable/ic_more" />
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/song_recycler_view"
|
||||
|
|
@ -91,9 +106,7 @@
|
|||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:clipToPadding="false"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:paddingBottom="54dp" />
|
||||
android:paddingBottom="8dp" />
|
||||
</LinearLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
|
|
|||
|
|
@ -21,7 +21,8 @@
|
|||
app:layout_constraintDimensionRatio="W, 4:5"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:cardCornerRadius="0dp">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
|
|
@ -47,7 +48,6 @@
|
|||
android:id="@+id/artist_name_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="60dp"
|
||||
android:elevation="4dp"
|
||||
android:fontFamily="@font/open_sans_font_family"
|
||||
android:paddingStart="20dp"
|
||||
|
|
@ -61,21 +61,13 @@
|
|||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="86dp"
|
||||
android:background="@drawable/gradient_backdrop_fading_down_background_image"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/card_view" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<!-- Label and button -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="-58dp"
|
||||
android:layout_marginTop="12dp"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingEnd="8dp">
|
||||
|
|
@ -113,9 +105,7 @@
|
|||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:clipToPadding="false"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:paddingBottom="8dp" />
|
||||
|
||||
<TextView
|
||||
|
|
@ -140,6 +130,6 @@
|
|||
android:paddingStart="16dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:paddingBottom="54dp" />
|
||||
android:paddingBottom="8dp" />
|
||||
</LinearLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
|
|
|||
|
|
@ -1,257 +1,305 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/pull_to_refresh_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/hide_bottom_view_on_scroll_behavior"
|
||||
android:paddingTop="20dp">
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="8dp">
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/hide_bottom_view_on_scroll_behavior"
|
||||
android:paddingTop="20dp">
|
||||
|
||||
<!-- Discover music -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="8dp">
|
||||
|
||||
<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="Music discovery"
|
||||
android:textColor="@color/titleTextColor"
|
||||
android:textSize="22sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<!-- slideview -->
|
||||
<androidx.viewpager2.widget.ViewPager2
|
||||
android:id="@+id/discover_song_view_pager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="188dp"
|
||||
android:clipToPadding="false"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Recently added tracks -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<!-- Label and button -->
|
||||
<!-- Discover music -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingEnd="8dp">
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:fontFamily="@font/open_sans_font_family"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:text="Recently added"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingTop="20dp"
|
||||
android:paddingEnd="16dp"
|
||||
android:text="Music discovery"
|
||||
android:textColor="@color/titleTextColor"
|
||||
android:textSize="22sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/recently_added_tracks_text_view_clickable"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/open_sans_font_family"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:text="See all"
|
||||
android:textColor="@color/subtitleTextColor"
|
||||
android:textSize="14sp" />
|
||||
|
||||
<!-- slideview -->
|
||||
<androidx.viewpager2.widget.ViewPager2
|
||||
android:id="@+id/discover_song_view_pager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="188dp"
|
||||
android:clipToPadding="false"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recently_added_tracks_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 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"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<!-- Label and button -->
|
||||
<!-- Recently added tracks -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingEnd="8dp">
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
<!-- Label and button -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:fontFamily="@font/open_sans_font_family"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingEnd="8dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:fontFamily="@font/open_sans_font_family"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:text="Recently added"
|
||||
android:textColor="@color/titleTextColor"
|
||||
android:textSize="22sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/recently_added_tracks_text_view_clickable"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/open_sans_font_family"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:text="See all"
|
||||
android:textColor="@color/subtitleTextColor"
|
||||
android:textSize="14sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recently_added_tracks_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:text="Last played"
|
||||
android:paddingBottom="8dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- Fashback -->
|
||||
<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" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/recently_played_tracks_text_view_clickable"
|
||||
android:layout_width="wrap_content"
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/years_recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/open_sans_font_family"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingTop="12dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:clipToPadding="false"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:text="See all"
|
||||
android:textColor="@color/subtitleTextColor"
|
||||
android:textSize="14sp" />
|
||||
|
||||
android:paddingBottom="8dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recently_played_tracks_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>
|
||||
|
||||
<!-- Most played tracks -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<!-- Label and button -->
|
||||
<!-- Favorites -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingEnd="8dp">
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
<!-- Label and button -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:fontFamily="@font/open_sans_font_family"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:text="Most played"
|
||||
android:textColor="@color/titleTextColor"
|
||||
android:textSize="22sp"
|
||||
android:textStyle="bold" />
|
||||
android:paddingTop="8dp"
|
||||
android:paddingEnd="8dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:fontFamily="@font/open_sans_font_family"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:text="Favorites"
|
||||
android:textColor="@color/titleTextColor"
|
||||
android:textSize="22sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/most_played_tracks_text_view_clickable"
|
||||
android:layout_width="wrap_content"
|
||||
<TextView
|
||||
android:id="@+id/favorites_tracks_text_view_clickable"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/open_sans_font_family"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:text="See all"
|
||||
android:textColor="@color/subtitleTextColor"
|
||||
android:textSize="14sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/favorites_tracks_recycler_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/open_sans_font_family"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:text="See all"
|
||||
android:textColor="@color/subtitleTextColor"
|
||||
android:textSize="14sp" />
|
||||
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:clipToPadding="false"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/most_played_tracks_recycler_view"
|
||||
<!-- Most played tracks -->
|
||||
<LinearLayout
|
||||
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" />
|
||||
android:orientation="vertical">
|
||||
|
||||
<Button
|
||||
android:id="@+id/resync_button"
|
||||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
||||
<!-- Label and button -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingEnd="8dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:fontFamily="@font/open_sans_font_family"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:text="Most played"
|
||||
android:textColor="@color/titleTextColor"
|
||||
android:textSize="22sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/most_played_tracks_text_view_clickable"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/open_sans_font_family"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:text="See all"
|
||||
android:textColor="@color/subtitleTextColor"
|
||||
android:textSize="14sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/most_played_tracks_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"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:text="Resync"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/normalTextColor"
|
||||
app:cornerRadius="24dp" />
|
||||
android:orientation="vertical">
|
||||
|
||||
<!-- Label and button -->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingEnd="8dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:fontFamily="@font/open_sans_font_family"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:text="Last played"
|
||||
android:textColor="@color/titleTextColor"
|
||||
android:textSize="22sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/recently_played_tracks_text_view_clickable"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:fontFamily="@font/open_sans_font_family"
|
||||
android:paddingStart="8dp"
|
||||
android:paddingTop="12dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:text="See all"
|
||||
android:textColor="@color/subtitleTextColor"
|
||||
android:textSize="14sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/recently_played_tracks_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="24dp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
|
||||
|
|
|
|||
|
|
@ -197,19 +197,6 @@
|
|||
android:paddingTop="8dp"
|
||||
android:paddingEnd="8dp"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/sync_genre_button"
|
||||
style="@style/Widget.MaterialComponents.Button.OutlinedButton"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:paddingBottom="12dp"
|
||||
android:text="Sync Genres"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/normalTextColor"
|
||||
app:cornerRadius="24dp" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
|||
|
|
@ -141,9 +141,7 @@
|
|||
android:layout_marginTop="4dp"
|
||||
android:clipToPadding="false"
|
||||
android:overScrollMode="never"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:paddingBottom="24dp" />
|
||||
|
||||
<TextView
|
||||
|
|
|
|||
|
|
@ -31,9 +31,7 @@
|
|||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:clipToPadding="false"
|
||||
android:paddingStart="16dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingEnd="8dp"
|
||||
android:paddingBottom="8dp" />
|
||||
</LinearLayout>
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:fontFamily="@font/open_sans_font_family"
|
||||
android:maxWidth="172dp"
|
||||
android:maxWidth="256dp"
|
||||
android:maxLines="2"
|
||||
android:paddingStart="2dp"
|
||||
android:paddingTop="8dp"
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
<ImageView
|
||||
android:id="@+id/track_cover_image_view"
|
||||
android:layout_width="172dp"
|
||||
android:layout_height="172dp" />
|
||||
android:layout_height="172dp"/>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<TextView
|
||||
|
|
|
|||
|
|
@ -4,9 +4,11 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="2dp"
|
||||
android:paddingEnd="4dp"
|
||||
android:paddingBottom="2dp">
|
||||
android:paddingStart="16dp"
|
||||
android:paddingTop="3dp"
|
||||
android:paddingEnd="12dp"
|
||||
android:paddingBottom="3dp"
|
||||
android:background="?attr/selectableItemBackground">
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/imageView"
|
||||
|
|
@ -26,8 +28,8 @@
|
|||
|
||||
<ImageView
|
||||
android:id="@+id/song_cover_image_view"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="48dp" />
|
||||
android:layout_width="52dp"
|
||||
android:layout_height="52dp" />
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<LinearLayout
|
||||
|
|
@ -45,7 +47,7 @@
|
|||
android:fontFamily="@font/open_sans_font_family"
|
||||
android:maxLines="1"
|
||||
android:paddingStart="12dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingTop="10dp"
|
||||
android:paddingEnd="12dp"
|
||||
android:text="@string/label_placeholder"
|
||||
android:textColor="@color/titleTextColor"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue