[android] Reimplements Track Deletion

Signed-off-by: kavikhalique <kavikhalique3@gmail.com>
This commit is contained in:
kavi khalique 2024-07-25 13:50:15 +05:30 committed by GitHub
parent 2f8f9ded88
commit bdf9616a87
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 4 deletions

View file

@ -410,6 +410,7 @@ public class BookmarkListAdapter extends RecyclerView.Adapter<Holders.BaseBookma
new Holders.TrackViewHolder(inflater.inflate(R.layout.item_track, parent,
false));
trackHolder.setOnClickListener(mClickListener);
trackHolder.setOnLongClickListener(mLongClickListener);
holder = trackHolder;
break;
case TYPE_BOOKMARK:

View file

@ -600,11 +600,11 @@ public class BookmarksListFragment extends BaseMwmRecyclerFragment<ConcatAdapter
}
}
private boolean onTrackMenuItemClicked(long trackId)
private void onDeleteTrackSelected(long trackId)
{
BookmarkManager.INSTANCE.deleteTrack(trackId);
getAdapter().notifyDataSetChanged();
return false;
getBookmarkListAdapter().onDelete(mSelectedPosition);
getBookmarkListAdapter().notifyDataSetChanged();
}
@Override
@ -735,7 +735,7 @@ public class BookmarksListFragment extends BaseMwmRecyclerFragment<ConcatAdapter
private ArrayList<MenuBottomSheetItem> getTrackMenuItems(final Track track)
{
ArrayList<MenuBottomSheetItem> items = new ArrayList<>();
items.add(new MenuBottomSheetItem(R.string.delete, R.drawable.ic_delete, () -> onTrackMenuItemClicked(track.getTrackId())));
items.add(new MenuBottomSheetItem(R.string.delete, R.drawable.ic_delete, () -> onDeleteTrackSelected(track.getTrackId())));
return items;
}