Delete Songs from Concert
This commit is contained in:
parent
eac3919710
commit
4649d2ffed
@ -40,8 +40,8 @@ public interface MusicNoteDAO {
|
|||||||
@Query("SELECT m.* FROM music_notes m JOIN concert_songs cs ON m.musicNoteId = cs.musicNoteID WHERE cs.id = :concertID")
|
@Query("SELECT m.* FROM music_notes m JOIN concert_songs cs ON m.musicNoteId = cs.musicNoteID WHERE cs.id = :concertID")
|
||||||
List<MusicNote> getAllMusicNotesOfConcert(long concertID);
|
List<MusicNote> getAllMusicNotesOfConcert(long concertID);
|
||||||
|
|
||||||
@Delete
|
@Query("DELETE FROM concert_songs WHERE concertID = :concertID AND musicNoteID = :songID")
|
||||||
void deleteConcertSong(ConcertSong concertSong);
|
void deleteConcertSong(long songID, int concertID);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -82,6 +82,10 @@ public class ConcertDetailFragment extends Fragment {
|
|||||||
|
|
||||||
private void deleteSongFromConcert(MusicNote musicNote) {
|
private void deleteSongFromConcert(MusicNote musicNote) {
|
||||||
this.concertDetailViewModel.deleteConcertSong(musicNote);
|
this.concertDetailViewModel.deleteConcertSong(musicNote);
|
||||||
|
new Thread(() -> {
|
||||||
|
MusicNoteDAO musicNoteDAO = MusicDatabase.getDatabase(getContext()).musicNoteDao();
|
||||||
|
musicNoteDAO.deleteConcertSong(musicNote.getMusicNoteId(), concert.getId());
|
||||||
|
}).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
private class LoadConcertSongsTask extends AsyncTask<Void, Void, List<MusicNote>> {
|
private class LoadConcertSongsTask extends AsyncTask<Void, Void, List<MusicNote>> {
|
||||||
|
Loading…
Reference in New Issue
Block a user