use of androidx.loader.content.CursorLoader in project collect by opendatakit.
the class CursorLoaderFactory method createEditableInstancesCursorLoader.
public CursorLoader createEditableInstancesCursorLoader(CharSequence charSequence, String sortOrder) {
CursorLoader cursorLoader;
if (charSequence.length() == 0) {
cursorLoader = createEditableInstancesCursorLoader(sortOrder);
} else {
String selection = DatabaseInstanceColumns.STATUS + " !=? " + "and " + DatabaseInstanceColumns.STATUS + " !=? " + "and " + DatabaseInstanceColumns.DISPLAY_NAME + " LIKE ?";
String[] selectionArgs = { Instance.STATUS_SUBMITTED, Instance.STATUS_SUBMISSION_FAILED, "%" + charSequence + "%" };
cursorLoader = getInstancesCursorLoader(selection, selectionArgs, sortOrder);
}
return cursorLoader;
}
use of androidx.loader.content.CursorLoader in project Applozic-Android-SDK by AppLozic.
the class ChannelDatabaseService method getSearchCursorForGroupsLoader.
public Loader<Cursor> getSearchCursorForGroupsLoader(final String searchString) {
return new CursorLoader(context, null, null, null, null, MobiComDatabaseHelper.CHANNEL_DISPLAY_NAME + " asc") {
@Override
public Cursor loadInBackground() {
SQLiteDatabase db = dbHelper.getReadableDatabase();
Cursor cursor;
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append("SELECT ").append(" * ").append(" FROM ").append(MobiComDatabaseHelper.CHANNEL).append(" where ").append(MobiComDatabaseHelper.TYPE).append(" NOT IN ('").append(Channel.GroupType.CONTACT_GROUP.getValue()).append("')");
if (!TextUtils.isEmpty(searchString)) {
stringBuffer.append(" AND " + MobiComDatabaseHelper.CHANNEL_DISPLAY_NAME + " like '%" + searchString.replaceAll("'", "''") + "%'");
}
stringBuffer.append(" order by " + MobiComDatabaseHelper.CHANNEL_DISPLAY_NAME + " COLLATE NOCASE asc ");
cursor = db.rawQuery(stringBuffer.toString(), null);
return cursor;
}
};
}
Aggregations