+ @Override
+ public boolean onRow(@NonNull Cursor cursor) {
+ final String profileUUID = cursor.getString(0);
+ final int transactionId = cursor.getInt(1);
+ activity.runOnUiThread(() -> loadTransactionIntoModel(profileUUID, transactionId));
+ return false; // limit 1, by the way
+ }
+ @Override
+ public void onNoRows() {
+ if (TextUtils.isEmpty(accFilter))
+ return;
+
+ debug("description", "Trying transaction search without preferred account filter");
+
+ final String broaderSql =
+ "select t.profile, t.id from transactions t where t.description=?" +
+ " ORDER BY year desc, month desc, day desc LIMIT 1";
+ params.remove(1);
+ debug("description", broaderSql);
+ debug("description", description);
+
+ activity.runOnUiThread(
+ () -> Snackbar.make(recyclerView, R.string.ignoring_preferred_account,
+ Snackbar.LENGTH_LONG)
+ .show());
+
+ MLDB.queryInBackground(broaderSql, new String[]{description},
+ new MLDB.CallbackHelper() {
+ @Override
+ public void onStart() {
+ model.incrementBusyCounter();
+ }
+ @Override
+ public boolean onRow(@NonNull Cursor cursor) {
+ final String profileUUID = cursor.getString(0);
+ final int transactionId = cursor.getInt(1);
+ activity.runOnUiThread(
+ () -> loadTransactionIntoModel(profileUUID, transactionId));
+ return false;
+ }
+ @Override
+ public void onDone() {
+ model.decrementBusyCounter();
+ }
+ });
+ }
+ });