Refactoring

This commit is contained in:
M66B 2019-02-28 08:11:53 +00:00
parent f52fc17136
commit 61240a541f
3 changed files with 5 additions and 5 deletions

View File

@ -86,10 +86,6 @@ public interface DaoAccount {
" WHERE account.synchronize) AS operations")
LiveData<TupleAccountStats> liveStats();
@Query("SELECT COUNT(operation.id) FROM operation" +
" WHERE operation.name = '" + EntityOperation.SEND + "'")
LiveData<Integer> liveUnsent();
@Query("SELECT account.id, swipe_left, l.type AS left_type, swipe_right, r.type AS right_type" +
" FROM account" +
" LEFT JOIN folder l ON l.id = account.swipe_left" +

View File

@ -65,6 +65,10 @@ public interface DaoOperation {
@Query(GET_OPS_FOLDER)
LiveData<List<EntityOperation>> liveOperations(long folder);
@Query("SELECT COUNT(operation.id) FROM operation" +
" WHERE operation.name = '" + EntityOperation.SEND + "'")
LiveData<Integer> liveUnsent();
@Query("SELECT * FROM operation ORDER BY id")
List<EntityOperation> getOperations();

View File

@ -76,7 +76,7 @@ public class ServiceSend extends LifecycleService {
DB db = DB.getInstance(this);
db.account().liveUnsent().observe(this, new Observer<Integer>() {
db.operation().liveUnsent().observe(this, new Observer<Integer>() {
@Override
public void onChanged(Integer unsent) {
NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);