use of android.content.CursorLoader in project cardslib by gabrielemariotti.
the class ListCursorCardFragment method onCreateLoader.
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
Loader<Cursor> loader = null;
loader = new CursorLoader(getActivity(), CardCursorContract.CardCursor.CONTENT_URI, CardCursorContract.CardCursor.ALL_PROJECTION, null, null, CardCursorContract.CardCursor.DEFAULT_SORT);
return loader;
}
use of android.content.CursorLoader in project cardslib by gabrielemariotti.
the class ListGplayCursorCardCABFragment method onCreateLoader.
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
Loader<Cursor> loader = null;
loader = new CursorLoader(getActivity(), CardCursorContract.CardCursor.CONTENT_URI, CardCursorContract.CardCursor.ALL_PROJECTION, null, null, CardCursorContract.CardCursor.DEFAULT_SORT);
return loader;
}
use of android.content.CursorLoader in project cardslib by gabrielemariotti.
the class NativeGridCursorCardFragment method onCreateLoader.
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
Loader<Cursor> loader = null;
loader = new CursorLoader(getActivity(), CardCursorContract.CardCursor.CONTENT_URI, CardCursorContract.CardCursor.ALL_PROJECTION, null, null, CardCursorContract.CardCursor.DEFAULT_SORT);
return loader;
}
use of android.content.CursorLoader in project Android by hmkcode.
the class RealPathUtil method getRealPathFromURI_API11to18.
@SuppressLint("NewApi")
public static String getRealPathFromURI_API11to18(Context context, Uri contentUri) {
String[] proj = { MediaStore.Images.Media.DATA };
String result = null;
CursorLoader cursorLoader = new CursorLoader(context, contentUri, proj, null, null, null);
Cursor cursor = cursorLoader.loadInBackground();
if (cursor != null) {
int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
cursor.moveToFirst();
result = cursor.getString(column_index);
}
return result;
}
use of android.content.CursorLoader in project iosched by google.
the class VideoLibraryModel method createCursorLoader.
@Override
public Loader<Cursor> createCursorLoader(final VideoLibraryQueryEnum query, final Bundle args) {
CursorLoader loader = null;
switch(query) {
case VIDEOS:
ArrayList<String> selectionArgs = new ArrayList<>();
ArrayList<String> selectionClauses = new ArrayList<>();
// Extract possible filter values from the Bundle.
if (args != null && args.containsKey(KEY_YEAR)) {
mSelectedYear = args.getInt(KEY_YEAR);
}
if (args != null && args.containsKey(KEY_TOPIC)) {
mSelectedTopic = args.getString(KEY_TOPIC);
}
// If filter values have been set we add the filter clause to the Loader.
if (mSelectedYear > ALL_YEARS) {
selectionClauses.add(ScheduleContract.Videos.VIDEO_YEAR + "=?");
selectionArgs.add(Integer.toString(mSelectedYear));
}
if (mSelectedTopic != null && !mSelectedTopic.equals(ALL_TOPICS)) {
selectionClauses.add(ScheduleContract.Videos.VIDEO_TOPIC + "=?");
selectionArgs.add(mSelectedTopic);
}
String selection = selectionClauses.isEmpty() ? null : ParserUtils.joinStrings(" AND ", selectionClauses, null);
String[] selectionArgsArray = selectionArgs.isEmpty() ? null : selectionArgs.toArray(new String[selectionArgs.size()]);
LOGD(TAG, "Starting videos query, selection=" + selection + " (year=" + mSelectedYear + ", topic=" + mSelectedTopic);
// Create and return the Loader.
loader = getCursorLoaderInstance(mContext, mVideoUri, VideoLibraryQueryEnum.VIDEOS.getProjection(), selection, selectionArgsArray, ScheduleContract.Videos.DEFAULT_SORT);
break;
case FILTERS:
LOGD(TAG, "Starting Video Filters query");
loader = getCursorLoaderInstance(mContext, mFilterUri, VideoLibraryQueryEnum.FILTERS.getProjection(), null, null, null);
break;
case MY_VIEWED_VIDEOS:
LOGD(TAG, "Starting My Viewed Videos query");
loader = getCursorLoaderInstance(mContext, mMyVideosUri, VideoLibraryQueryEnum.MY_VIEWED_VIDEOS.getProjection(), null, null, null);
break;
case TAGS:
loader = TagMetadata.createCursorLoader(mContext);
}
return loader;
}
Aggregations