List of usage examples for android.support.v4.content CursorLoader CursorLoader
public CursorLoader(Context context, Uri uri, String[] projection, String selection, String[] selectionArgs,
String sortOrder)
From source file:com.haibison.android.anhuu.utils.ui.bookmark.BookmarkFragment.java
@Override public Loader<Cursor> onCreateLoader(int id, Bundle args) { if (BuildConfig.DEBUG) Log.d(CLASSNAME, "onCreateLoader()"); if (id == mLoaderBookmarkData) { mHandler.removeCallbacksAndMessages(null); mHandler.postDelayed(mViewLoadingShower, Display.DELAY_TIME_FOR_SIMPLE_ANIMATION); mBookmarkCursorAdapter.changeCursor(null); return new CursorLoader(getActivity(), BookmarkContract.genContentUri(getActivity()), null, null, null, String.format("%s, %s DESC", BookmarkContract.COLUMN_PROVIDER_ID, BookmarkContract.COLUMN_MODIFICATION_TIME)); } // mLoaderBookmarkData return null;//from w w w. j a v a2s . c o m }
From source file:com.conferenceengineer.android.iosched.ui.SandboxDetailFragment.java
@Override public Loader<Cursor> onCreateLoader(int id, Bundle data) { return new CursorLoader(getActivity(), mCompanyUri, SandboxQuery.PROJECTION, null, null, null); }
From source file:com.harlie.android.sunshine.app.DetailFragment.java
@Override public Loader<Cursor> onCreateLoader(int id, Bundle args) { if (null != mUri) { // Now create and return a CursorLoader that will take care of // creating a Cursor for the data being displayed. return new CursorLoader(getActivity(), mUri, DETAIL_COLUMNS, null, null, null); }/*from w w w .jav a2s. c o m*/ if (getView() != null) { ViewParent vp = getView().getParent(); if (vp != null) { if (vp instanceof CardView) { ((View) vp).setVisibility(View.INVISIBLE); } } } return null; }
From source file:com.pindroid.platform.NoteManager.java
public static CursorLoader SearchNotes(String query, String username, Context context) { final String[] projection = new String[] { Note._ID, Note.Title, Note.Text, Note.Hash, Note.Pid, Note.Account, Note.Added, Note.Updated }; String selection = null;//w ww . j av a2s . c o m final String sortorder = Note.Updated + " ASC"; final ArrayList<String> selectionlist = new ArrayList<String>(); ArrayList<String> queryList = new ArrayList<String>(); for (String s : query.split(" ")) { queryList.add("(" + Note.Title + " LIKE ? OR " + Note.Text + " LIKE ?)"); selectionlist.add("%" + s + "%"); selectionlist.add("%" + s + "%"); } selectionlist.add(username); if (query != null && query != "") { selection = "(" + TextUtils.join(" OR ", queryList) + ")" + " AND " + Note.Account + "=?"; } else { selection = Note.Account + "=?"; } return new CursorLoader(context, Note.CONTENT_URI, projection, selection, selectionlist.toArray(new String[] {}), sortorder); }
From source file:com.mindprotectionkit.freephone.ui.RecentCallListActivity.java
@Override public Loader<Cursor> onCreateLoader(int arg0, Bundle arg1) { // NOTE: To fix a weird bug: // http://stackoverflow.com/questions/11810547/runtimeexception-at-calllog-calls String[] projection = { Calls._ID, Calls.CACHED_NAME, Calls.CACHED_NUMBER_LABEL, Calls.NUMBER, Calls.TYPE, Calls.DATE };/* ww w .j av a2 s.c om*/ ((TextView) getListView().getEmptyView()).setText(R.string.RecentCallListActivity_loading); return new CursorLoader(getActivity(), Calls.CONTENT_URI, projection, null, null, Calls.DEFAULT_SORT_ORDER); }
From source file:com.odoo.addons.crm.CRMLeads.java
@Override public Loader<Cursor> onCreateLoader(int id, Bundle data) { String where = " type = ?"; String[] whereArgs;/*from w w w .j a va 2 s . c o m*/ List<String> args = new ArrayList<>(); args.add("lead"); if (mFilter != null) { where += " and (name like ? or description like ? or display_name like ? " + "or stage_name like ? or title_action like ?)"; args.add("%" + mFilter + "%"); args.add("%" + mFilter + "%"); args.add("%" + mFilter + "%"); args.add("%" + mFilter + "%"); args.add("%" + mFilter + "%"); } if (filter_customer_data) { where += " and partner_id = ?"; args.add(customer_id + ""); } whereArgs = args.toArray(new String[args.size()]); return new CursorLoader(getActivity(), db().uri(), null, where, whereArgs, "create_date DESC"); }
From source file:com.android.transmart.UI.fragments.PlaceDetailFragment.java
/** * {@inheritDoc}//from w w w . j a v a 2 s . co m * Query the {@link PlaceDetailsContentProvider} for the Phone, Address, Rating, Reference, and Url * of the selected venue. * TODO Expand the projection to include any other details you are recording in the Place Detail Content Provider. */ public Loader<Cursor> onCreateLoader(int id, Bundle args) { String[] projection = new String[] { PlaceDetailsContentProvider.KEY_NAME, PlaceDetailsContentProvider.KEY_PHONE, PlaceDetailsContentProvider.KEY_ADDRESS, PlaceDetailsContentProvider.KEY_RATING, PlaceDetailsContentProvider.KEY_REFERENCE, PlaceDetailsContentProvider.KEY_URL }; String selection = PlaceDetailsContentProvider.KEY_ID + "='" + placeId + "'"; return new CursorLoader(activity, PlaceDetailsContentProvider.CONTENT_URI, projection, selection, null, null); }
From source file:com.arcusapp.soundbox.data.MediaProvider.java
/** * Returns a list of PlaylistEntries for all the Playlists in the MediaStore. * /*from w w w. j a v a 2s . com*/ * @return a list of PlaylistEntries. The value associated is the name of the Playlist ({@linkplain MediaStore.Audio.Playlists.NAME}) */ public List<PlaylistEntry> getAllPlayLists() { List<PlaylistEntry> playLists = new ArrayList<PlaylistEntry>(); String[] projection = new String[] { MediaStore.Audio.Playlists._ID, MediaStore.Audio.Playlists.NAME }; CursorLoader cl = new CursorLoader(SoundBoxApplication.getContext(), MediaStore.Audio.Playlists.EXTERNAL_CONTENT_URI, projection, null, null, null); myCursor = cl.loadInBackground(); while (myCursor.moveToNext()) { playLists.add(new PlaylistEntry(myCursor.getString(0), myCursor.getString(1))); } Collections.sort(playLists); myCursor.close(); return playLists; }
From source file:com.odoo.addons.phonecall.PhoneCalls.java
@Override public Loader<Cursor> onCreateLoader(int id, Bundle data) { String where;// www . j a v a2s . c om List<String> args = new ArrayList<>(); if (mType == Type.Logged) { where = " state = ?"; args.add("done"); } else { where = " state != ?"; args.add("done"); } if (mFilter != null) { where += " and name like ? or lead_name like ? or customer_name like ?"; args.add("%" + mFilter + "%"); args.add("%" + mFilter + "%"); args.add("%" + mFilter + "%"); } return new CursorLoader(getActivity(), db().uri(), null, where, (args.size() > 0) ? args.toArray(new String[args.size()]) : null, "date"); }
From source file:com.example.android.popularmovies.ui.MoviesFragment.java
@Override public Loader<Cursor> onCreateLoader(int id, Bundle args) { return new CursorLoader(getActivity(), MovieContract.MovieEntry.CONTENT_URI, MovieContract.MovieEntry.MOVIE_COLUMNS, null, null, null); }