X-Git-Url: https://git.ktnx.net/?p=mobile-ledger.git;a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fnet%2Fktnx%2Fmobileledger%2Fui%2Fnew_transaction%2FNewTransactionActivity.java;h=0c0cfac0ec00985b80f8ba556c7a5b78f1eadb0b;hp=9a630f811d2b5f54ae8a22061c2104ba8966df0e;hb=dee1d58effc26bccf90c03d0f71428a436e6eb99;hpb=54efe16f2d4fd4647bf916e2ecbcbbc23339e296 diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/new_transaction/NewTransactionActivity.java b/app/src/main/java/net/ktnx/mobileledger/ui/new_transaction/NewTransactionActivity.java index 9a630f81..0c0cfac0 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/new_transaction/NewTransactionActivity.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/new_transaction/NewTransactionActivity.java @@ -54,6 +54,7 @@ import net.ktnx.mobileledger.model.MatchedTemplate; 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; @@ -83,8 +84,17 @@ public class NewTransactionActivity extends ProfileThemedActivity 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));