/*
- * Copyright © 2019 Damyan Ivanov.
+ * Copyright © 2020 Damyan Ivanov.
* This file is part of MoLe.
* MoLe is free software: you can distribute it and/or modify it
* under the term of the GNU General Public License as published by
import net.ktnx.mobileledger.model.Data;
import net.ktnx.mobileledger.model.MobileLedgerProfile;
import net.ktnx.mobileledger.utils.Colors;
-import net.ktnx.mobileledger.utils.MLDB;
@SuppressLint("Registered")
public class ProfileThemedActivity extends CrashReportingActivity {
protected MobileLedgerProfile mProfile;
protected void setupProfileColors() {
- Colors.setupTheme(this, mProfile);
+ final int themeHue = (mProfile == null) ? -1 : mProfile.getThemeHue();
+ Colors.setupTheme(this, themeHue);
}
@Override
protected void onStart() {
}
protected void onCreate(@Nullable Bundle savedInstanceState) {
initProfile();
- super.onCreate(savedInstanceState);
-
setupProfileColors();
-
- Data.profile.observe(this, mobileLedgerProfile -> {
- mProfile = mobileLedgerProfile;
- setupProfileColors();
- });
+ super.onCreate(savedInstanceState);
}
protected void initProfile() {
- mProfile = Data.profile.getValue();
- if (mProfile == null) {
- String profileUUID = MLDB.getOption(MLDB.OPT_PROFILE_UUID, null);
- MobileLedgerProfile startupProfile;
-
-
- startupProfile = Data.getProfile(profileUUID);
- Data.setCurrentProfile(startupProfile);
- mProfile = startupProfile;
- }
+ mProfile = Data.initProfile();
}
}