]> git.ktnx.net Git - mobile-ledger.git/commitdiff
NewTransAct: set global profile in initProfile() when called via app shortcut
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Sun, 10 Nov 2019 11:20:37 +0000 (13:20 +0200)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Sun, 10 Nov 2019 11:20:37 +0000 (13:20 +0200)
same is done in super.initProfile() during normal startup

the global profile setting is needed in the item holder when setting up
lookups

app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionActivity.java
app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionItemHolder.java

index cef99101f8eae72776103b72c46d477cb0a31265..950bce32d3c0cae9cce25aa6d139436d1c5c2d97 100644 (file)
@@ -141,6 +141,7 @@ public class NewTransactionActivity extends ProfileThemedActivity implements Tas
         if (profileUUID != null) {
             mProfile = Data.getProfile(profileUUID);
             if (mProfile == null) finish();
+            Data.setCurrentProfile(mProfile);
         }
         else super.initProfile();
     }
index 2e4c0e6ceaa360b56df4ceb97b4b2d96840ac882..031453c3d1ed5fbae9382a90685515106695d141 100644 (file)
@@ -35,6 +35,7 @@ import androidx.recyclerview.widget.RecyclerView;
 
 import net.ktnx.mobileledger.R;
 import net.ktnx.mobileledger.async.DescriptionSelectedCallback;
+import net.ktnx.mobileledger.model.Data;
 import net.ktnx.mobileledger.model.LedgerTransactionAccount;
 import net.ktnx.mobileledger.model.MobileLedgerProfile;
 import net.ktnx.mobileledger.ui.DatePickerFragment;
@@ -84,6 +85,9 @@ class NewTransactionItemHolder extends RecyclerView.ViewHolder
         });
         tvDate.setOnClickListener(v -> pickTransactionDate());
 
+        mProfile = Data.profile.getValue();
+        if (mProfile == null) throw new AssertionError();
+
         MLDB.hookAutocompletionAdapter(tvDescription.getContext(), tvDescription,
                 MLDB.DESCRIPTION_HISTORY_TABLE, "description", false, adapter, mProfile);
         MLDB.hookAutocompletionAdapter(tvAccount.getContext(), tvAccount, MLDB.ACCOUNTS_TABLE,