]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/ui/activity/ProfileThemedActivity.java
remove unised constant
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / ui / activity / ProfileThemedActivity.java
index 821d186d88a2382f405dd6209bf2f61ee8e3be19..77a9272bf9880494b52987c65db457c08bb22711 100644 (file)
@@ -20,17 +20,15 @@ package net.ktnx.mobileledger.ui.activity;
 import android.annotation.SuppressLint;
 import android.os.Bundle;
 
+import androidx.annotation.Nullable;
+
 import net.ktnx.mobileledger.model.Data;
 import net.ktnx.mobileledger.model.MobileLedgerProfile;
 import net.ktnx.mobileledger.utils.Colors;
-import net.ktnx.mobileledger.utils.GetOptCallback;
 import net.ktnx.mobileledger.utils.MLDB;
 
-import androidx.annotation.Nullable;
-
 @SuppressLint("Registered")
 public class ProfileThemedActivity extends CrashReportingActivity {
-    static final int waitSlice = 200;
     protected MobileLedgerProfile mProfile;
     protected void setupProfileColors() {
         Colors.setupTheme(this, mProfile);
@@ -43,6 +41,9 @@ public class ProfileThemedActivity extends CrashReportingActivity {
     protected void onCreate(@Nullable Bundle savedInstanceState) {
         initProfile();
         super.onCreate(savedInstanceState);
+
+        setupProfileColors();
+
         Data.profile.observe(this, mobileLedgerProfile -> {
             mProfile = mobileLedgerProfile;
             setupProfileColors();
@@ -51,16 +52,13 @@ public class ProfileThemedActivity extends CrashReportingActivity {
     protected void initProfile() {
         mProfile = Data.profile.getValue();
         if (mProfile == null) {
-            MLDB.getOption(MLDB.OPT_PROFILE_UUID, null, new GetOptCallback() {
-                @Override
-                protected void onResult(String profileUUID) {
-                    MobileLedgerProfile startupProfile;
+            String profileUUID = MLDB.getOption(MLDB.OPT_PROFILE_UUID, null);
+            MobileLedgerProfile startupProfile;
 
 
-                    startupProfile = Data.getProfile(profileUUID);
-                    Data.setCurrentProfile(startupProfile);
-                }
-            });
+            startupProfile = Data.getProfile(profileUUID);
+            Data.setCurrentProfile(startupProfile);
+            mProfile = startupProfile;
         }
     }
 }