- mProfile = Data.profile.getValue();
- if (mProfile == null) {
- MLDB.getOption(MLDB.OPT_PROFILE_UUID, null, new GetOptCallback() {
- @Override
- protected void onResult(String profileUUID) {
- MobileLedgerProfile startupProfile;
-
-
- startupProfile = Data.getProfile(profileUUID);
- Data.setCurrentProfile(startupProfile);
- }
- });
+ long profileId = App.getStartupProfile();
+ int hue = App.getStartupTheme();
+ if (profileId == -1)
+ mThemeHue = Colors.DEFAULT_HUE_DEG;
+
+ Logger.debug(TAG,
+ String.format(Locale.US, "initProfile() calling setupProfileColors(%d)", hue));
+ setupProfileColors(hue);
+
+ initProfile(profileId);
+ }
+ protected void initProfile(long profileId) {
+ BaseDAO.runAsync(() -> initProfileSync(profileId));
+ }
+ private void initProfileSync(long profileId) {
+ Logger.debug(TAG, String.format(Locale.US, "Loading profile %d", profileId));
+ ProfileDAO dao = DB.get()
+ .getProfileDAO();
+ Profile profile = dao.getByIdSync(profileId);
+
+ if (profile == null) {
+ Logger.debug(TAG, String.format(Locale.ROOT, "Profile %d not found. Trying any other",
+ profileId));
+
+ profile = dao.getAnySync();