mirror of
https://github.com/antebudimir/tempus.git
synced 2026-01-01 18:03:33 +00:00
Implemented offline mode functionality
This commit is contained in:
parent
658e69dcb9
commit
e0569c3901
21 changed files with 635 additions and 23 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue