mirror of
https://github.com/CappielloAntonio/tempo.git
synced 2026-02-04 08:13:07 +00:00
Code refactor in ServerRepository
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user