mirror of
https://github.com/antebudimir/tempus.git
synced 2025-12-31 09:33:33 +00:00
Fix song removing in playlist by position
This commit is contained in:
parent
474df23add
commit
501a7af61e
2 changed files with 3 additions and 3 deletions
|
|
@ -156,7 +156,7 @@ public class PlaylistEditorDialog extends DialogFragment {
|
|||
|
||||
@Override
|
||||
public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) {
|
||||
playlistEditorViewModel.removeFromPlaylistSongLiveList(playlistDialogSongHorizontalAdapter.getItem(viewHolder.getBindingAdapterPosition()));
|
||||
playlistEditorViewModel.removeFromPlaylistSongLiveList(viewHolder.getBindingAdapterPosition());
|
||||
bind.playlistSongRecyclerView.getAdapter().notifyItemRemoved(viewHolder.getBindingAdapterPosition());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,9 +74,9 @@ public class PlaylistEditorViewModel extends AndroidViewModel {
|
|||
return songLiveList;
|
||||
}
|
||||
|
||||
public void removeFromPlaylistSongLiveList(Song song) {
|
||||
public void removeFromPlaylistSongLiveList(int position) {
|
||||
List<Song> songs = songLiveList.getValue();
|
||||
Objects.requireNonNull(songs).remove(song);
|
||||
Objects.requireNonNull(songs).remove(position);
|
||||
songLiveList.postValue(songs);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue