refactor some code
This commit is contained in:
parent
934c1f7533
commit
b90476f6ab
9 changed files with 14 additions and 27 deletions
|
|
@ -152,16 +152,12 @@ public class SearchAdapter extends RecyclerView.Adapter<SearchAdapter.ViewHolder
|
|||
case ALBUM:
|
||||
NavigationUtil.goToAlbum(activity,
|
||||
((Album) item).getId(),
|
||||
Pair.create(image,
|
||||
activity.getResources().getString(R.string.transition_album_art)
|
||||
));
|
||||
Pair.create(image, activity.getResources().getString(R.string.transition_album_art)));
|
||||
break;
|
||||
case ARTIST:
|
||||
NavigationUtil.goToArtist(activity,
|
||||
((Artist) item).getId(),
|
||||
Pair.create(image,
|
||||
activity.getResources().getString(R.string.transition_artist_image)
|
||||
));
|
||||
Pair.create(image, activity.getResources().getString(R.string.transition_artist_image)));
|
||||
break;
|
||||
case SONG:
|
||||
List<Song> playList = new ArrayList<>();
|
||||
|
|
|
|||
|
|
@ -220,10 +220,7 @@ public class AlbumAdapter extends AbsMultiSelectAdapter<AlbumAdapter.ViewHolder,
|
|||
if (isInQuickSelectMode()) {
|
||||
toggleChecked(getAdapterPosition());
|
||||
} else {
|
||||
Pair[] albumPairs = new Pair[]{
|
||||
Pair.create(image,
|
||||
activity.getResources().getString(R.string.transition_album_art)
|
||||
)};
|
||||
Pair[] albumPairs = new Pair[]{Pair.create(image, activity.getResources().getString(R.string.transition_album_art))};
|
||||
NavigationUtil.goToAlbum(activity, dataSet.get(getAdapterPosition()).getId(), albumPairs);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ public class Playlist implements Parcelable {
|
|||
|
||||
if (id != playlist.id) return false;
|
||||
return name != null ? name.equals(playlist.name) : playlist.name == null;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -48,7 +47,6 @@ public class Playlist implements Parcelable {
|
|||
'}';
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -90,7 +90,6 @@ public class Song implements Parcelable {
|
|||
'}';
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -145,7 +145,6 @@ public class MusicService extends Service implements SharedPreferences.OnSharedP
|
|||
private boolean pausedByTransientLossOfFocus;
|
||||
private PlayingNotification playingNotification;
|
||||
private AudioManager audioManager;
|
||||
@SuppressWarnings("deprecation")
|
||||
private MediaSessionCompat mediaSession;
|
||||
private PowerManager.WakeLock wakeLock;
|
||||
private PlaybackHandler playerHandler;
|
||||
|
|
@ -1071,14 +1070,15 @@ public class MusicService extends Service implements SharedPreferences.OnSharedP
|
|||
savePosition();
|
||||
savePositionInTrack();
|
||||
final Song currentSong = getCurrentSong();
|
||||
HistoryStore.getInstance(this).addSongId(currentSong.id);
|
||||
//HistoryStore.getInstance(this).addSongId(currentSong.id);
|
||||
if (songPlayCountHelper.shouldBumpPlayCount()) {
|
||||
SongPlayCountStore.getInstance(this).bumpPlayCount(songPlayCountHelper.getSong().id);
|
||||
//SongPlayCountStore.getInstance(this).bumpPlayCount(songPlayCountHelper.getSong().id);
|
||||
}
|
||||
songPlayCountHelper.notifySongChanged(currentSong);
|
||||
break;
|
||||
case QUEUE_CHANGED:
|
||||
updateMediaSessionMetaData(); // because playing queue size might have changed
|
||||
// because playing queue size might have changed
|
||||
updateMediaSessionMetaData();
|
||||
saveState();
|
||||
if (playingQueue.size() > 0) {
|
||||
prepareNext();
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ package com.kabouzeid.gramophone.ui.fragments.mainactivity.library.pager;
|
|||
import android.os.Bundle;
|
||||
import androidx.annotation.LayoutRes;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.StringRes;
|
||||
import com.google.android.material.appbar.AppBarLayout;
|
||||
import com.google.android.material.appbar.AppBarLayout.OnOffsetChangedListener;
|
||||
|
|
@ -33,7 +32,6 @@ public abstract class AbsLibraryPagerRecyclerViewFragment<A extends RecyclerView
|
|||
View container;
|
||||
@BindView(R.id.recycler_view)
|
||||
RecyclerView recyclerView;
|
||||
@Nullable
|
||||
@BindView(android.R.id.empty)
|
||||
TextView empty;
|
||||
|
||||
|
|
|
|||
|
|
@ -57,8 +57,6 @@ public class MusicUtil {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@NonNull
|
||||
public static String getArtistInfoString(@NonNull final Context context, @NonNull final Artist artist) {
|
||||
int albumCount = artist.getAlbumCount();
|
||||
|
|
@ -163,8 +161,8 @@ public class MusicUtil {
|
|||
return string1 + " • " + string2;
|
||||
}
|
||||
|
||||
//iTunes uses for example 1002 for track 2 CD1 or 3011 for track 11 CD3.
|
||||
//this method converts those values to normal tracknumbers
|
||||
// iTunes uses for example 1002 for track 2 CD1 or 3011 for track 11 CD3.
|
||||
// this method converts those values to normal track numbers
|
||||
public static int getFixedTrackNumber(int trackNumberToFix) {
|
||||
return trackNumberToFix % 1000;
|
||||
}
|
||||
|
|
@ -280,7 +278,8 @@ public class MusicUtil {
|
|||
}
|
||||
|
||||
public static boolean isFavorite(@NonNull final Context context, @NonNull final Song song) {
|
||||
return PlaylistsUtil.doPlaylistContains(context, getFavoritesPlaylist(context).id, song.id);
|
||||
//return PlaylistsUtil.doPlaylistContains(context, getFavoritesPlaylist(context).id, song.id);
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void toggleFavorite(@NonNull final Context context, @NonNull final Song song) {
|
||||
|
|
|
|||
|
|
@ -28,8 +28,8 @@ public class NavigationUtil {
|
|||
final Intent intent = new Intent(activity, ArtistDetailActivity.class);
|
||||
intent.putExtra(ArtistDetailActivity.EXTRA_ARTIST_ID, artistId);
|
||||
|
||||
//noinspection unchecked
|
||||
if (sharedElements != null && sharedElements.length > 0) {
|
||||
//noinspection unchecked
|
||||
activity.startActivity(intent, ActivityOptionsCompat.makeSceneTransitionAnimation(activity, sharedElements).toBundle());
|
||||
} else {
|
||||
activity.startActivity(intent);
|
||||
|
|
@ -40,8 +40,8 @@ public class NavigationUtil {
|
|||
final Intent intent = new Intent(activity, AlbumDetailActivity.class);
|
||||
intent.putExtra(AlbumDetailActivity.EXTRA_ALBUM_ID, albumId);
|
||||
|
||||
//noinspection unchecked
|
||||
if (sharedElements != null && sharedElements.length > 0) {
|
||||
//noinspection unchecked
|
||||
activity.startActivity(intent, ActivityOptionsCompat.makeSceneTransitionAnimation(activity, sharedElements).toBundle());
|
||||
} else {
|
||||
activity.startActivity(intent);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue