diff --git a/app/src/main/java/com/cappielloantonio/tempo/ui/fragment/ArtistPageFragment.java b/app/src/main/java/com/cappielloantonio/tempo/ui/fragment/ArtistPageFragment.java
index 88faa0e4..23c034fd 100644
--- a/app/src/main/java/com/cappielloantonio/tempo/ui/fragment/ArtistPageFragment.java
+++ b/app/src/main/java/com/cappielloantonio/tempo/ui/fragment/ArtistPageFragment.java
@@ -118,8 +118,6 @@ public class ArtistPageFragment extends Fragment implements ClickCallback {
private void initArtistInfo() {
artistPageViewModel.getArtistInfo(artistPageViewModel.getArtist().getId()).observe(getViewLifecycleOwner(), artistInfo -> {
if (artistInfo == null) {
- if (bind != null)
- bind.artistPageBioPlaceholder.placeholder.setVisibility(View.VISIBLE);
if (bind != null) bind.artistPageBioSector.setVisibility(View.GONE);
} else {
String normalizedBio = MusicUtil.forceReadableString(artistInfo.getBiography());
@@ -142,8 +140,6 @@ public class ArtistPageFragment extends Fragment implements ClickCallback {
startActivity(intent);
});
- if (bind != null)
- bind.artistPageBioPlaceholder.placeholder.setVisibility(View.GONE);
if (bind != null) bind.artistPageBioSector.setVisibility(View.VISIBLE);
}
});
@@ -152,7 +148,7 @@ public class ArtistPageFragment extends Fragment implements ClickCallback {
private void initPlayButtons() {
bind.artistPageShuffleButton.setOnClickListener(v -> {
artistPageViewModel.getArtistShuffleList().observe(getViewLifecycleOwner(), songs -> {
- if (songs.size() > 0) {
+ if (!songs.isEmpty()) {
MediaManager.startQueue(mediaBrowserListenableFuture, songs, 0);
activity.setBottomSheetInPeek(true);
} else {
@@ -163,7 +159,7 @@ public class ArtistPageFragment extends Fragment implements ClickCallback {
bind.artistPageRadioButton.setOnClickListener(v -> {
artistPageViewModel.getArtistInstantMix().observe(getViewLifecycleOwner(), songs -> {
- if (songs.size() > 0) {
+ if (!songs.isEmpty()) {
MediaManager.startQueue(mediaBrowserListenableFuture, songs, 0);
activity.setBottomSheetInPeek(true);
} else {
@@ -180,12 +176,8 @@ public class ArtistPageFragment extends Fragment implements ClickCallback {
bind.mostStreamedSongRecyclerView.setAdapter(songHorizontalAdapter);
artistPageViewModel.getArtistTopSongList().observe(getViewLifecycleOwner(), songs -> {
if (songs == null) {
- if (bind != null)
- bind.artistPageTopTracksPlaceholder.placeholder.setVisibility(View.VISIBLE);
if (bind != null) bind.artistPageTopSongsSector.setVisibility(View.GONE);
} else {
- if (bind != null)
- bind.artistPageTopTracksPlaceholder.placeholder.setVisibility(View.GONE);
if (bind != null)
bind.artistPageTopSongsSector.setVisibility(!songs.isEmpty() ? View.VISIBLE : View.GONE);
if (bind != null)
@@ -205,12 +197,8 @@ public class ArtistPageFragment extends Fragment implements ClickCallback {
artistPageViewModel.getAlbumList().observe(getViewLifecycleOwner(), albums -> {
if (albums == null) {
- if (bind != null)
- bind.artistPageAlbumPlaceholder.placeholder.setVisibility(View.VISIBLE);
if (bind != null) bind.artistPageAlbumsSector.setVisibility(View.GONE);
} else {
- if (bind != null)
- bind.artistPageAlbumPlaceholder.placeholder.setVisibility(View.GONE);
if (bind != null)
bind.artistPageAlbumsSector.setVisibility(!albums.isEmpty() ? View.VISIBLE : View.GONE);
albumCatalogueAdapter.setItems(albums);
@@ -228,12 +216,8 @@ public class ArtistPageFragment extends Fragment implements ClickCallback {
artistPageViewModel.getArtistInfo(artistPageViewModel.getArtist().getId()).observe(getViewLifecycleOwner(), artist -> {
if (artist == null) {
- if (bind != null)
- bind.artistPageSimilarArtistPlaceholder.placeholder.setVisibility(View.VISIBLE);
if (bind != null) bind.similarArtistSector.setVisibility(View.GONE);
} else {
- if (bind != null)
- bind.artistPageSimilarArtistPlaceholder.placeholder.setVisibility(View.GONE);
if (bind != null && artist.getSimilarArtists() != null)
bind.similarArtistSector.setVisibility(!artist.getSimilarArtists().isEmpty() ? View.VISIBLE : View.GONE);
diff --git a/app/src/main/java/com/cappielloantonio/tempo/ui/fragment/DownloadFragment.java b/app/src/main/java/com/cappielloantonio/tempo/ui/fragment/DownloadFragment.java
index 2d2cef4e..b8108fe3 100644
--- a/app/src/main/java/com/cappielloantonio/tempo/ui/fragment/DownloadFragment.java
+++ b/app/src/main/java/com/cappielloantonio/tempo/ui/fragment/DownloadFragment.java
@@ -111,20 +111,14 @@ public class DownloadFragment extends Fragment implements ClickCallback {
if (bind != null) {
bind.emptyDownloadLayout.setVisibility(View.VISIBLE);
bind.fragmentDownloadNestedScrollView.setVisibility(View.GONE);
-
- bind.downloadDownloadedPlaceholder.placeholder.setVisibility(View.VISIBLE);
bind.downloadDownloadedSector.setVisibility(View.GONE);
-
bind.downloadedGroupByImageView.setVisibility(View.GONE);
}
} else {
if (bind != null) {
bind.emptyDownloadLayout.setVisibility(View.GONE);
bind.fragmentDownloadNestedScrollView.setVisibility(View.VISIBLE);
-
- bind.downloadDownloadedPlaceholder.placeholder.setVisibility(View.GONE);
bind.downloadDownloadedSector.setVisibility(View.VISIBLE);
-
bind.downloadedGroupByImageView.setVisibility(View.VISIBLE);
finishDownloadView(songs);
diff --git a/app/src/main/java/com/cappielloantonio/tempo/ui/fragment/HomeTabMusicFragment.java b/app/src/main/java/com/cappielloantonio/tempo/ui/fragment/HomeTabMusicFragment.java
index 424da187..a4cd411f 100644
--- a/app/src/main/java/com/cappielloantonio/tempo/ui/fragment/HomeTabMusicFragment.java
+++ b/app/src/main/java/com/cappielloantonio/tempo/ui/fragment/HomeTabMusicFragment.java
@@ -49,7 +49,6 @@ import com.cappielloantonio.tempo.ui.adapter.ShareHorizontalAdapter;
import com.cappielloantonio.tempo.ui.adapter.SimilarTrackAdapter;
import com.cappielloantonio.tempo.ui.adapter.SongHorizontalAdapter;
import com.cappielloantonio.tempo.ui.adapter.YearAdapter;
-import com.cappielloantonio.tempo.ui.dialog.BatteryOptimizationDialog;
import com.cappielloantonio.tempo.ui.dialog.HomeRearrangementDialog;
import com.cappielloantonio.tempo.util.Constants;
import com.cappielloantonio.tempo.util.DownloadUtil;
@@ -59,9 +58,7 @@ import com.cappielloantonio.tempo.util.Preferences;
import com.cappielloantonio.tempo.util.UIUtil;
import com.cappielloantonio.tempo.viewmodel.HomeViewModel;
import com.google.android.material.snackbar.Snackbar;
-import com.google.common.reflect.TypeToken;
import com.google.common.util.concurrent.ListenableFuture;
-import com.google.gson.Gson;
import java.util.ArrayList;
import java.util.List;
@@ -164,7 +161,7 @@ public class HomeTabMusicFragment extends Fragment implements ClickCallback {
homeViewModel.getRandomShuffleSample().observe(getViewLifecycleOwner(), songs -> {
MusicUtil.ratingFilter(songs);
- if (songs.size() > 0) {
+ if (!songs.isEmpty()) {
MediaManager.startQueue(mediaBrowserListenableFuture, songs, 0);
activity.setBottomSheetInPeek(true);
}
@@ -311,7 +308,7 @@ public class HomeTabMusicFragment extends Fragment implements ClickCallback {
}
private void initDiscoverSongSlideView() {
- if (!homeViewModel.checkHomeSectorVisibility(Constants.HOME_SECTOR_DISCOVERY)) return;
+ if (homeViewModel.checkHomeSectorVisibility(Constants.HOME_SECTOR_DISCOVERY)) return;
bind.discoverSongViewPager.setOrientation(ViewPager2.ORIENTATION_HORIZONTAL);
@@ -322,12 +319,8 @@ public class HomeTabMusicFragment extends Fragment implements ClickCallback {
MusicUtil.ratingFilter(songs);
if (songs == null) {
- if (bind != null)
- bind.homeDiscoveryPlaceholder.placeholder.setVisibility(View.VISIBLE);
if (bind != null) bind.homeDiscoverSector.setVisibility(View.GONE);
} else {
- if (bind != null)
- bind.homeDiscoveryPlaceholder.placeholder.setVisibility(View.GONE);
if (bind != null)
bind.homeDiscoverSector.setVisibility(!songs.isEmpty() ? View.VISIBLE : View.GONE);
@@ -339,7 +332,7 @@ public class HomeTabMusicFragment extends Fragment implements ClickCallback {
}
private void initSimilarSongView() {
- if (!homeViewModel.checkHomeSectorVisibility(Constants.HOME_SECTOR_MADE_FOR_YOU)) return;
+ if (homeViewModel.checkHomeSectorVisibility(Constants.HOME_SECTOR_MADE_FOR_YOU)) return;
bind.similarTracksRecyclerView.setLayoutManager(new LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false));
bind.similarTracksRecyclerView.setHasFixedSize(true);
@@ -350,12 +343,8 @@ public class HomeTabMusicFragment extends Fragment implements ClickCallback {
MusicUtil.ratingFilter(songs);
if (songs == null) {
- if (bind != null)
- bind.homeSimilarTracksPlaceholder.placeholder.setVisibility(View.VISIBLE);
if (bind != null) bind.homeSimilarTracksSector.setVisibility(View.GONE);
} else {
- if (bind != null)
- bind.homeSimilarTracksPlaceholder.placeholder.setVisibility(View.GONE);
if (bind != null)
bind.homeSimilarTracksSector.setVisibility(!songs.isEmpty() ? View.VISIBLE : View.GONE);
@@ -368,7 +357,7 @@ public class HomeTabMusicFragment extends Fragment implements ClickCallback {
}
private void initArtistBestOf() {
- if (!homeViewModel.checkHomeSectorVisibility(Constants.HOME_SECTOR_BEST_OF)) return;
+ if (homeViewModel.checkHomeSectorVisibility(Constants.HOME_SECTOR_BEST_OF)) return;
bind.bestOfArtistRecyclerView.setLayoutManager(new LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false));
bind.bestOfArtistRecyclerView.setHasFixedSize(true);
@@ -377,12 +366,8 @@ public class HomeTabMusicFragment extends Fragment implements ClickCallback {
bind.bestOfArtistRecyclerView.setAdapter(bestOfArtistAdapter);
homeViewModel.getBestOfArtists(getViewLifecycleOwner()).observe(getViewLifecycleOwner(), artists -> {
if (artists == null) {
- if (bind != null)
- bind.homeBestOfArtistPlaceholder.placeholder.setVisibility(View.VISIBLE);
if (bind != null) bind.homeBestOfArtistSector.setVisibility(View.GONE);
} else {
- if (bind != null)
- bind.homeBestOfArtistPlaceholder.placeholder.setVisibility(View.GONE);
if (bind != null)
bind.homeBestOfArtistSector.setVisibility(!artists.isEmpty() ? View.VISIBLE : View.GONE);
@@ -395,7 +380,7 @@ public class HomeTabMusicFragment extends Fragment implements ClickCallback {
}
private void initArtistRadio() {
- if (!homeViewModel.checkHomeSectorVisibility(Constants.HOME_SECTOR_RADIO_STATION)) return;
+ if (homeViewModel.checkHomeSectorVisibility(Constants.HOME_SECTOR_RADIO_STATION)) return;
bind.radioArtistRecyclerView.setLayoutManager(new LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false));
bind.radioArtistRecyclerView.setHasFixedSize(true);
@@ -404,12 +389,8 @@ public class HomeTabMusicFragment extends Fragment implements ClickCallback {
bind.radioArtistRecyclerView.setAdapter(radioArtistAdapter);
homeViewModel.getStarredArtistsSample(getViewLifecycleOwner()).observe(getViewLifecycleOwner(), artists -> {
if (artists == null) {
- if (bind != null)
- bind.homeRadioArtistPlaceholder.placeholder.setVisibility(View.VISIBLE);
if (bind != null) bind.homeRadioArtistSector.setVisibility(View.GONE);
} else {
- if (bind != null)
- bind.homeRadioArtistPlaceholder.placeholder.setVisibility(View.GONE);
if (bind != null)
bind.homeRadioArtistSector.setVisibility(!artists.isEmpty() ? View.VISIBLE : View.GONE);
if (bind != null)
@@ -424,7 +405,7 @@ public class HomeTabMusicFragment extends Fragment implements ClickCallback {
}
private void initGridView() {
- if (!homeViewModel.checkHomeSectorVisibility(Constants.HOME_SECTOR_TOP_SONGS)) return;
+ if (homeViewModel.checkHomeSectorVisibility(Constants.HOME_SECTOR_TOP_SONGS)) return;
bind.gridTracksRecyclerView.setLayoutManager(new GridLayoutManager(requireContext(), 3));
bind.gridTracksRecyclerView.addItemDecoration(new GridItemDecoration(3, 8, false));
@@ -436,7 +417,7 @@ public class HomeTabMusicFragment extends Fragment implements ClickCallback {
homeViewModel.getDiscoverSongSample(getViewLifecycleOwner()).observe(getViewLifecycleOwner(), music -> {
if (music != null) {
homeViewModel.getGridSongSample(getViewLifecycleOwner()).observe(getViewLifecycleOwner(), chronologies -> {
- if (chronologies == null || chronologies.size() == 0) {
+ if (chronologies == null || chronologies.isEmpty()) {
if (bind != null) bind.homeGridTracksSector.setVisibility(View.GONE);
if (bind != null) bind.afterGridDivider.setVisibility(View.GONE);
} else {
@@ -450,7 +431,7 @@ public class HomeTabMusicFragment extends Fragment implements ClickCallback {
}
private void initStarredTracksView() {
- if (!homeViewModel.checkHomeSectorVisibility(Constants.HOME_SECTOR_STARRED_TRACKS)) return;
+ if (homeViewModel.checkHomeSectorVisibility(Constants.HOME_SECTOR_STARRED_TRACKS)) return;
bind.starredTracksRecyclerView.setHasFixedSize(true);
@@ -458,12 +439,8 @@ public class HomeTabMusicFragment extends Fragment implements ClickCallback {
bind.starredTracksRecyclerView.setAdapter(starredSongAdapter);
homeViewModel.getStarredTracks(getViewLifecycleOwner()).observe(getViewLifecycleOwner(), songs -> {
if (songs == null) {
- if (bind != null)
- bind.starredTracksPlaceholder.placeholder.setVisibility(View.VISIBLE);
if (bind != null) bind.starredTracksSector.setVisibility(View.GONE);
} else {
- if (bind != null)
- bind.starredTracksPlaceholder.placeholder.setVisibility(View.GONE);
if (bind != null)
bind.starredTracksSector.setVisibility(!songs.isEmpty() ? View.VISIBLE : View.GONE);
if (bind != null)
@@ -487,7 +464,7 @@ public class HomeTabMusicFragment extends Fragment implements ClickCallback {
}
private void initStarredAlbumsView() {
- if (!homeViewModel.checkHomeSectorVisibility(Constants.HOME_SECTOR_STARRED_ALBUMS)) return;
+ if (homeViewModel.checkHomeSectorVisibility(Constants.HOME_SECTOR_STARRED_ALBUMS)) return;
bind.starredAlbumsRecyclerView.setHasFixedSize(true);
@@ -495,12 +472,8 @@ public class HomeTabMusicFragment extends Fragment implements ClickCallback {
bind.starredAlbumsRecyclerView.setAdapter(starredAlbumAdapter);
homeViewModel.getStarredAlbums(getViewLifecycleOwner()).observe(getViewLifecycleOwner(), albums -> {
if (albums == null) {
- if (bind != null)
- bind.starredAlbumsPlaceholder.placeholder.setVisibility(View.VISIBLE);
if (bind != null) bind.starredAlbumsSector.setVisibility(View.GONE);
} else {
- if (bind != null)
- bind.starredAlbumsPlaceholder.placeholder.setVisibility(View.GONE);
if (bind != null)
bind.starredAlbumsSector.setVisibility(!albums.isEmpty() ? View.VISIBLE : View.GONE);
if (bind != null)
@@ -524,7 +497,7 @@ public class HomeTabMusicFragment extends Fragment implements ClickCallback {
}
private void initStarredArtistsView() {
- if (!homeViewModel.checkHomeSectorVisibility(Constants.HOME_SECTOR_STARRED_ARTISTS)) return;
+ if (homeViewModel.checkHomeSectorVisibility(Constants.HOME_SECTOR_STARRED_ARTISTS)) return;
bind.starredArtistsRecyclerView.setHasFixedSize(true);
@@ -532,12 +505,8 @@ public class HomeTabMusicFragment extends Fragment implements ClickCallback {
bind.starredArtistsRecyclerView.setAdapter(starredArtistAdapter);
homeViewModel.getStarredArtists(getViewLifecycleOwner()).observe(getViewLifecycleOwner(), artists -> {
if (artists == null) {
- if (bind != null)
- bind.starredArtistsPlaceholder.placeholder.setVisibility(View.VISIBLE);
if (bind != null) bind.starredArtistsSector.setVisibility(View.GONE);
} else {
- if (bind != null)
- bind.starredArtistsPlaceholder.placeholder.setVisibility(View.GONE);
if (bind != null)
bind.starredArtistsSector.setVisibility(!artists.isEmpty() ? View.VISIBLE : View.GONE);
if (bind != null)
@@ -563,7 +532,7 @@ public class HomeTabMusicFragment extends Fragment implements ClickCallback {
}
private void initNewReleasesView() {
- if (!homeViewModel.checkHomeSectorVisibility(Constants.HOME_SECTOR_NEW_RELEASES)) return;
+ if (homeViewModel.checkHomeSectorVisibility(Constants.HOME_SECTOR_NEW_RELEASES)) return;
bind.newReleasesRecyclerView.setHasFixedSize(true);
@@ -571,12 +540,8 @@ public class HomeTabMusicFragment extends Fragment implements ClickCallback {
bind.newReleasesRecyclerView.setAdapter(newReleasesAlbumAdapter);
homeViewModel.getRecentlyReleasedAlbums(getViewLifecycleOwner()).observe(getViewLifecycleOwner(), albums -> {
if (albums == null) {
- if (bind != null)
- bind.homeNewReleasesPlaceholder.placeholder.setVisibility(View.VISIBLE);
if (bind != null) bind.homeNewReleasesSector.setVisibility(View.GONE);
} else {
- if (bind != null)
- bind.homeNewReleasesPlaceholder.placeholder.setVisibility(View.GONE);
if (bind != null)
bind.homeNewReleasesSector.setVisibility(!albums.isEmpty() ? View.VISIBLE : View.GONE);
if (bind != null)
@@ -600,7 +565,7 @@ public class HomeTabMusicFragment extends Fragment implements ClickCallback {
}
private void initYearSongView() {
- if (!homeViewModel.checkHomeSectorVisibility(Constants.HOME_SECTOR_FLASHBACK)) return;
+ if (homeViewModel.checkHomeSectorVisibility(Constants.HOME_SECTOR_FLASHBACK)) return;
bind.yearsRecyclerView.setLayoutManager(new LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false));
bind.yearsRecyclerView.setHasFixedSize(true);
@@ -609,12 +574,8 @@ public class HomeTabMusicFragment extends Fragment implements ClickCallback {
bind.yearsRecyclerView.setAdapter(yearAdapter);
homeViewModel.getYearList(getViewLifecycleOwner()).observe(getViewLifecycleOwner(), years -> {
if (years == null) {
- if (bind != null)
- bind.homeFlashbackPlaceholder.placeholder.setVisibility(View.VISIBLE);
if (bind != null) bind.homeFlashbackSector.setVisibility(View.GONE);
} else {
- if (bind != null)
- bind.homeFlashbackPlaceholder.placeholder.setVisibility(View.GONE);
if (bind != null)
bind.homeFlashbackSector.setVisibility(!years.isEmpty() ? View.VISIBLE : View.GONE);
@@ -627,7 +588,7 @@ public class HomeTabMusicFragment extends Fragment implements ClickCallback {
}
private void initMostPlayedAlbumView() {
- if (!homeViewModel.checkHomeSectorVisibility(Constants.HOME_SECTOR_MOST_PLAYED)) return;
+ if (homeViewModel.checkHomeSectorVisibility(Constants.HOME_SECTOR_MOST_PLAYED)) return;
bind.mostPlayedAlbumsRecyclerView.setLayoutManager(new LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false));
bind.mostPlayedAlbumsRecyclerView.setHasFixedSize(true);
@@ -636,15 +597,10 @@ public class HomeTabMusicFragment extends Fragment implements ClickCallback {
bind.mostPlayedAlbumsRecyclerView.setAdapter(mostPlayedAlbumAdapter);
homeViewModel.getMostPlayedAlbums(getViewLifecycleOwner()).observe(getViewLifecycleOwner(), albums -> {
if (albums == null) {
- if (bind != null)
- bind.homeMostPlayedAlbumsPlaceholder.placeholder.setVisibility(View.VISIBLE);
if (bind != null) bind.homeMostPlayedAlbumsSector.setVisibility(View.GONE);
} else {
- if (bind != null)
- bind.homeMostPlayedAlbumsPlaceholder.placeholder.setVisibility(View.GONE);
if (bind != null)
bind.homeMostPlayedAlbumsSector.setVisibility(!albums.isEmpty() ? View.VISIBLE : View.GONE);
- // if (albums.size() < 5) reorder();
mostPlayedAlbumAdapter.setItems(albums);
}
@@ -655,7 +611,7 @@ public class HomeTabMusicFragment extends Fragment implements ClickCallback {
}
private void initRecentPlayedAlbumView() {
- if (!homeViewModel.checkHomeSectorVisibility(Constants.HOME_SECTOR_LAST_PLAYED)) return;
+ if (homeViewModel.checkHomeSectorVisibility(Constants.HOME_SECTOR_LAST_PLAYED)) return;
bind.recentlyPlayedAlbumsRecyclerView.setLayoutManager(new LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false));
bind.recentlyPlayedAlbumsRecyclerView.setHasFixedSize(true);
@@ -664,12 +620,8 @@ public class HomeTabMusicFragment extends Fragment implements ClickCallback {
bind.recentlyPlayedAlbumsRecyclerView.setAdapter(recentlyPlayedAlbumAdapter);
homeViewModel.getRecentlyPlayedAlbumList(getViewLifecycleOwner()).observe(getViewLifecycleOwner(), albums -> {
if (albums == null) {
- if (bind != null)
- bind.homeRecentlyPlayedAlbumsPlaceholder.placeholder.setVisibility(View.VISIBLE);
if (bind != null) bind.homeRecentlyPlayedAlbumsSector.setVisibility(View.GONE);
} else {
- if (bind != null)
- bind.homeRecentlyPlayedAlbumsPlaceholder.placeholder.setVisibility(View.GONE);
if (bind != null)
bind.homeRecentlyPlayedAlbumsSector.setVisibility(!albums.isEmpty() ? View.VISIBLE : View.GONE);
@@ -682,7 +634,7 @@ public class HomeTabMusicFragment extends Fragment implements ClickCallback {
}
private void initRecentAddedAlbumView() {
- if (!homeViewModel.checkHomeSectorVisibility(Constants.HOME_SECTOR_RECENTLY_ADDED)) return;
+ if (homeViewModel.checkHomeSectorVisibility(Constants.HOME_SECTOR_RECENTLY_ADDED)) return;
bind.recentlyAddedAlbumsRecyclerView.setLayoutManager(new LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false));
bind.recentlyAddedAlbumsRecyclerView.setHasFixedSize(true);
@@ -691,12 +643,8 @@ public class HomeTabMusicFragment extends Fragment implements ClickCallback {
bind.recentlyAddedAlbumsRecyclerView.setAdapter(recentlyAddedAlbumAdapter);
homeViewModel.getMostRecentlyAddedAlbums(getViewLifecycleOwner()).observe(getViewLifecycleOwner(), albums -> {
if (albums == null) {
- if (bind != null)
- bind.homeRecentlyAddedAlbumsPlaceholder.placeholder.setVisibility(View.VISIBLE);
if (bind != null) bind.homeRecentlyAddedAlbumsSector.setVisibility(View.GONE);
} else {
- if (bind != null)
- bind.homeRecentlyAddedAlbumsPlaceholder.placeholder.setVisibility(View.GONE);
if (bind != null)
bind.homeRecentlyAddedAlbumsSector.setVisibility(!albums.isEmpty() ? View.VISIBLE : View.GONE);
@@ -709,7 +657,7 @@ public class HomeTabMusicFragment extends Fragment implements ClickCallback {
}
private void initSharesView() {
- if (!homeViewModel.checkHomeSectorVisibility(Constants.HOME_SECTOR_SHARED)) return;
+ if (homeViewModel.checkHomeSectorVisibility(Constants.HOME_SECTOR_SHARED)) return;
bind.sharesRecyclerView.setHasFixedSize(true);
@@ -718,11 +666,8 @@ public class HomeTabMusicFragment extends Fragment implements ClickCallback {
if (Preferences.isSharingEnabled()) {
homeViewModel.getShares(getViewLifecycleOwner()).observe(getViewLifecycleOwner(), shares -> {
if (shares == null) {
- if (bind != null)
- bind.sharesPlaceholder.placeholder.setVisibility(View.VISIBLE);
if (bind != null) bind.sharesSector.setVisibility(View.GONE);
} else {
- if (bind != null) bind.sharesPlaceholder.placeholder.setVisibility(View.GONE);
if (bind != null)
bind.sharesSector.setVisibility(!shares.isEmpty() ? View.VISIBLE : View.GONE);
if (bind != null)
@@ -747,6 +692,10 @@ public class HomeTabMusicFragment extends Fragment implements ClickCallback {
}
private void initHomeReorganizer() {
+ final Handler handler = new Handler();
+ final Runnable runnable = () -> { if (bind != null) bind.homeSectorRearrangementButton.setVisibility(View.VISIBLE); };
+ handler.postDelayed(runnable, 5000);
+
bind.homeSectorRearrangementButton.setOnClickListener(v -> {
HomeRearrangementDialog dialog = new HomeRearrangementDialog();
dialog.show(requireActivity().getSupportFragmentManager(), null);
@@ -791,54 +740,42 @@ public class HomeTabMusicFragment extends Fragment implements ClickCallback {
break;
case Constants.HOME_SECTOR_MADE_FOR_YOU:
bind.homeLinearLayoutContainer.addView(bind.homeSimilarTracksSector);
- bind.homeLinearLayoutContainer.addView(bind.homeSimilarTracksPlaceholder.getRoot());
break;
case Constants.HOME_SECTOR_BEST_OF:
bind.homeLinearLayoutContainer.addView(bind.homeBestOfArtistSector);
- bind.homeLinearLayoutContainer.addView(bind.homeBestOfArtistPlaceholder.getRoot());
break;
case Constants.HOME_SECTOR_RADIO_STATION:
bind.homeLinearLayoutContainer.addView(bind.homeRadioArtistSector);
- bind.homeLinearLayoutContainer.addView(bind.homeRadioArtistPlaceholder.getRoot());
break;
case Constants.HOME_SECTOR_TOP_SONGS:
bind.homeLinearLayoutContainer.addView(bind.homeGridTracksSector);
break;
case Constants.HOME_SECTOR_STARRED_TRACKS:
bind.homeLinearLayoutContainer.addView(bind.starredTracksSector);
- bind.homeLinearLayoutContainer.addView(bind.starredTracksPlaceholder.getRoot());
break;
case Constants.HOME_SECTOR_STARRED_ALBUMS:
bind.homeLinearLayoutContainer.addView(bind.starredAlbumsSector);
- bind.homeLinearLayoutContainer.addView(bind.starredAlbumsPlaceholder.getRoot());
break;
case Constants.HOME_SECTOR_STARRED_ARTISTS:
bind.homeLinearLayoutContainer.addView(bind.starredArtistsSector);
- bind.homeLinearLayoutContainer.addView(bind.starredArtistsPlaceholder.getRoot());
break;
case Constants.HOME_SECTOR_NEW_RELEASES:
bind.homeLinearLayoutContainer.addView(bind.homeNewReleasesSector);
- bind.homeLinearLayoutContainer.addView(bind.homeNewReleasesPlaceholder.getRoot());
break;
case Constants.HOME_SECTOR_FLASHBACK:
bind.homeLinearLayoutContainer.addView(bind.homeFlashbackSector);
- bind.homeLinearLayoutContainer.addView(bind.homeFlashbackPlaceholder.getRoot());
break;
case Constants.HOME_SECTOR_MOST_PLAYED:
bind.homeLinearLayoutContainer.addView(bind.homeMostPlayedAlbumsSector);
- bind.homeLinearLayoutContainer.addView(bind.homeMostPlayedAlbumsPlaceholder.getRoot());
break;
case Constants.HOME_SECTOR_LAST_PLAYED:
bind.homeLinearLayoutContainer.addView(bind.homeRecentlyPlayedAlbumsSector);
- bind.homeLinearLayoutContainer.addView(bind.homeRecentlyPlayedAlbumsPlaceholder.getRoot());
break;
case Constants.HOME_SECTOR_RECENTLY_ADDED:
bind.homeLinearLayoutContainer.addView(bind.homeRecentlyAddedAlbumsSector);
- bind.homeLinearLayoutContainer.addView(bind.homeRecentlyAddedAlbumsPlaceholder.getRoot());
break;
case Constants.HOME_SECTOR_SHARED:
bind.homeLinearLayoutContainer.addView(bind.sharesSector);
- bind.homeLinearLayoutContainer.addView(bind.sharesPlaceholder.getRoot());
break;
}
}
@@ -865,7 +802,7 @@ public class HomeTabMusicFragment extends Fragment implements ClickCallback {
homeViewModel.getMediaInstantMix(getViewLifecycleOwner(), bundle.getParcelable(Constants.TRACK_OBJECT)).observe(getViewLifecycleOwner(), songs -> {
MusicUtil.ratingFilter(songs);
- if (songs != null && songs.size() > 0) {
+ if (songs != null && !songs.isEmpty()) {
MediaManager.enqueue(mediaBrowserListenableFuture, songs, true);
}
});
@@ -906,7 +843,7 @@ public class HomeTabMusicFragment extends Fragment implements ClickCallback {
homeViewModel.getArtistInstantMix(getViewLifecycleOwner(), bundle.getParcelable(Constants.ARTIST_OBJECT)).observe(getViewLifecycleOwner(), songs -> {
MusicUtil.ratingFilter(songs);
- if (songs.size() > 0) {
+ if (!songs.isEmpty()) {
MediaManager.startQueue(mediaBrowserListenableFuture, songs, 0);
activity.setBottomSheetInPeek(true);
}
@@ -917,7 +854,7 @@ public class HomeTabMusicFragment extends Fragment implements ClickCallback {
homeViewModel.getArtistBestOf(getViewLifecycleOwner(), bundle.getParcelable(Constants.ARTIST_OBJECT)).observe(getViewLifecycleOwner(), songs -> {
MusicUtil.ratingFilter(songs);
- if (songs.size() > 0) {
+ if (!songs.isEmpty()) {
MediaManager.startQueue(mediaBrowserListenableFuture, songs, 0);
activity.setBottomSheetInPeek(true);
}
diff --git a/app/src/main/java/com/cappielloantonio/tempo/ui/fragment/LibraryFragment.java b/app/src/main/java/com/cappielloantonio/tempo/ui/fragment/LibraryFragment.java
index b395ab77..711b1c6e 100644
--- a/app/src/main/java/com/cappielloantonio/tempo/ui/fragment/LibraryFragment.java
+++ b/app/src/main/java/com/cappielloantonio/tempo/ui/fragment/LibraryFragment.java
@@ -142,12 +142,8 @@ public class LibraryFragment extends Fragment implements ClickCallback {
bind.musicFolderRecyclerView.setAdapter(musicFolderAdapter);
libraryViewModel.getMusicFolders(getViewLifecycleOwner()).observe(getViewLifecycleOwner(), musicFolders -> {
if (musicFolders == null) {
- if (bind != null)
- bind.libraryMusicFolderPlaceholder.placeholder.setVisibility(View.VISIBLE);
if (bind != null) bind.libraryMusicFolderSector.setVisibility(View.GONE);
} else {
- if (bind != null)
- bind.libraryMusicFolderPlaceholder.placeholder.setVisibility(View.GONE);
if (bind != null)
bind.libraryMusicFolderSector.setVisibility(!musicFolders.isEmpty() ? View.VISIBLE : View.GONE);
@@ -164,11 +160,8 @@ public class LibraryFragment extends Fragment implements ClickCallback {
bind.albumRecyclerView.setAdapter(albumAdapter);
libraryViewModel.getAlbumSample(getViewLifecycleOwner()).observe(getViewLifecycleOwner(), albums -> {
if (albums == null) {
- if (bind != null)
- bind.libraryAlbumPlaceholder.placeholder.setVisibility(View.VISIBLE);
if (bind != null) bind.libraryAlbumSector.setVisibility(View.GONE);
} else {
- if (bind != null) bind.libraryAlbumPlaceholder.placeholder.setVisibility(View.GONE);
if (bind != null)
bind.libraryAlbumSector.setVisibility(!albums.isEmpty() ? View.VISIBLE : View.GONE);
@@ -188,12 +181,8 @@ public class LibraryFragment extends Fragment implements ClickCallback {
bind.artistRecyclerView.setAdapter(artistAdapter);
libraryViewModel.getArtistSample(getViewLifecycleOwner()).observe(getViewLifecycleOwner(), artists -> {
if (artists == null) {
- if (bind != null)
- bind.libraryArtistPlaceholder.placeholder.setVisibility(View.VISIBLE);
if (bind != null) bind.libraryArtistSector.setVisibility(View.GONE);
} else {
- if (bind != null)
- bind.libraryArtistPlaceholder.placeholder.setVisibility(View.GONE);
if (bind != null)
bind.libraryArtistSector.setVisibility(!artists.isEmpty() ? View.VISIBLE : View.GONE);
@@ -214,11 +203,8 @@ public class LibraryFragment extends Fragment implements ClickCallback {
libraryViewModel.getGenreSample(getViewLifecycleOwner()).observe(getViewLifecycleOwner(), genres -> {
if (genres == null) {
- if (bind != null)
- bind.libraryGenrePlaceholder.placeholder.setVisibility(View.VISIBLE);
if (bind != null) bind.libraryGenresSector.setVisibility(View.GONE);
} else {
- if (bind != null) bind.libraryGenrePlaceholder.placeholder.setVisibility(View.GONE);
if (bind != null)
bind.libraryGenresSector.setVisibility(!genres.isEmpty() ? View.VISIBLE : View.GONE);
@@ -238,12 +224,8 @@ public class LibraryFragment extends Fragment implements ClickCallback {
bind.playlistRecyclerView.setAdapter(playlistHorizontalAdapter);
libraryViewModel.getPlaylistSample(getViewLifecycleOwner()).observe(getViewLifecycleOwner(), playlists -> {
if (playlists == null) {
- if (bind != null)
- bind.libraryPlaylistPlaceholder.placeholder.setVisibility(View.VISIBLE);
if (bind != null) bind.libraryPlaylistSector.setVisibility(View.GONE);
} else {
- if (bind != null)
- bind.libraryPlaylistPlaceholder.placeholder.setVisibility(View.GONE);
if (bind != null)
bind.libraryPlaylistSector.setVisibility(!playlists.isEmpty() ? View.VISIBLE : View.GONE);
diff --git a/app/src/main/java/com/cappielloantonio/tempo/viewmodel/HomeViewModel.java b/app/src/main/java/com/cappielloantonio/tempo/viewmodel/HomeViewModel.java
index 097dca66..a9408df8 100644
--- a/app/src/main/java/com/cappielloantonio/tempo/viewmodel/HomeViewModel.java
+++ b/app/src/main/java/com/cappielloantonio/tempo/viewmodel/HomeViewModel.java
@@ -289,7 +289,7 @@ public class HomeViewModel extends AndroidViewModel {
public boolean checkHomeSectorVisibility(String sectorId) {
return sectors != null && sectors.stream().filter(sector -> sector.getId().equals(sectorId))
.findAny()
- .orElse(null) != null;
+ .orElse(null) == null;
}
public void setOfflineFavorite() {
diff --git a/app/src/main/res/layout/fragment_artist_page.xml b/app/src/main/res/layout/fragment_artist_page.xml
index f4d3d819..37e6a484 100644
--- a/app/src/main/res/layout/fragment_artist_page.xml
+++ b/app/src/main/res/layout/fragment_artist_page.xml
@@ -1,6 +1,7 @@
@@ -110,7 +111,9 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
- android:paddingBottom="22dp">
+ android:paddingBottom="22dp"
+ android:visibility="gone"
+ tools:visibility="visible">>
-
-
+ android:paddingBottom="22dp"
+ android:visibility="gone"
+ tools:visibility="visible">>
-
-
+ android:orientation="vertical"
+ android:visibility="gone"
+ tools:visibility="visible">
-
-
+ android:orientation="vertical"
+ android:visibility="gone"
+ tools:visibility="visible">
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_download.xml b/app/src/main/res/layout/fragment_download.xml
index d5844d5c..6e3e264e 100644
--- a/app/src/main/res/layout/fragment_download.xml
+++ b/app/src/main/res/layout/fragment_download.xml
@@ -1,6 +1,7 @@
@@ -68,7 +69,9 @@
android:layout_height="wrap_content"
android:paddingHorizontal="16dp"
android:paddingTop="16dp"
- android:paddingBottom="@dimen/global_padding_bottom">
+ android:paddingBottom="@dimen/global_padding_bottom"
+ android:visibility="gone"
+ tools:visibility="visible">
-
-
diff --git a/app/src/main/res/layout/fragment_home_tab_music.xml b/app/src/main/res/layout/fragment_home_tab_music.xml
index cd019a4a..02c6d35e 100644
--- a/app/src/main/res/layout/fragment_home_tab_music.xml
+++ b/app/src/main/res/layout/fragment_home_tab_music.xml
@@ -1,7 +1,7 @@
-
+ android:paddingHorizontal="20dp"
+ android:paddingVertical="12dp">
+ android:orientation="vertical"
+ android:visibility="gone"
+ tools:visibility="visible">
+ android:paddingEnd="8dp"
+ android:paddingBottom="8dp">
-
-
+ android:orientation="vertical"
+ android:visibility="gone"
+ tools:visibility="visible">
@@ -198,17 +197,14 @@
android:paddingBottom="8dp" />
-
-
+ android:orientation="vertical"
+ android:visibility="gone"
+ tools:visibility="visible">
@@ -243,17 +239,14 @@
android:paddingBottom="8dp" />
-
-
+ android:orientation="vertical"
+ android:visibility="gone"
+ tools:visibility="visible">
@@ -278,18 +271,15 @@
android:paddingBottom="8dp" />
-
-
+ android:layout_marginBottom="8dp"
+ android:visibility="gone"
+ tools:visibility="visible" />
+ android:visibility="gone"
+ tools:visibility="visible">
@@ -336,16 +327,20 @@
android:id="@+id/after_grid_divider"
style="@style/Divider"
android:layout_marginStart="16dp"
- android:layout_marginTop="12dp"
+ android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
- android:layout_marginBottom="12dp" />
+ android:layout_marginBottom="8dp"
+ android:visibility="gone"
+ tools:visibility="visible" />
+ android:orientation="vertical"
+ android:visibility="gone"
+ tools:visibility="visible">
+ android:paddingTop="16dp"
+ android:paddingEnd="8dp"
+ android:paddingBottom="8dp">
-
-
+ android:orientation="vertical"
+ android:visibility="gone"
+ tools:visibility="visible">
+ android:paddingTop="16dp"
+ android:paddingEnd="8dp"
+ android:paddingBottom="8dp">
@@ -424,7 +417,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="8dp"
- android:paddingTop="12dp"
android:paddingEnd="8dp"
android:text="@string/home_title_starred_albums_see_all_button" />
@@ -440,16 +432,13 @@
android:paddingBottom="8dp" />
-
-
+ android:orientation="vertical"
+ android:visibility="gone"
+ tools:visibility="visible">
+ android:paddingTop="16dp"
+ android:paddingEnd="8dp"
+ android:paddingBottom="8dp">
@@ -477,7 +466,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="8dp"
- android:paddingTop="12dp"
android:paddingEnd="8dp"
android:text="@string/home_title_starred_artists_see_all_button" />
@@ -493,25 +481,23 @@
android:paddingBottom="8dp" />
-
-
+ android:layout_marginBottom="8dp"
+ android:visibility="gone"
+ tools:visibility="visible" />
+ android:visibility="gone"
+ tools:visibility="visible">
@@ -534,17 +520,14 @@
android:paddingBottom="8dp" />
-
-
+ android:orientation="vertical"
+ android:visibility="gone"
+ tools:visibility="visible">
@@ -569,17 +552,14 @@
android:paddingBottom="8dp" />
-
-
+ android:layout_marginBottom="8dp"
+ android:visibility="gone"
+ tools:visibility="visible" />
+ android:visibility="gone"
+ tools:visibility="visible">
+ android:paddingTop="16dp"
+ android:paddingEnd="8dp"
+ android:paddingBottom="8dp">
@@ -615,7 +596,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="8dp"
- android:paddingTop="12dp"
android:paddingEnd="8dp"
android:text="@string/home_title_most_played_see_all_button" />
@@ -633,17 +613,14 @@
android:paddingBottom="8dp" />
-
-
+ android:orientation="vertical"
+ android:visibility="gone"
+ tools:visibility="visible">
+ android:paddingTop="16dp"
+ android:paddingEnd="8dp"
+ android:paddingBottom="8dp">
@@ -672,7 +649,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="8dp"
- android:paddingTop="12dp"
android:paddingEnd="8dp"
android:text="@string/home_title_last_played_see_all_button" />
@@ -691,17 +667,14 @@
android:paddingBottom="8dp" />
-
-
+ android:orientation="vertical"
+ android:visibility="gone"
+ tools:visibility="visible">
+ android:paddingTop="16dp"
+ android:paddingEnd="8dp"
+ android:paddingBottom="8dp">
@@ -730,7 +703,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="8dp"
- android:paddingTop="12dp"
android:paddingEnd="8dp"
android:text="@string/home_title_recently_added_see_all_button" />
@@ -749,26 +721,22 @@
android:paddingBottom="8dp" />
-
-
+ android:visibility="gone"
+ tools:visibility="visible">
@@ -783,18 +751,15 @@
android:paddingBottom="8dp" />
-
-
+ android:text="@string/home_option_reorganize"
+ android:visibility="gone"
+ tools:visibility="visible"/>
diff --git a/app/src/main/res/layout/fragment_home_tab_podcast.xml b/app/src/main/res/layout/fragment_home_tab_podcast.xml
index 8aaab099..dd8ed15b 100644
--- a/app/src/main/res/layout/fragment_home_tab_podcast.xml
+++ b/app/src/main/res/layout/fragment_home_tab_podcast.xml
@@ -1,6 +1,7 @@
@@ -24,7 +25,9 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
- android:paddingBottom="8dp">
+ android:paddingBottom="8dp"
+ android:visibility="gone"
+ tools:visibility="visible">
+ android:orientation="vertical"
+ android:visibility="gone"
+ tools:visibility="visible">
-
-
-
diff --git a/app/src/main/res/layout/fragment_library.xml b/app/src/main/res/layout/fragment_library.xml
index 6f156014..c96fadaf 100644
--- a/app/src/main/res/layout/fragment_library.xml
+++ b/app/src/main/res/layout/fragment_library.xml
@@ -1,6 +1,7 @@
@@ -29,7 +30,9 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
- android:paddingBottom="8dp">
+ android:paddingBottom="8dp"
+ android:visibility="gone"
+ tools:visibility="visible">
+ android:paddingBottom="8dp" />
-
-
+ android:visibility="gone"
+ tools:visibility="visible">
@@ -74,8 +73,9 @@
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingStart="8dp"
- android:paddingTop="8dp"
- android:paddingEnd="8dp">
+ android:paddingTop="16dp"
+ android:paddingEnd="8dp"
+ android:paddingBottom="8dp">
@@ -94,7 +93,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="8dp"
- android:paddingTop="8dp"
android:paddingEnd="8dp"
android:text="@string/library_title_album_see_all_button" />
@@ -113,17 +111,13 @@
android:paddingBottom="8dp" />
-
-
+ android:visibility="gone"
+ tools:visibility="visible">
@@ -132,8 +126,9 @@
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingStart="8dp"
- android:paddingTop="8dp"
- android:paddingEnd="8dp">
+ android:paddingTop="16dp"
+ android:paddingEnd="8dp"
+ android:paddingBottom="8dp">
@@ -153,7 +147,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="8dp"
- android:paddingTop="12dp"
android:paddingEnd="8dp"
android:text="@string/library_title_artist_see_all_button" />
@@ -172,17 +165,13 @@
android:paddingBottom="8dp" />
-
-
+ android:visibility="gone"
+ tools:visibility="visible">
@@ -191,8 +180,9 @@
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingStart="8dp"
- android:paddingTop="8dp"
- android:paddingEnd="8dp">
+ android:paddingTop="16dp"
+ android:paddingEnd="8dp"
+ android:paddingBottom="8dp">
@@ -212,7 +201,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="8dp"
- android:paddingTop="12dp"
android:paddingEnd="8dp"
android:text="@string/library_title_genre_see_all_button" />
@@ -229,17 +217,13 @@
android:paddingEnd="8dp" />
-
-
+ android:visibility="gone"
+ tools:visibility="visible">
@@ -248,8 +232,9 @@
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingStart="8dp"
- android:paddingTop="8dp"
- android:paddingEnd="8dp">
+ android:paddingTop="16dp"
+ android:paddingEnd="8dp"
+ android:paddingBottom="8dp">
@@ -268,7 +252,6 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingStart="8dp"
- android:paddingTop="12dp"
android:paddingEnd="8dp"
android:text="@string/library_title_playlist_see_all_button" />
@@ -285,11 +268,6 @@
android:paddingTop="8dp"
android:paddingBottom="8dp" />
-
-
\ No newline at end of file