import net.ktnx.mobileledger.ui.FabManager;
import net.ktnx.mobileledger.ui.QR;
import net.ktnx.mobileledger.ui.activity.ProfileThemedActivity;
+import net.ktnx.mobileledger.ui.activity.SplashActivity;
import net.ktnx.mobileledger.ui.templates.TemplatesActivity;
import net.ktnx.mobileledger.utils.Logger;
import net.ktnx.mobileledger.utils.Misc;
b = ActivityNewTransactionBinding.inflate(getLayoutInflater(), null, false);
setContentView(b.getRoot());
setSupportActionBar(b.toolbar);
- Data.observeProfile(this,
- mobileLedgerProfile -> b.toolbar.setSubtitle(mobileLedgerProfile.getName()));
+ Data.observeProfile(this, profile -> {
+ if (profile == null) {
+ Logger.debug("new-t-act", "no active profile. Redirecting to SplashActivity");
+ Intent intent = new Intent(this, SplashActivity.class);
+ intent.setFlags(Intent.FLAG_ACTIVITY_TASK_ON_HOME | Intent.FLAG_ACTIVITY_NEW_TASK);
+ startActivity(intent);
+ finish();
+ }
+ else
+ b.toolbar.setSubtitle(profile.getName());
+ });
NavHostFragment navHostFragment = (NavHostFragment) Objects.requireNonNull(
getSupportFragmentManager().findFragmentById(R.id.new_transaction_nav));
getResources().getDisplayMetrics()));
}
@Override
- public void done(String error, Object arg) {
+ public void onTransactionSaveDone(String error, Object arg) {
Bundle b = new Bundle();
if (error != null) {
b.putString("error", error);
TransactionDAO trDao = DB.get()
.getTransactionDAO();
- TransactionWithAccounts tr;
+ TransactionWithAccounts tr = null;
- if (Misc.emptyIsNull(accFilter) != null) {
+ if (Misc.emptyIsNull(accFilter) != null)
tr = trDao.getFirstByDescriptionHavingAccountSync(description, accFilter);
- if (tr != null) {
- model.loadTransactionIntoModel(tr);
- return;
- }
- }
+ if (tr == null)
+ tr = trDao.getFirstByDescriptionSync(description);
- tr = trDao.getFirstByDescriptionSync(description);
if (tr != null)
model.loadTransactionIntoModel(tr);
});