Example usage for android.net Uri withAppendedPath

List of usage examples for android.net Uri withAppendedPath

Introduction

In this page you can find the example usage for android.net Uri withAppendedPath.

Prototype

public static Uri withAppendedPath(Uri baseUri, String pathSegment) 

Source Link

Document

Creates a new Uri by appending an already-encoded path segment to a base Uri.

Usage

From source file:com.innoc.secureline.contacts.ContactAccessor.java

public CursorLoader getRegisteredFavoritesCursor(Context context, String filter) {
    Uri uri = Uri.withAppendedPath(Phone.CONTENT_FILTER_URI, Uri.encode(filter));
    return getRegisteredFavoritesCursor(context, uri);
}

From source file:org.thoughtcrime.securesms.contacts.ContactAccessorNewApi.java

@Override
public List<String> getNumbersForThreadSearchFilter(String constraint, ContentResolver contentResolver) {
    LinkedList<String> numberList = new LinkedList<String>();
    Cursor cursor = null;//ww w  .j  a va  2  s . c  o  m

    try {
        cursor = contentResolver.query(Uri.withAppendedPath(Phone.CONTENT_FILTER_URI, Uri.encode(constraint)),
                null, null, null, null);

        while (cursor != null && cursor.moveToNext())
            numberList.add(cursor.getString(cursor.getColumnIndexOrThrow(Phone.NUMBER)));

    } finally {
        if (cursor != null)
            cursor.close();
    }

    return numberList;
}

From source file:org.noorganization.instalistsynch.controller.local.dba.impl.ClientLogDbController.java

@Override
public Cursor getLogs() {
    return mContentResolver.query(Uri.withAppendedPath(InstalistProvider.BASE_CONTENT_URI, "log"),
            LogInfo.COLUMN.ALL_COLUMNS, null, null, LogInfo.COLUMN.ACTION_DATE + " DESC ");
}

From source file:org.jamienicol.episodes.ShowNotesFragment.java

@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    final int showId = args.getInt("showId");
    final Uri uri = Uri.withAppendedPath(ShowsProvider.CONTENT_URI_SHOWS, String.valueOf(showId));
    final String[] projection = { ShowsTable.COLUMN_NOTES };
    return new CursorLoader(getActivity(), uri, projection, null, null, null);
}

From source file:cz.maresmar.sfm.view.credential.LoginListActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login_list);

    mUserUri = getIntent().getData();//  w  w w. j ava 2 s .  c  o m
    mPortalsUri = Uri.withAppendedPath(mUserUri, ProviderContract.PORTAL_PATH);

    // Toolbar
    Toolbar toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    mRecyclerView = findViewById(R.id.credential_list);
    setupRecyclerView(mRecyclerView);

    FloatingActionButton fab = findViewById(R.id.main_discard_fab);
    fab.setOnClickListener((View v) -> startPortalPickerActivity());

    // Prepare empty view
    mEmptyView = findViewById(R.id.empty_content);
    ((TextView) findViewById(R.id.empty_description_text)).setText(R.string.empty_try_to_add_credential);

    String intentAction = getIntent().getAction();
    if (intentAction == null) {
        intentAction = "null";
    }
    switch (intentAction) {
    case Intent.ACTION_VIEW:
        break;
    case Intent.ACTION_INSERT:
        startPortalPickerActivity();
        break;
    default:
        throw new UnsupportedOperationException("Unknown intent action " + intentAction);
    }
}

From source file:com.noshufou.android.su.service.ResultService.java

