From: Damyan Ivanov Date: Sun, 10 Nov 2019 11:20:37 +0000 (+0200) Subject: NewTransAct: set global profile in initProfile() when called via app shortcut X-Git-Tag: v0.11.0~91 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=c90b826c547b788765e10fde220150d5b49d8d11;p=mobile-ledger.git 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 --- 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,