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;
});
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,
dateObserver = date -> {
if (syncingData) return;
- tvDate.setText(item.getFormattedDate());
+ syncingData = true;
+ try {
+ tvDate.setText(item.getFormattedDate());
+ }
+ finally {
+ syncingData = false;
+ }
};
descriptionObserver = description -> {
if (syncingData) return;
- tvDescription.setText(description);
+ syncingData = true;
+ try {
+ tvDescription.setText(description);
+ }
+ finally {
+ syncingData = false;
+ }
};
hintObserver = hint -> {
if (syncingData) return;
- tvAmount.setHint(hint);
+ syncingData = true;
+ try {
+ tvAmount.setHint(hint);
+ }
+ finally {
+ syncingData = false;
+ }
};
focusedAccountObserver = index -> {
if ((index != null) && index.equals(getAdapterPosition())) {