From: Damyan Ivanov Date: Thu, 10 Jan 2019 21:27:41 +0000 (+0000) Subject: Data: single central method for changing the current profile X-Git-Tag: v0.3~76 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=44f3da0aa9a7d442a3686c546a583485dfffa5fa;p=mobile-ledger.git Data: single central method for changing the current profile sets the option in the DB and Data.profile --- 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 d8b3b190..7781f328 100644 --- a/app/src/main/java/net/ktnx/mobileledger/model/Data.java +++ b/app/src/main/java/net/ktnx/mobileledger/model/Data.java @@ -17,6 +17,7 @@ package net.ktnx.mobileledger.model; +import net.ktnx.mobileledger.utils.MLDB; import net.ktnx.mobileledger.utils.ObservableAtomicInteger; import net.ktnx.mobileledger.utils.ObservableList; import net.ktnx.mobileledger.utils.ObservableValue; @@ -34,4 +35,8 @@ public final class Data { public static ObservableList profiles = 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()); + profile.set(newProfile); + } }