@Override
protected void onHandleIntent(Intent intent) {
    switch (intent.getIntExtra(EXTRA_ACTION, 0)) {
    case ACTION_RESULT:
        ensurePrefs();/*from   ww  w  .  j  a  va  2  s .c o  m*/
        int callerUid = intent.getIntExtra(SuRequestReceiver.EXTRA_CALLERUID, 0);
        int allow = intent.getIntExtra(SuRequestReceiver.EXTRA_ALLOW, -1);
        String cmd = intent.getStringExtra(SuRequestReceiver.EXTRA_CMD);
        long currentTime = System.currentTimeMillis();

        long appId = -1;
        String appNotify = null;
        String appLog = null;

        // get what we need from the database
        Cursor c = getContentResolver().query(Uri.withAppendedPath(Apps.CONTENT_URI, "uid/" + callerUid),
                PROJECTION, Apps.EXEC_CMD + "=?", new String[] { cmd }, null);
        if (c != null && c.moveToFirst()) {
            appId = c.getLong(COLUMN_ID);
            appNotify = c.getString(COLUMN_NOTIFICATIONS);
            appLog = c.getString(COLUMN_LOGGING);
        }
        c.close();

        sendNotification(appId, callerUid, allow, currentTime, appNotify);
        addLog(appId, callerUid, intent.getIntExtra(SuRequestReceiver.EXTRA_UID, 0), cmd, allow, currentTime,
                appLog, intent.getIntExtra("all", 0));
        // No break statement here so that we can fall through and recycle the log
    case ACTION_RECYCLE:
        recycle();
        break;
    default:
        throw new IllegalArgumentException();
    }
}

From source file:org.noorganization.instalistsynch.controller.local.dba.impl.ClientLogDbController.java

@Override
public Cursor getLogsSince(String _date, eModelType _modelType) {
    return mContentResolver.query(Uri.withAppendedPath(InstalistProvider.BASE_CONTENT_URI, "log"),
            LogInfo.COLUMN.ALL_COLUMNS,/*from  www.j  a v a2s . c om*/
            LogInfo.COLUMN.MODEL + " = ? AND " + LogInfo.COLUMN.ACTION_DATE + " >=  ? ",
            new String[] { String.valueOf(_modelType.ordinal()), _date }, LogInfo.COLUMN.ACTION_DATE + " ASC ");
}

From source file:org.sufficientlysecure.keychain.ui.keyview.presenter.SystemContactPresenter.java

private static void launchAndroidContactActivity(long contactId, Context context) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    Uri uri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_URI, String.valueOf(contactId));
    intent.setData(uri);/* w  ww. j  ava 2  s.  co m*/
    context.startActivity(intent);
}

From source file:com.kyakujin.android.autoeco.ui.ManualFragment.java

@Override
public Loader<Cursor> onCreateLoader(int id, Bundle arg) {
    switch (id) {
    case ManualQuery.LOADER_ID:
        return new CursorLoader(getActivity(),
                Uri.withAppendedPath(ManualTbl.CONTENT_URI, String.valueOf(mCurrentManualId)),
                ManualQuery.PROJECTION, null, null, null);
    default:/*  w  w  w .j a  v a2  s.  c o m*/
        break;
    }
    return null;
}

From source file:org.jamienicol.episodes.EpisodeDetailsFragment.java

public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final View view = inflater.inflate(R.layout.episode_details_fragment, container, false);

    rootView = view.findViewById(R.id.root);
    titleView = (TextView) view.findViewById(R.id.title);
    overviewView = (TextView) view.findViewById(R.id.overview);
    dateView = (TextView) view.findViewById(R.id.date);
    watchedCheckBox = (CheckBox) view.findViewById(R.id.watched);
    watchedCheckBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            final ContentResolver contentResolver = getActivity().getContentResolver();
            final AsyncQueryHandler handler = new AsyncQueryHandler(contentResolver) {
            };//from  ww  w .ja  v  a2s.com

            final Uri episodeUri = Uri.withAppendedPath(ShowsProvider.CONTENT_URI_EPISODES,
                    String.valueOf(episodeId));

            final ContentValues episodeValues = new ContentValues();
            episodeValues.put(EpisodesTable.COLUMN_WATCHED, isChecked);

            handler.startUpdate(0, null, episodeUri, episodeValues, null, null);
        }
    });

    return view;
}