Add bottomsheet everywhere

This commit is contained in:
Antonio Cappiello 2020-12-01 20:04:54 +01:00
parent 01bdbf49b2
commit 9af0afa441
41 changed files with 866 additions and 359 deletions

View file

@ -104,6 +104,23 @@ public class AlbumRepository {
thread.start();
}
public Album getAlbumByID(String id) {
Album album = null;
GetAlbumByIDThreadSafe getAlbum = new GetAlbumByIDThreadSafe(albumDao, id);
Thread thread = new Thread(getAlbum);
thread.start();
try {
thread.join();
album = getAlbum.getAlbum();
} catch (InterruptedException e) {
e.printStackTrace();
}
return album;
}
private static class ExistThreadSafe implements Runnable {
private AlbumDao albumDao;
private Album album;
@ -204,4 +221,24 @@ public class AlbumRepository {
albumDao.deleteAll();
}
}
private static class GetAlbumByIDThreadSafe implements Runnable {
private Album album;
private AlbumDao albumDao;
private String id;
public GetAlbumByIDThreadSafe(AlbumDao albumDao, String id) {
this.albumDao = albumDao;
this.id = id;
}
@Override
public void run() {
album = albumDao.getAlbumByID(id);
}
public Album getAlbum() {
return album;
}
}
}

View file

@ -97,6 +97,23 @@ public class ArtistRepository {
thread.start();
}
public Artist getArtistByID(String id) {
Artist artist = null;
GetArtistByIDThreadSafe getArtist = new GetArtistByIDThreadSafe(artistDao, id);
Thread thread = new Thread(getArtist);
thread.start();
try {
thread.join();
artist = getArtist.getArtist();
} catch (InterruptedException e) {
e.printStackTrace();
}
return artist;
}
private static class ExistThreadSafe implements Runnable {
private ArtistDao artistDao;
private Artist artist;
@ -197,4 +214,24 @@ public class ArtistRepository {
artistDao.deleteAll();
}
}
private static class GetArtistByIDThreadSafe implements Runnable {
private Artist artist;
private ArtistDao artistDao;
private String id;
public GetArtistByIDThreadSafe(ArtistDao artistDao, String id) {
this.artistDao = artistDao;
this.id = id;
}
@Override
public void run() {
artist = artistDao.getArtistByID(id);
}
public Artist getArtist() {
return artist;
}
}
}