Fixed a force close because of inconsistent unique ids.
This commit is contained in:
parent
13c4e86c7d
commit
06096ca8f5
2 changed files with 5 additions and 5 deletions
|
|
@ -38,6 +38,11 @@ public class PlaylistSongAdapter extends SongAdapter implements DraggableItemAda
|
||||||
this.onMoveItemListener = onMoveItemListener;
|
this.onMoveItemListener = onMoveItemListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getItemId(int position) {
|
||||||
|
return ((ArrayList<PlaylistSong>) (List) dataSet).get(position).idInPlayList; // important!
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected SongAdapter.ViewHolder createViewHolder(View view) {
|
protected SongAdapter.ViewHolder createViewHolder(View view) {
|
||||||
return new ViewHolder(view);
|
return new ViewHolder(view);
|
||||||
|
|
|
||||||
|
|
@ -22,11 +22,6 @@ public class SmartPlaylistSongAdapter extends SongAdapter {
|
||||||
|
|
||||||
public static final String TAG = SmartPlaylistSongAdapter.class.getSimpleName();
|
public static final String TAG = SmartPlaylistSongAdapter.class.getSimpleName();
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getItemId(int position) {
|
|
||||||
return dataSet.get(position).id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SmartPlaylistSongAdapter(AppCompatActivity activity, @NonNull ArrayList<Song> dataSet, @LayoutRes int itemLayoutRes, boolean usePalette, @Nullable CabHolder cabHolder) {
|
public SmartPlaylistSongAdapter(AppCompatActivity activity, @NonNull ArrayList<Song> dataSet, @LayoutRes int itemLayoutRes, boolean usePalette, @Nullable CabHolder cabHolder) {
|
||||||
super(activity, dataSet, itemLayoutRes, usePalette, cabHolder);
|
super(activity, dataSet, itemLayoutRes, usePalette, cabHolder);
|
||||||
overrideMultiSelectMenuRes(R.menu.menu_cannot_delete_single_songs_playlist_songs_selection);
|
overrideMultiSelectMenuRes(R.menu.menu_cannot_delete_single_songs_playlist_songs_selection);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue