Example usage for android.support.v4.content CursorLoader setUri

List of usage examples for android.support.v4.content CursorLoader setUri

Introduction

In this page you can find the example usage for android.support.v4.content CursorLoader setUri.

Prototype

public void setUri(Uri uri) 

Source Link

Usage

From source file:com.granita.tasks.utils.SearchChildDescriptor.java

/**
 * Get a new {@link CursorLoader} and update it's selection arguments with the values in {@code cursor} as defined by {@code selectionColumns} in
 * {@link #ExpandableChildDescriptor(Uri, String[], String, String, int...)}. Also applies any selection defined by <code>filter</code>.
 * //from ww  w.j  av  a  2  s . co m
 * @param context
 *            A {@link Context}.
 * @param cursor
 *            The {@link Cursor} containing the selection.
 * @param filter
 *            An additional {@link AbstractFilter} to apply to the selection of the cursor.
 * @return A new {@link CursorLoader} instance.
 */
@Override
public CursorLoader getCursorLoader(Context context, Cursor cursor, AbstractFilter filter) {
    CursorLoader cursorLoader = super.getCursorLoader(context, cursor, filter);
    cursorLoader.setUri(Tasks.getSearchUri(mAuthority, cursor.getString(cursor.getColumnIndex(mQueryColumn))));

    return cursorLoader;
}

From source file:com.lambdasoup.blockvote.ui.MainActivity.java

@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    CursorLoader loader = new CursorLoader(this);
    loader.setUri(StatsProvider.CONTENT_URI);
    return loader;
}

From source file:com.amsterdam.marktbureau.makkelijkemarkt.VervangerDialogActivity.java

/**
 * Load the koopman(nen) that the selected vervanger can work for
 * @param id/*from   w ww  .  ja va 2 s .c o m*/
 * @param args
 * @return
 */
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {

    CursorLoader loader = new CursorLoader(this);
    loader.setUri(MakkelijkeMarktProvider.mUriVervangerJoined);
    loader.setSelection(MakkelijkeMarktProvider.mTableVervanger + "."
            + MakkelijkeMarktProvider.Vervanger.COL_VERVANGER_ID + " = ? ");
    loader.setSelectionArgs(new String[] { String.valueOf(mVervangerId) });

    return loader;
}

From source file:com.readystatesoftware.chuck.internal.ui.TransactionListFragment.java

@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    CursorLoader loader = new CursorLoader(getContext());
    loader.setUri(ChuckContentProvider.TRANSACTION_URI);
    if (!TextUtils.isEmpty(currentFilter)) {
        if (TextUtils.isDigitsOnly(currentFilter)) {
            loader.setSelection("responseCode LIKE ?");
            loader.setSelectionArgs(new String[] { currentFilter + "%" });
        } else {//from  w  w w . java  2s  .c o  m
            loader.setSelection("path LIKE ?");
            loader.setSelectionArgs(new String[] { "%" + currentFilter + "%" });
        }
    }
    loader.setProjection(HttpTransaction.PARTIAL_PROJECTION);
    loader.setSortOrder("requestDate DESC");
    return loader;
}

From source file:com.readystatesoftware.chuck.internal.ui.TransactionActivity.java

@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    CursorLoader loader = new CursorLoader(this);
    loader.setUri(ContentUris.withAppendedId(ChuckContentProvider.TRANSACTION_URI, transactionId));
    return loader;
}

From source file:com.amsterdam.marktbureau.makkelijkemarkt.DrawerFragment.java

/**
 * Create a loader to get the total amount of dagvergunnigen for today
 * @param id/* w w  w.  j av a2  s.  c om*/
 * @param args
 * @return
 */
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {

    // get the id of selected markt from the shared preferences
    SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(getContext());
    int marktId = settings.getInt(getContext().getString(R.string.sharedpreferences_key_markt_id), 0);

    // get the date of today for the dag param
    SimpleDateFormat dagSdf = new SimpleDateFormat(getString(R.string.date_format_dag));
    String dag = dagSdf.format(new Date());

    // create the loader
    CursorLoader loader = new CursorLoader(getActivity());
    loader.setUri(MakkelijkeMarktProvider.mUriDagvergunning);
    loader.setSelection(MakkelijkeMarktProvider.Dagvergunning.COL_MARKT_ID + " = ? AND "
            + MakkelijkeMarktProvider.Dagvergunning.COL_DAG + " = ? ");
    loader.setSelectionArgs(new String[] { String.valueOf(marktId), dag });

    return loader;
}

From source file:sample.multithreading.ThumbnailFragment.java

public Loader<Cursor> onCreateLoader(int loaderID, Bundle bundle) {
    CursorLoader cl = new CursorLoader(getActivity());
    cl.setUri(PicasaContentDB.getUriByType(getActivity(), PicasaContentDB.METADATA_QUERY));
    cl.setProjection(PROJECTION);//ww  w . j a  v  a  2  s  .  c o m
    return cl;
}

From source file:ca.marklauman.dominionpicker.SupplyActivity.java

@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    // Display the loading icon, hide the resources
    resView.setVisibility(View.GONE);
    adapter.changeCursor(null);//from   ww w.  j a v  a 2s .  c  o  m

    // Basic loader
    CursorLoader c = new CursorLoader(this);
    c.setUri(CardList.URI);

    // Selection string (sql WHERE clause)
    String sel = "";
    for (long ignored : supply.cards)
        sel += " OR " + CardList._ID + "=?";
    sel = sel.substring(4);
    c.setSelection(sel);

    // Selection arguments (the numbers)
    String[] selArgs = new String[supply.cards.length];
    for (int i = 0; i < supply.cards.length; i++)
        selArgs[i] = "" + supply.cards[i];
    c.setSelectionArgs(selArgs);

    return c;
}

From source file:ca.marklauman.dominionpicker.MarketActivity.java

@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    CursorLoader c = new CursorLoader(this);
    c.setUri(CardList.URI);
    String[] strChoices = new String[choices.length];
    for (int i = 0; i < choices.length; i++)
        strChoices[i] = "" + choices[i];
    c.setSelectionArgs(strChoices);/*from   w  w w  .j av a2 s .c om*/
    String selection = "";
    for (long ignored : choices)
        selection += " OR " + CardList._ID + "=?";
    c.setSelection(selection.substring(4));
    return c;
}

From source file:com.amsterdam.marktbureau.makkelijkemarkt.DagvergunningenFragment.java

/**
 * Create a cursor loader to get the dagvergunningen from the db
 * @param id unique id for this loader/*ww w.j a va2  s  .  c o m*/
 * @param args the markt id and dag arguments for setting the selection
 * @return a cursor loader ready to be started
 */
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {

    // create the loader that will load the dagvergunningen with joined table data for selected
    // markt for today sorted descending on aanmaak tijd
    CursorLoader loader = new CursorLoader(getActivity());
    loader.setUri(MakkelijkeMarktProvider.mUriDagvergunningJoined);
    loader.setSelection(MakkelijkeMarktProvider.mTableDagvergunning + "."
            + MakkelijkeMarktProvider.Dagvergunning.COL_MARKT_ID + " = ? AND "
            + MakkelijkeMarktProvider.Dagvergunning.COL_DAG + " = ?");
    loader.setSelectionArgs(
            new String[] { args.getString(getString(R.string.sharedpreferences_key_markt_id), null),
                    args.getString(getString(R.string.sharedpreferences_key_date_today), "") });
    loader.setSortOrder(MakkelijkeMarktProvider.Dagvergunning.COL_AANMAAK_DATUMTIJD + " DESC");

    return loader;
}