]> git.ktnx.net Git - mobile-ledger.git/commitdiff
asynchronous profile setup
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Fri, 3 May 2019 15:25:08 +0000 (18:25 +0300)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Fri, 3 May 2019 16:11:44 +0000 (19:11 +0300)
app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java

index ec8c6fbe97d90d42a53ac1f4b20132af2abd4cbb..e43970d229594a7a3377fd25b8ca6f14f6305219 100644 (file)
@@ -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);