mirror of
https://github.com/CappielloAntonio/tempo.git
synced 2026-02-02 07:23:36 +00:00
Implemented offline mode functionality
This commit is contained in:
@@ -353,6 +353,12 @@ public class SongRepository {
|
||||
thread.start();
|
||||
}
|
||||
|
||||
public void setOfflineStatus(Song song) {
|
||||
UpdateThreadSafe update = new UpdateThreadSafe(songDao, song);
|
||||
Thread thread = new Thread(update);
|
||||
thread.start();
|
||||
}
|
||||
|
||||
private static class UpdateThreadSafe implements Runnable {
|
||||
private SongDao songDao;
|
||||
private Song song;
|
||||
@@ -368,6 +374,25 @@ public class SongRepository {
|
||||
}
|
||||
}
|
||||
|
||||
public void setAllOffline() {
|
||||
SetAllOfflineThreadSafe update = new SetAllOfflineThreadSafe(songDao);
|
||||
Thread thread = new Thread(update);
|
||||
thread.start();
|
||||
}
|
||||
|
||||
private static class SetAllOfflineThreadSafe implements Runnable {
|
||||
private SongDao songDao;
|
||||
|
||||
public SetAllOfflineThreadSafe(SongDao songDao) {
|
||||
this.songDao = songDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
songDao.updateAllOffline();
|
||||
}
|
||||
}
|
||||
|
||||
public void insertSongPerGenre(ArrayList<SongGenreCross> songGenreCrosses) {
|
||||
InsertPerGenreThreadSafe insertPerGenre = new InsertPerGenreThreadSafe(songGenreCrossDao, songGenreCrosses);
|
||||
Thread thread = new Thread(insertPerGenre);
|
||||
|
||||
Reference in New Issue
Block a user