mirror of
https://github.com/antebudimir/tempus.git
synced 2025-12-31 17:43:32 +00:00
Code refactor in ServerRepository
This commit is contained in:
parent
d8b0101d93
commit
3778202fa5
1 changed files with 5 additions and 8 deletions
|
|
@ -5,18 +5,15 @@ import android.app.Application;
|
||||||
import androidx.lifecycle.LiveData;
|
import androidx.lifecycle.LiveData;
|
||||||
|
|
||||||
import com.cappielloantonio.play.database.AppDatabase;
|
import com.cappielloantonio.play.database.AppDatabase;
|
||||||
import com.cappielloantonio.play.database.dao.QueueDao;
|
|
||||||
import com.cappielloantonio.play.database.dao.ServerDao;
|
import com.cappielloantonio.play.database.dao.ServerDao;
|
||||||
import com.cappielloantonio.play.model.Server;
|
import com.cappielloantonio.play.model.Server;
|
||||||
import com.cappielloantonio.play.model.Song;
|
|
||||||
import com.cappielloantonio.play.util.QueueUtil;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ServerRepository {
|
public class ServerRepository {
|
||||||
private static final String TAG = "QueueRepository";
|
private static final String TAG = "QueueRepository";
|
||||||
|
|
||||||
private ServerDao serverDao;
|
private final ServerDao serverDao;
|
||||||
|
|
||||||
public ServerRepository(Application application) {
|
public ServerRepository(Application application) {
|
||||||
AppDatabase database = AppDatabase.getInstance(application);
|
AppDatabase database = AppDatabase.getInstance(application);
|
||||||
|
|
@ -40,8 +37,8 @@ public class ServerRepository {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class InsertThreadSafe implements Runnable {
|
private static class InsertThreadSafe implements Runnable {
|
||||||
private ServerDao serverDao;
|
private final ServerDao serverDao;
|
||||||
private Server server;
|
private final Server server;
|
||||||
|
|
||||||
public InsertThreadSafe(ServerDao serverDao, Server server) {
|
public InsertThreadSafe(ServerDao serverDao, Server server) {
|
||||||
this.serverDao = serverDao;
|
this.serverDao = serverDao;
|
||||||
|
|
@ -55,8 +52,8 @@ public class ServerRepository {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class DeleteThreadSafe implements Runnable {
|
private static class DeleteThreadSafe implements Runnable {
|
||||||
private ServerDao serverDao;
|
private final ServerDao serverDao;
|
||||||
private Server server;
|
private final Server server;
|
||||||
|
|
||||||
public DeleteThreadSafe(ServerDao serverDao, Server server) {
|
public DeleteThreadSafe(ServerDao serverDao, Server server) {
|
||||||
this.serverDao = serverDao;
|
this.serverDao = serverDao;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue