refactor some code and remove useless comments
This commit is contained in:
parent
422aab0334
commit
e876a57d01
55 changed files with 51 additions and 202 deletions
|
|
@ -1,6 +1,5 @@
|
|||
package com.kabouzeid.gramophone.adapter;
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
|
@ -16,7 +15,6 @@ import com.kabouzeid.gramophone.glide.CustomPaletteTarget;
|
|||
import com.kabouzeid.gramophone.glide.SongGlideRequest;
|
||||
import com.kabouzeid.gramophone.misc.CustomFragmentStatePagerAdapter;
|
||||
import com.kabouzeid.gramophone.model.Song;
|
||||
import com.kabouzeid.gramophone.util.PreferenceUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -24,9 +22,6 @@ import butterknife.BindView;
|
|||
import butterknife.ButterKnife;
|
||||
import butterknife.Unbinder;
|
||||
|
||||
/**
|
||||
* @author Karim Abou Zeid (kabouzeid)
|
||||
*/
|
||||
public class AlbumCoverPagerAdapter extends CustomFragmentStatePagerAdapter {
|
||||
|
||||
private List<Song> dataSet;
|
||||
|
|
|
|||
|
|
@ -64,15 +64,19 @@ public class GenreAdapter extends RecyclerView.Adapter<GenreAdapter.ViewHolder>
|
|||
holder.separator.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
if (holder.shortSeparator != null) {
|
||||
holder.shortSeparator.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if (holder.menu != null) {
|
||||
holder.menu.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if (holder.title != null) {
|
||||
holder.title.setText(genre.name);
|
||||
}
|
||||
|
||||
if (holder.text != null) {
|
||||
holder.text.setText(MusicUtil.getGenreInfoString(activity, genre));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ public class MusicLibraryPagerAdapter extends FragmentPagerAdapter {
|
|||
if (mWeakFragment != null && mWeakFragment.get() != null) {
|
||||
return mWeakFragment.get();
|
||||
}
|
||||
|
||||
return getItem(position);
|
||||
}
|
||||
|
||||
|
|
@ -73,6 +74,7 @@ public class MusicLibraryPagerAdapter extends FragmentPagerAdapter {
|
|||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return POSITION_NONE;
|
||||
}
|
||||
|
||||
|
|
@ -90,6 +92,7 @@ public class MusicLibraryPagerAdapter extends FragmentPagerAdapter {
|
|||
if (mWeakFragment != null) {
|
||||
mWeakFragment.clear();
|
||||
}
|
||||
|
||||
mFragmentArray.put(position, new WeakReference<>(mFragment));
|
||||
return mFragment;
|
||||
}
|
||||
|
|
@ -97,8 +100,7 @@ public class MusicLibraryPagerAdapter extends FragmentPagerAdapter {
|
|||
@Override
|
||||
public Fragment getItem(final int position) {
|
||||
final Holder mCurrentHolder = mHolderList.get(position);
|
||||
return Fragment.instantiate(mContext,
|
||||
mCurrentHolder.mClassName, mCurrentHolder.mParams);
|
||||
return Fragment.instantiate(mContext, mCurrentHolder.mClassName, mCurrentHolder.mParams);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -128,7 +130,6 @@ public class MusicLibraryPagerAdapter extends FragmentPagerAdapter {
|
|||
if (mFragmentArray.size() == 0) return;
|
||||
|
||||
HashMap<String, WeakReference<Fragment>> mappings = new HashMap<>(mFragmentArray.size());
|
||||
|
||||
for (int i = 0, size = mFragmentArray.size(); i < size; i++) {
|
||||
WeakReference<Fragment> ref = mFragmentArray.valueAt(i);
|
||||
Fragment fragment = ref.get();
|
||||
|
|
@ -136,6 +137,7 @@ public class MusicLibraryPagerAdapter extends FragmentPagerAdapter {
|
|||
mappings.put(fragment.getClass().getName(), ref);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0, size = mHolderList.size(); i < size; i++) {
|
||||
WeakReference<Fragment> ref = mappings.get(mHolderList.get(i).mClassName);
|
||||
if (ref != null) {
|
||||
|
|
@ -166,8 +168,9 @@ public class MusicLibraryPagerAdapter extends FragmentPagerAdapter {
|
|||
public static MusicFragments of(Class<?> cl) {
|
||||
MusicFragments[] fragments = All.FRAGMENTS;
|
||||
for (MusicFragments fragment : fragments) {
|
||||
if (cl.equals(fragment.mFragmentClass))
|
||||
if (cl.equals(fragment.mFragmentClass)) {
|
||||
return fragment;
|
||||
}
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException("Unknown music fragment " + cl);
|
||||
|
|
|
|||
|
|
@ -38,9 +38,6 @@ import java.io.IOException;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Karim Abou Zeid (kabouzeid)
|
||||
*/
|
||||
public class PlaylistAdapter extends AbsMultiSelectAdapter<PlaylistAdapter.ViewHolder, Playlist> {
|
||||
|
||||
private static final int SMART_PLAYLIST = 0;
|
||||
|
|
@ -112,6 +109,7 @@ public class PlaylistAdapter extends AbsMultiSelectAdapter<PlaylistAdapter.ViewH
|
|||
if (playlist instanceof AbsSmartPlaylist) {
|
||||
return ((AbsSmartPlaylist) playlist).iconRes;
|
||||
}
|
||||
|
||||
return MusicUtil.isFavoritePlaylist(activity, playlist) ? R.drawable.ic_favorite_white_24dp : R.drawable.ic_queue_music_white_24dp;
|
||||
}
|
||||
|
||||
|
|
@ -148,6 +146,7 @@ public class PlaylistAdapter extends AbsMultiSelectAdapter<PlaylistAdapter.ViewH
|
|||
i--;
|
||||
}
|
||||
}
|
||||
|
||||
if (selection.size() > 0) {
|
||||
DeletePlaylistDialog.create(selection).show(activity.getSupportFragmentManager(), "DELETE_PLAYLIST");
|
||||
}
|
||||
|
|
@ -176,7 +175,6 @@ public class PlaylistAdapter extends AbsMultiSelectAdapter<PlaylistAdapter.ViewH
|
|||
int failures = 0;
|
||||
|
||||
String dir = "";
|
||||
|
||||
for (Playlist playlist : params[0]) {
|
||||
try {
|
||||
dir = PlaylistsUtil.savePlaylist(App.getInstance().getApplicationContext(), playlist).getParent();
|
||||
|
|
@ -212,11 +210,11 @@ public class PlaylistAdapter extends AbsMultiSelectAdapter<PlaylistAdapter.ViewH
|
|||
songs.addAll(PlaylistSongLoader.getPlaylistSongList(activity, playlist.id));
|
||||
}
|
||||
}
|
||||
|
||||
return songs;
|
||||
}
|
||||
|
||||
public class ViewHolder extends MediaEntryViewHolder {
|
||||
|
||||
public ViewHolder(@NonNull View itemView, int itemViewType) {
|
||||
super(itemView);
|
||||
|
||||
|
|
@ -244,6 +242,7 @@ public class PlaylistAdapter extends AbsMultiSelectAdapter<PlaylistAdapter.ViewH
|
|||
if (playlist instanceof LatestPlaylist) {
|
||||
popupMenu.getMenu().findItem(R.id.action_clear_playlist).setVisible(false);
|
||||
}
|
||||
|
||||
popupMenu.setOnMenuItemClickListener(item -> {
|
||||
if (item.getItemId() == R.id.action_clear_playlist) {
|
||||
if (playlist instanceof AbsSmartPlaylist) {
|
||||
|
|
@ -254,6 +253,7 @@ public class PlaylistAdapter extends AbsMultiSelectAdapter<PlaylistAdapter.ViewH
|
|||
return PlaylistMenuHelper.handleMenuClick(
|
||||
activity, dataSet.get(getAdapterPosition()), item);
|
||||
});
|
||||
|
||||
popupMenu.show();
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,9 +26,6 @@ import com.kabouzeid.gramophone.util.NavigationUtil;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Karim Abou Zeid (kabouzeid)
|
||||
*/
|
||||
public class SearchAdapter extends RecyclerView.Adapter<SearchAdapter.ViewHolder> {
|
||||
|
||||
private static final int HEADER = 0;
|
||||
|
|
|
|||
|
|
@ -33,11 +33,7 @@ import com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Karim Abou Zeid (kabouzeid)
|
||||
*/
|
||||
public class AlbumAdapter extends AbsMultiSelectAdapter<AlbumAdapter.ViewHolder, Album> implements FastScrollRecyclerView.SectionedAdapter {
|
||||
|
||||
protected final AppCompatActivity activity;
|
||||
protected List<Album> dataSet;
|
||||
|
||||
|
|
@ -124,6 +120,7 @@ public class AlbumAdapter extends AbsMultiSelectAdapter<AlbumAdapter.ViewHolder,
|
|||
if (holder.title != null) {
|
||||
holder.title.setTextColor(MaterialValueHelper.getPrimaryTextColor(activity, ColorUtil.isColorLight(color)));
|
||||
}
|
||||
|
||||
if (holder.text != null) {
|
||||
holder.text.setTextColor(MaterialValueHelper.getSecondaryTextColor(activity, ColorUtil.isColorLight(color)));
|
||||
}
|
||||
|
|
@ -144,10 +141,11 @@ public class AlbumAdapter extends AbsMultiSelectAdapter<AlbumAdapter.ViewHolder,
|
|||
|
||||
@Override
|
||||
public void onColorReady(int color) {
|
||||
if (usePalette)
|
||||
if (usePalette) {
|
||||
setColors(color, holder);
|
||||
else
|
||||
} else {
|
||||
setColors(getDefaultFooterColor(), holder);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -183,6 +181,7 @@ public class AlbumAdapter extends AbsMultiSelectAdapter<AlbumAdapter.ViewHolder,
|
|||
for (Album album : albums) {
|
||||
songs.addAll(album.songs);
|
||||
}
|
||||
|
||||
return songs;
|
||||
}
|
||||
|
||||
|
|
@ -206,7 +205,6 @@ public class AlbumAdapter extends AbsMultiSelectAdapter<AlbumAdapter.ViewHolder,
|
|||
}
|
||||
|
||||
public class ViewHolder extends MediaEntryViewHolder {
|
||||
|
||||
public ViewHolder(@NonNull final View itemView) {
|
||||
super(itemView);
|
||||
setImageTransitionName(activity.getString(R.string.transition_album_art));
|
||||
|
|
|
|||
|
|
@ -20,11 +20,7 @@ import com.kabouzeid.gramophone.util.MusicUtil;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Karim Abou Zeid (kabouzeid)
|
||||
*/
|
||||
public class HorizontalAlbumAdapter extends AlbumAdapter {
|
||||
|
||||
public HorizontalAlbumAdapter(@NonNull AppCompatActivity activity, List<Album> dataSet, boolean usePalette, @Nullable CabHolder cabHolder) {
|
||||
super(activity, dataSet, HorizontalAdapterHelper.LAYOUT_RES, usePalette, cabHolder);
|
||||
}
|
||||
|
|
@ -44,6 +40,7 @@ public class HorizontalAlbumAdapter extends AlbumAdapter {
|
|||
if (holder.title != null) {
|
||||
holder.title.setTextColor(MaterialValueHelper.getPrimaryTextColor(activity, ColorUtil.isColorLight(color)));
|
||||
}
|
||||
|
||||
if (holder.text != null) {
|
||||
holder.text.setTextColor(MaterialValueHelper.getSecondaryTextColor(activity, ColorUtil.isColorLight(color)));
|
||||
}
|
||||
|
|
@ -65,10 +62,11 @@ public class HorizontalAlbumAdapter extends AlbumAdapter {
|
|||
|
||||
@Override
|
||||
public void onColorReady(int color) {
|
||||
if (usePalette)
|
||||
if (usePalette) {
|
||||
setColors(color, holder);
|
||||
else
|
||||
} else {
|
||||
setColors(getAlbumArtistFooterColor(), holder);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,11 +32,7 @@ import com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Karim Abou Zeid (kabouzeid)
|
||||
*/
|
||||
public class ArtistAdapter extends AbsMultiSelectAdapter<ArtistAdapter.ViewHolder, Artist> implements FastScrollRecyclerView.SectionedAdapter {
|
||||
|
||||
protected final AppCompatActivity activity;
|
||||
protected List<Artist> dataSet;
|
||||
|
||||
|
|
@ -103,11 +99,12 @@ public class ArtistAdapter extends AbsMultiSelectAdapter<ArtistAdapter.ViewHolde
|
|||
if (holder.title != null) {
|
||||
holder.title.setText(artist.getName());
|
||||
}
|
||||
|
||||
if (holder.text != null) {
|
||||
holder.text.setText(MusicUtil.getArtistInfoString(activity, artist));
|
||||
}
|
||||
holder.itemView.setActivated(isChecked(artist));
|
||||
|
||||
holder.itemView.setActivated(isChecked(artist));
|
||||
loadArtistImage(artist, holder);
|
||||
}
|
||||
|
||||
|
|
@ -117,6 +114,7 @@ public class ArtistAdapter extends AbsMultiSelectAdapter<ArtistAdapter.ViewHolde
|
|||
if (holder.title != null) {
|
||||
holder.title.setTextColor(MaterialValueHelper.getPrimaryTextColor(activity, ColorUtil.isColorLight(color)));
|
||||
}
|
||||
|
||||
if (holder.text != null) {
|
||||
holder.text.setTextColor(MaterialValueHelper.getSecondaryTextColor(activity, ColorUtil.isColorLight(color)));
|
||||
}
|
||||
|
|
@ -136,10 +134,11 @@ public class ArtistAdapter extends AbsMultiSelectAdapter<ArtistAdapter.ViewHolde
|
|||
|
||||
@Override
|
||||
public void onColorReady(int color) {
|
||||
if (usePalette)
|
||||
if (usePalette) {
|
||||
setColors(color, holder);
|
||||
else
|
||||
} else {
|
||||
setColors(getDefaultFooterColor(), holder);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -170,6 +169,7 @@ public class ArtistAdapter extends AbsMultiSelectAdapter<ArtistAdapter.ViewHolde
|
|||
for (Artist artist : artists) {
|
||||
songs.addAll(artist.getSongs());
|
||||
}
|
||||
|
||||
return songs;
|
||||
}
|
||||
|
||||
|
|
@ -188,7 +188,6 @@ public class ArtistAdapter extends AbsMultiSelectAdapter<ArtistAdapter.ViewHolde
|
|||
}
|
||||
|
||||
public class ViewHolder extends MediaEntryViewHolder {
|
||||
|
||||
public ViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
setImageTransitionName(activity.getString(R.string.transition_artist_image));
|
||||
|
|
@ -202,10 +201,7 @@ public class ArtistAdapter extends AbsMultiSelectAdapter<ArtistAdapter.ViewHolde
|
|||
if (isInQuickSelectMode()) {
|
||||
toggleChecked(getAdapterPosition());
|
||||
} else {
|
||||
Pair[] artistPairs = new Pair[]{
|
||||
Pair.create(image,
|
||||
activity.getResources().getString(R.string.transition_artist_image)
|
||||
)};
|
||||
Pair[] artistPairs = new Pair[]{Pair.create(image, activity.getResources().getString(R.string.transition_artist_image))};
|
||||
NavigationUtil.goToArtist(activity, dataSet.get(getAdapterPosition()).getId(), artistPairs);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,9 +14,6 @@ import com.kabouzeid.gramophone.interfaces.CabHolder;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Karim Abou Zeid (kabouzeid)
|
||||
*/
|
||||
public abstract class AbsMultiSelectAdapter<VH extends RecyclerView.ViewHolder, I> extends RecyclerView.Adapter<VH> implements MaterialCab.Callback {
|
||||
private final Context context;
|
||||
private final CabHolder cabHolder;
|
||||
|
|
|
|||
|
|
@ -13,9 +13,6 @@ import com.kabouzeid.gramophone.R;
|
|||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
|
||||
/**
|
||||
* @author Karim Abou Zeid (kabouzeid)
|
||||
*/
|
||||
public class MediaEntryViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener {
|
||||
@Nullable
|
||||
@BindView(R.id.image)
|
||||
|
|
@ -74,6 +71,5 @@ public class MediaEntryViewHolder extends RecyclerView.ViewHolder implements Vie
|
|||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ public abstract class AbsOffsetSongAdapter extends SongAdapter {
|
|||
View view = LayoutInflater.from(activity).inflate(R.layout.item_list_single_row, parent, false);
|
||||
return createViewHolder(view);
|
||||
}
|
||||
|
||||
return super.onCreateViewHolder(parent, viewType);
|
||||
}
|
||||
|
||||
|
|
@ -50,6 +51,7 @@ public abstract class AbsOffsetSongAdapter extends SongAdapter {
|
|||
@Override
|
||||
public long getItemId(int position) {
|
||||
position--;
|
||||
|
||||
if (position < 0) return -2;
|
||||
return super.getItemId(position);
|
||||
}
|
||||
|
|
@ -58,6 +60,7 @@ public abstract class AbsOffsetSongAdapter extends SongAdapter {
|
|||
@Override
|
||||
protected Song getIdentifier(int position) {
|
||||
position--;
|
||||
|
||||
if (position < 0) return null;
|
||||
return super.getIdentifier(position);
|
||||
}
|
||||
|
|
@ -82,7 +85,6 @@ public abstract class AbsOffsetSongAdapter extends SongAdapter {
|
|||
}
|
||||
|
||||
public class ViewHolder extends SongAdapter.ViewHolder {
|
||||
|
||||
public ViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,9 +28,6 @@ import com.kabouzeid.gramophone.util.NavigationUtil;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Karim Abou Zeid (kabouzeid)
|
||||
*/
|
||||
public class ArtistSongAdapter extends ArrayAdapter<Song> implements MaterialCab.Callback {
|
||||
@Nullable
|
||||
private final CabHolder cabHolder;
|
||||
|
|
|
|||
|
|
@ -21,9 +21,6 @@ import com.kabouzeid.gramophone.util.ViewUtil;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Karim Abou Zeid (kabouzeid)
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public class OrderablePlaylistSongAdapter extends PlaylistSongAdapter implements DraggableItemAdapter<OrderablePlaylistSongAdapter.ViewHolder> {
|
||||
|
||||
|
|
@ -43,6 +40,7 @@ public class OrderablePlaylistSongAdapter extends PlaylistSongAdapter implements
|
|||
@Override
|
||||
public long getItemId(int position) {
|
||||
position--;
|
||||
|
||||
if (position < 0) return -2;
|
||||
return ((List<PlaylistSong>) (List) dataSet).get(position).idInPlayList; // important!
|
||||
}
|
||||
|
|
@ -54,6 +52,7 @@ public class OrderablePlaylistSongAdapter extends PlaylistSongAdapter implements
|
|||
RemoveFromPlaylistDialog.create((List<PlaylistSong>) (List) selection).show(activity.getSupportFragmentManager(), "ADD_PLAYLIST");
|
||||
return;
|
||||
}
|
||||
|
||||
super.onMultipleItemAction(menuItem, selection);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,11 +19,7 @@ import com.kabouzeid.gramophone.util.ViewUtil;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Karim Abou Zeid (kabouzeid)
|
||||
*/
|
||||
public class PlayingQueueAdapter extends SongAdapter implements DraggableItemAdapter<PlayingQueueAdapter.ViewHolder> {
|
||||
|
||||
private static final int HISTORY = 0;
|
||||
private static final int CURRENT = 1;
|
||||
private static final int UP_NEXT = 2;
|
||||
|
|
|
|||
|
|
@ -18,11 +18,7 @@ import com.kabouzeid.gramophone.util.NavigationUtil;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Karim Abou Zeid (kabouzeid)
|
||||
*/
|
||||
public class PlaylistSongAdapter extends AbsOffsetSongAdapter {
|
||||
|
||||
public PlaylistSongAdapter(AppCompatActivity activity, @NonNull List<Song> dataSet, @LayoutRes int itemLayoutRes, boolean usePalette, @Nullable CabHolder cabHolder) {
|
||||
super(activity, dataSet, itemLayoutRes, usePalette, cabHolder, false);
|
||||
setMultiSelectMenuRes(R.menu.menu_cannot_delete_single_songs_playlist_songs_selection);
|
||||
|
|
|
|||
|
|
@ -16,9 +16,6 @@ import com.kabouzeid.gramophone.model.Song;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Karim Abou Zeid (kabouzeid)
|
||||
*/
|
||||
public class ShuffleButtonSongAdapter extends AbsOffsetSongAdapter {
|
||||
|
||||
public ShuffleButtonSongAdapter(AppCompatActivity activity, List<Song> dataSet, @LayoutRes int itemLayoutRes, boolean usePalette, @Nullable CabHolder cabHolder) {
|
||||
|
|
@ -63,7 +60,6 @@ public class ShuffleButtonSongAdapter extends AbsOffsetSongAdapter {
|
|||
}
|
||||
|
||||
public class ViewHolder extends AbsOffsetSongAdapter.ViewHolder {
|
||||
|
||||
public ViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
}
|
||||
|
|
@ -74,6 +70,7 @@ public class ShuffleButtonSongAdapter extends AbsOffsetSongAdapter {
|
|||
MusicPlayerRemote.openAndShuffleQueue(dataSet, true);
|
||||
return;
|
||||
}
|
||||
|
||||
super.onClick(v);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,9 +33,6 @@ import com.simplecityapps.recyclerview_fastscroll.views.FastScrollRecyclerView;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Karim Abou Zeid (kabouzeid)
|
||||
*/
|
||||
public class SongAdapter extends AbsMultiSelectAdapter<SongAdapter.ViewHolder, Song> implements MaterialCab.Callback, FastScrollRecyclerView.SectionedAdapter {
|
||||
|
||||
protected final AppCompatActivity activity;
|
||||
|
|
@ -115,7 +112,6 @@ public class SongAdapter extends AbsMultiSelectAdapter<SongAdapter.ViewHolder, S
|
|||
}
|
||||
|
||||
loadAlbumCover(song, holder);
|
||||
|
||||
}
|
||||
|
||||
private void setColors(int color, ViewHolder holder) {
|
||||
|
|
@ -124,6 +120,7 @@ public class SongAdapter extends AbsMultiSelectAdapter<SongAdapter.ViewHolder, S
|
|||
if (holder.title != null) {
|
||||
holder.title.setTextColor(MaterialValueHelper.getPrimaryTextColor(activity, ColorUtil.isColorLight(color)));
|
||||
}
|
||||
|
||||
if (holder.text != null) {
|
||||
holder.text.setTextColor(MaterialValueHelper.getSecondaryTextColor(activity, ColorUtil.isColorLight(color)));
|
||||
}
|
||||
|
|
@ -144,10 +141,11 @@ public class SongAdapter extends AbsMultiSelectAdapter<SongAdapter.ViewHolder, S
|
|||
|
||||
@Override
|
||||
public void onColorReady(int color) {
|
||||
if (usePalette)
|
||||
if (usePalette) {
|
||||
setColors(color, holder);
|
||||
else
|
||||
} else {
|
||||
setColors(getDefaultFooterColor(), holder);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -216,6 +214,7 @@ public class SongAdapter extends AbsMultiSelectAdapter<SongAdapter.ViewHolder, S
|
|||
if (menu == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
menu.setOnClickListener(new SongMenuHelper.OnClickSongMenu(activity) {
|
||||
@Override
|
||||
public Song getSong() {
|
||||
|
|
@ -253,6 +252,7 @@ public class SongAdapter extends AbsMultiSelectAdapter<SongAdapter.ViewHolder, S
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue