});
tvDescription = findViewById(R.id.new_transaction_description);
MLDB.hookAutocompletionAdapter(this, tvDescription, MLDB.DESCRIPTION_HISTORY_TABLE,
- "description", false, findViewById(R.id.new_transaction_acc_1), this);
+ "description", false, findViewById(R.id.new_transaction_acc_1), this, mProfile);
hookTextChangeListener(tvDescription);
progress = findViewById(R.id.save_transaction_progress);
TextView tvAmount = (TextView) row.getChildAt(1);
hookSwipeListener(row);
MLDB.hookAutocompletionAdapter(this, tvAccountName, MLDB.ACCOUNTS_TABLE, "name", true,
- tvAmount, null);
+ tvAmount, null, mProfile);
hookTextChangeListener(tvAccountName);
hookTextChangeListener(tvAmount);
// Log.d("swipe", "hooked to row "+i);
if (focus) acc.requestFocus();
hookSwipeListener(row);
- MLDB.hookAutocompletionAdapter(this, acc, MLDB.ACCOUNTS_TABLE, "name", true, amt, null);
+ MLDB.hookAutocompletionAdapter(this, acc, MLDB.ACCOUNTS_TABLE, "name", true, amt, null,
+ mProfile);
hookTextChangeListener(acc);
hookTextChangeListener(amt);
import net.ktnx.mobileledger.async.DescriptionSelectedCallback;
import net.ktnx.mobileledger.model.Data;
+import net.ktnx.mobileledger.model.MobileLedgerProfile;
import org.jetbrains.annotations.NonNls;
final AutoCompleteTextView view,
final String table, final String field,
final boolean profileSpecific) {
- hookAutocompletionAdapter(context, view, table, field, profileSpecific, null, null);
+ hookAutocompletionAdapter(context, view, table, field, profileSpecific, null, null, Data.profile.get());
}
@TargetApi(Build.VERSION_CODES.N)
public static void hookAutocompletionAdapter(final Context context,
final AutoCompleteTextView view,
final String table, final String field,
final boolean profileSpecific, final View nextView,
- final DescriptionSelectedCallback callback) {
+ final DescriptionSelectedCallback callback,
+ final MobileLedgerProfile profile) {
String[] from = {field};
int[] to = {android.R.id.text1};
SimpleCursorAdapter adapter =
"FROM %s " +
"WHERE profile=? AND %s_upper LIKE '%%'||?||'%%' " +
"ORDER BY 2, 1;", field, field, field, field, table, field);
- params = new String[]{str, str, str, Data.profile.get().getUuid(), str};
+ params = new String[]{str, str, str, profile.getUuid(), str};
}
else {
sql = String.format("SELECT %s as a, case when %s_upper LIKE ?||'%%' then 1 " +