This may happen if the app is removed from memory while the new transaction
activity is active; when the app is started later it goes straight to the
new transaction activity and there is no profile loaded from the options db
in the normal startup the main activity is first and it loads the profile.
Another way to start the new transaction activity without passing via the
main activity is through the app shortcuts
import net.ktnx.mobileledger.model.Data;
import net.ktnx.mobileledger.model.MobileLedgerProfile;
import net.ktnx.mobileledger.utils.Colors;
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 {
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);
protected MobileLedgerProfile mProfile;
protected void setupProfileColors() {
Colors.setupTheme(this, mProfile);
protected void onCreate(@Nullable Bundle savedInstanceState) {
initProfile();
super.onCreate(savedInstanceState);
protected void onCreate(@Nullable Bundle savedInstanceState) {
initProfile();
super.onCreate(savedInstanceState);
+ Data.profile.observe(this, mobileLedgerProfile -> {
+ mProfile = mobileLedgerProfile;
+ setupProfileColors();
+ });
}
protected void initProfile() {
mProfile = Data.profile.getValue();
}
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;
+
+
+ startupProfile = Data.getProfile(profileUUID);
+ Data.setCurrentProfile(startupProfile);
+ }
+ });
+ }