X-Git-Url: https://git.ktnx.net/?p=mobile-ledger.git;a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fnet%2Fktnx%2Fmobileledger%2Fmodel%2FData.java;h=ffad647315411cd9a4ad96e7f327201b59ab7f65;hp=7781f3285d5ab2bd4b8411bd6304838996d50b49;hb=9e8a289a85a65d372b47ccd2c2261299972ae4dd;hpb=44f3da0aa9a7d442a3686c546a583485dfffa5fa diff --git a/app/src/main/java/net/ktnx/mobileledger/model/Data.java b/app/src/main/java/net/ktnx/mobileledger/model/Data.java index 7781f328..ffad6473 100644 --- a/app/src/main/java/net/ktnx/mobileledger/model/Data.java +++ b/app/src/main/java/net/ktnx/mobileledger/model/Data.java @@ -24,6 +24,7 @@ import net.ktnx.mobileledger.utils.ObservableValue; import java.util.ArrayList; import java.util.Date; +import java.util.List; public final class Data { public static TransactionList transactions = new TransactionList(); @@ -36,7 +37,17 @@ public final class Data { new ObservableList<>(new ArrayList<>()); public static ObservableValue optShowOnlyStarred = new ObservableValue<>(); public static void setCurrentProfile(MobileLedgerProfile newProfile) { - MLDB.set_option_value(MLDB.OPT_PROFILE_UUID, newProfile.getUuid()); + MLDB.setOption(MLDB.OPT_PROFILE_UUID, newProfile.getUuid()); profile.set(newProfile); } + public static int getProfileIndex(MobileLedgerProfile profile) { + List list = profiles.getList(); + + for (int i = 0; i < list.size(); i++) { + MobileLedgerProfile p = list.get(i); + if (p.equals(profile)) return i; + } + + return -1; + } }