});
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, mProfile);
+ "description", false, this, mProfile);
hookTextChangeListener(tvDescription);
progress = findViewById(R.id.save_transaction_progress);
if (focus) acc.requestFocus();
hookSwipeListener(row);
- MLDB.hookAutocompletionAdapter(this, acc, MLDB.ACCOUNTS_TABLE, "name", true, amt, null,
- mProfile);
+ MLDB.hookAutocompletionAdapter(this, acc, MLDB.ACCOUNTS_TABLE, "name", true,
+ description -> amt.requestFocus(), mProfile);
hookTextChangeListener(acc);
hookTextChangeListener(amt);
import android.os.AsyncTask;
import android.os.Build;
import android.provider.FontsContract;
-import android.view.View;
import android.widget.AutoCompleteTextView;
import android.widget.FilterQueryProvider;
import android.widget.SimpleCursorAdapter;
public static void hookAutocompletionAdapter(final Context context,
final AutoCompleteTextView view,
final String table, final String field) {
- hookAutocompletionAdapter(context, view, table, field, true, null, null, null);
+ hookAutocompletionAdapter(context, view, table, field, true, null, null);
}
@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 boolean profileSpecific,
final DescriptionSelectedCallback callback,
final MobileLedgerProfile profile) {
String[] from = {field};
view.setAdapter(adapter);
- if (nextView != null) {
- view.setOnItemClickListener((parent, itemView, position, id) -> {
- nextView.requestFocus(View.FOCUS_FORWARD);
- if (callback != null) {
- callback.descriptionSelected(String.valueOf(view.getText()));
- }
- });
- }
+ if (callback != null) view.setOnItemClickListener((parent, itemView, position, id) -> {
+ callback.descriptionSelected(String.valueOf(view.getText()));
+ });
}
}