From 558fbcc35918d8fb106a3f7e5cad7c70650dfb59 Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Fri, 3 May 2019 18:25:08 +0300 Subject: [PATCH] asynchronous profile setup --- .../ktnx/mobileledger/ui/activity/MainActivity.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java b/app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java index ec8c6fbe..e43970d2 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java @@ -55,6 +55,7 @@ import net.ktnx.mobileledger.ui.profiles.ProfilesRecyclerViewAdapter; import net.ktnx.mobileledger.ui.transaction_list.TransactionListFragment; import net.ktnx.mobileledger.ui.transaction_list.TransactionListViewModel; import net.ktnx.mobileledger.utils.Colors; +import net.ktnx.mobileledger.utils.GetOptCallback; import net.ktnx.mobileledger.utils.LockHolder; import net.ktnx.mobileledger.utils.MLDB; @@ -448,11 +449,15 @@ public class MainActivity extends ProfileThemedActivity { startActivity(intent, args); } private void setupProfile() { - String profileUUID = MLDB.getOption(MLDB.OPT_PROFILE_UUID, null); - MobileLedgerProfile startupProfile; + MLDB.getOption(MLDB.OPT_PROFILE_UUID, null, new GetOptCallback(){ + @Override + protected void onResult(String profileUUID) { + MobileLedgerProfile startupProfile; - startupProfile = Data.getProfile(profileUUID); - Data.setCurrentProfile(startupProfile); + startupProfile = Data.getProfile(profileUUID); + Data.setCurrentProfile(startupProfile); + } + }); } public void fabNewTransactionClicked(View view) { Intent intent = new Intent(this, NewTransactionActivity.class); -- 2.39.5