]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/model/Data.java
single observer instances, single place for reloading account/transaction lists
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / model / Data.java
index 7380d613db32e0bb5c2fb0b7d16267a9e7afa82d..2559fd86f9f3aa702d7f50fb3108120d25995183 100644 (file)
@@ -28,7 +28,6 @@ import net.ktnx.mobileledger.utils.ObservableValue;
 
 import java.util.ArrayList;
 import java.util.Date;
-import java.util.List;
 
 public final class Data {
     public static ObservableList<TransactionListItem> transactions = new ObservableList<>(new ArrayList<>());
@@ -53,6 +52,16 @@ public final class Data {
             return -1;
         }
     }
+    public static int getProfileIndex(String profileUUID) {
+        try (LockHolder lh = profiles.lockForReading()) {
+            for (int i = 0; i < profiles.size(); i++) {
+                MobileLedgerProfile p = profiles.get(i);
+                if (p.getUuid().equals(profileUUID)) return i;
+            }
+
+            return -1;
+        }
+    }
     public static int retrieveCurrentThemeIdFromDb() {
         String profileUUID = MLDB.getOption(MLDB.OPT_PROFILE_UUID, null);
         if (profileUUID == null) return -1;