mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-01 09:53:33 +00:00
Add option to order and delete elements from queue by dragging and swiping
This commit is contained in:
parent
49c3d60ed1
commit
a2770daaa8
9 changed files with 70 additions and 111 deletions
|
|
@ -23,7 +23,7 @@ import com.cappielloantonio.play.model.RecentSearch;
|
|||
import com.cappielloantonio.play.model.Song;
|
||||
import com.cappielloantonio.play.model.SongGenreCross;
|
||||
|
||||
@Database(entities = {Album.class, Artist.class, Genre.class, Playlist.class, Song.class, RecentSearch.class, SongGenreCross.class, Queue.class}, version = 6, exportSchema = false)
|
||||
@Database(entities = {Album.class, Artist.class, Genre.class, Playlist.class, Song.class, RecentSearch.class, SongGenreCross.class, Queue.class}, version = 7, exportSchema = false)
|
||||
public abstract class AppDatabase extends RoomDatabase {
|
||||
private static final String TAG = "AppDatabase";
|
||||
|
||||
|
|
|
|||
|
|
@ -20,18 +20,6 @@ public interface QueueDao {
|
|||
@Query("SELECT * FROM song JOIN queue ON song.id = queue.id")
|
||||
List<Song> getAllSimple();
|
||||
|
||||
@Query("SELECT * FROM song JOIN queue ON song.id = queue.id WHERE queue.rowid = :position")
|
||||
Song getSongByIndex(int position);
|
||||
|
||||
@Query("SELECT * FROM song JOIN queue ON song.id = queue.id WHERE queue.last_played != 0 ORDER BY queue.last_played DESC LIMIT 1")
|
||||
LiveData<Song> getLastPlayedSong();
|
||||
|
||||
@Query("UPDATE queue SET last_played = :timestamp WHERE queue.rowid = :position")
|
||||
void setLastPlayedSong(int position, long timestamp);
|
||||
|
||||
@Query("UPDATE queue SET last_played = :timestamp WHERE queue.id = :songID")
|
||||
void setLastPlayedSong(String songID, long timestamp);
|
||||
|
||||
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||
void insert(Queue songQueueObject);
|
||||
|
||||
|
|
@ -41,7 +29,7 @@ public interface QueueDao {
|
|||
@Delete
|
||||
void delete(Queue songQueueObject);
|
||||
|
||||
@Query("DELETE FROM queue WHERE queue.rowid = :position")
|
||||
@Query("DELETE FROM queue WHERE queue.track_order = :position")
|
||||
void deleteByPosition(int position);
|
||||
|
||||
@Query("DELETE FROM queue")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue