]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/model/Data.java
name variable keeping auto-closed resource 'ignored'
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / model / Data.java
index 0414f0d8191dbef98994805f2446d7b5980f68d4..d183c4c8094b65401c82284f5a89949cc4322804 100644 (file)
@@ -19,7 +19,6 @@ package net.ktnx.mobileledger.model;
 
 import android.database.Cursor;
 import android.database.sqlite.SQLiteDatabase;
-import android.util.Log;
 
 import net.ktnx.mobileledger.utils.LockHolder;
 import net.ktnx.mobileledger.utils.MLDB;
@@ -32,6 +31,8 @@ import java.util.concurrent.atomic.AtomicInteger;
 
 import androidx.lifecycle.MutableLiveData;
 
+import static net.ktnx.mobileledger.utils.Logger.debug;
+
 public final class Data {
     public static ObservableList<TransactionListItem> transactions =
             new ObservableList<>(new ArrayList<>());
@@ -46,12 +47,12 @@ public final class Data {
     public static MutableLiveData<String> accountFilter = new MutableLiveData<>();
     public static void backgroundTaskStarted() {
         int cnt = backgroundTaskCount.incrementAndGet();
-        Log.d("data", String.format("background task count is %d after incrementing", cnt));
+        debug("data", String.format("background task count is %d after incrementing", cnt));
         backgroundTasksRunning.postValue(cnt > 0);
     }
     public static void backgroundTaskFinished() {
         int cnt = backgroundTaskCount.decrementAndGet();
-        Log.d("data", String.format("background task count is %d after decrementing", cnt));
+        debug("data", String.format("background task count is %d after decrementing", cnt));
         backgroundTasksRunning.postValue(cnt > 0);
     }
     public static void setCurrentProfile(MobileLedgerProfile newProfile) {
@@ -59,7 +60,7 @@ public final class Data {
         profile.set(newProfile);
     }
     public static int getProfileIndex(MobileLedgerProfile profile) {
-        try (LockHolder lh = profiles.lockForReading()) {
+        try (LockHolder ignored = profiles.lockForReading()) {
             for (int i = 0; i < profiles.size(); i++) {
                 MobileLedgerProfile p = profiles.get(i);
                 if (p.equals(profile)) return i;
@@ -69,7 +70,7 @@ public final class Data {
         }
     }
     public static int getProfileIndex(String profileUUID) {
-        try (LockHolder lh = profiles.lockForReading()) {
+        try (LockHolder ignored = profiles.lockForReading()) {
             for (int i = 0; i < profiles.size(); i++) {
                 MobileLedgerProfile p = profiles.get(i);
                 if (p.getUuid().equals(profileUUID)) return i;
@@ -97,7 +98,7 @@ public final class Data {
             profile = MobileLedgerProfile.loadAllFromDB(profileUUID);
         }
         else {
-            try (LockHolder lh = profiles.lockForReading()) {
+            try (LockHolder ignored = profiles.lockForReading()) {
                 int i = getProfileIndex(profileUUID);
                 if (i == -1) i = 0;
                 profile = profiles.get(i);