From 44f3da0aa9a7d442a3686c546a583485dfffa5fa Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Thu, 10 Jan 2019 21:27:41 +0000 Subject: [PATCH] Data: single central method for changing the current profile sets the option in the DB and Data.profile --- app/src/main/java/net/ktnx/mobileledger/model/Data.java | 5 +++++ 1 file changed, 5 insertions(+) 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); + } } -- 2.39.5