use of android.content.CursorLoader in project iosched by google.
the class SessionDetailModel method createCursorLoader.
@Override
public Loader<Cursor> createCursorLoader(SessionDetailQueryEnum query, Bundle args) {
CursorLoader loader = null;
if (query == null) {
return loader;
}
switch(query) {
case SESSIONS:
mSessionId = getSessionId(mSessionUri);
loader = getCursorLoaderInstance(mContext, mSessionUri, SessionDetailQueryEnum.SESSIONS.getProjection(), null, null, null);
break;
case SPEAKERS:
Uri speakersUri = getSpeakersDirUri(mSessionId);
loader = getCursorLoaderInstance(mContext, speakersUri, SessionDetailQueryEnum.SPEAKERS.getProjection(), null, null, ScheduleContract.Speakers.DEFAULT_SORT);
break;
case FEEDBACK:
Uri feedbackUri = getFeedbackUri(mSessionId);
loader = getCursorLoaderInstance(mContext, feedbackUri, SessionDetailQueryEnum.FEEDBACK.getProjection(), null, null, null);
break;
case TAG_METADATA:
loader = getTagMetadataLoader();
break;
case MY_VIEWED_VIDEOS:
Uri myPlayedVideoUri = ScheduleContract.MyViewedVideos.buildMyViewedVideosUri(AccountUtils.getActiveAccountName(mContext));
loader = getCursorLoaderInstance(mContext, myPlayedVideoUri, SessionDetailQueryEnum.MY_VIEWED_VIDEOS.getProjection(), null, null, null);
break;
}
return loader;
}
use of android.content.CursorLoader in project cardslib by gabrielemariotti.
the class GridCursorCardFragment 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 WordPress-Android by wordpress-mobile.
the class MediaUtils method getLastRecordedVideoUri.
public static Uri getLastRecordedVideoUri(Activity activity) {
String[] proj = { MediaStore.Video.Media._ID };
Uri contentUri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
String sortOrder = MediaStore.Video.VideoColumns.DATE_TAKEN + " DESC";
CursorLoader loader = new CursorLoader(activity, contentUri, proj, null, null, sortOrder);
Cursor cursor = loader.loadInBackground();
cursor.moveToFirst();
long value = cursor.getLong(0);
SqlUtils.closeCursor(cursor);
return Uri.parse(contentUri.toString() + "/" + value);
}
use of android.content.CursorLoader in project android-support-v4-googlemaps by petedoyle.
the class CursorFragment method onCreateLoader.
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
// This is called when a new Loader needs to be created. This
// sample only has one Loader, so we don't care about the ID.
// First, pick the base URI to use depending on whether we are
// currently filtering.
Uri baseUri;
if (mCurFilter != null) {
baseUri = Uri.withAppendedPath(Contacts.CONTENT_FILTER_URI, Uri.encode(mCurFilter));
} else {
baseUri = Contacts.CONTENT_URI;
}
// Now create and return a CursorLoader that will take care of
// creating a Cursor for the data being displayed.
String select = "((" + Contacts.DISPLAY_NAME + " NOTNULL) AND (" + Contacts.HAS_PHONE_NUMBER + "=1) AND (" + Contacts.DISPLAY_NAME + " != '' ))";
return new CursorLoader(getActivity(), baseUri, CONTACTS_SUMMARY_PROJECTION, select, null, Contacts.DISPLAY_NAME + " COLLATE LOCALIZED ASC");
}
use of android.content.CursorLoader in project cw-omnibus by commonsguy.
the class ContactSpinners method onCreateLoader.
@Override
public Loader<Cursor> onCreateLoader(int loaderId, Bundle args) {
String[] projection;
Uri uri;
switch(loaderId) {
case LOADER_NAMES:
projection = PROJECTION_NAMES;
uri = ContactsContract.Contacts.CONTENT_URI;
break;
case LOADER_NAMES_NUMBERS:
projection = PROJECTION_NUMBERS;
uri = ContactsContract.CommonDataKinds.Phone.CONTENT_URI;
break;
default:
projection = PROJECTION_EMAILS;
uri = ContactsContract.CommonDataKinds.Email.CONTENT_URI;
break;
}
return (new CursorLoader(this, uri, projection, null, null, ContactsContract.Contacts.DISPLAY_NAME));
}
Aggregations