From c90b826c547b788765e10fde220150d5b49d8d11 Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Sun, 10 Nov 2019 13:20:37 +0200 Subject: [PATCH] NewTransAct: set global profile in initProfile() when called via app shortcut same is done in super.initProfile() during normal startup the global profile setting is needed in the item holder when setting up lookups --- .../ktnx/mobileledger/ui/activity/NewTransactionActivity.java | 1 + .../mobileledger/ui/activity/NewTransactionItemHolder.java | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionActivity.java b/app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionActivity.java index cef99101..950bce32 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionActivity.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionActivity.java @@ -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(); } diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionItemHolder.java b/app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionItemHolder.java index 2e4c0e6c..031453c3 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionItemHolder.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/activity/NewTransactionItemHolder.java @@ -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, -- 2.39.5