List of usage examples for android.net Uri withAppendedPath
public static Uri withAppendedPath(Uri baseUri, String pathSegment)
From source file:it.sineo.android.tileMapEditor.HomeActivity.java
@Override public boolean onContextItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.home_ctx_menu_delete: { AdapterContextMenuInfo cmi = (AdapterContextMenuInfo) item.getMenuInfo(); Uri mapUri = Uri.withAppendedPath(C.CONTENT_URI, Long.toString(cmi.id)); getContentResolver().delete(mapUri, null, null); return true; }/*w w w.j a v a 2 s.com*/ default: return super.onContextItemSelected(item); } }
From source file:org.andrico.andrico.facebook.FBBase.java
public Uri authorizeLoginUrl(String authToken) { return Uri.withAppendedPath(WWW_URI, "login.php?" + authorizationParameters(authToken)); }
From source file:org.odk.collect.android.utilities.MediaUtils.java
public static final Uri getAudioUriFromMediaProvider(String audioFile) { String selection = Audio.AudioColumns.DATA + "=?"; String[] selectArgs = { audioFile }; String[] projection = { Audio.AudioColumns._ID }; Cursor c = null;/*from ww w . j av a 2 s .c om*/ try { c = Collect.getInstance().getContentResolver().query( android.provider.MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, projection, selection, selectArgs, null); if (c.getCount() > 0) { c.moveToFirst(); String id = c.getString(c.getColumnIndex(Audio.AudioColumns._ID)); return Uri.withAppendedPath(android.provider.MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, id); } return null; } finally { if (c != null) { c.close(); } } }
From source file:com.futureplatforms.kirin.extensions.localnotifications.LocalNotificationsBackend.java
public Intent createIntentForSchedule(String idString) { Intent intent = new Intent(mContext, LocalNotificationAlarmReceiver.class); // Determine if two intents are the same for the purposes of // intent resolution (filtering). // That is, if their action, data, type, class, and categories are the // same.// www . j av a 2s .c o m // This does not compare any extra data included in the intents. intent.setData(Uri.withAppendedPath(BASE_URI_NOTIFICATION, idString)); intent.setAction(C.ACTION_LOCAL_NOTIFICATION); return intent; }
From source file:org.pixmob.droidlink.ui.EventsFragment.java
@Override public void onListItemClick(ListView l, View v, int position, long id) { super.onListItemClick(l, v, position, id); l.setItemChecked(position, true);// w ww . j a va2 s . co m final String eventId = (String) v.getTag(EventCursorAdapter.TAG_ID); Log.i(TAG, "Opening event details for " + eventId); final Uri eventUri = Uri.withAppendedPath(EventsContract.CONTENT_URI, eventId); if (selectionListenerRef != null) { final OnEventSelectionListener selectionListener = selectionListenerRef.get(); if (selectionListener != null) { try { selectionListener.onEventSelected(eventUri); } catch (Exception e) { Log.e(TAG, "Event selection listener error", e); } } } }
From source file:com.appjma.appdeployer.AppFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.app_fragment, container, false); mTokenFormat = getString(R.string.app_token_format); mGuidFormat = getString(R.string.app_guid_format); mListView = (ListView) view.findViewById(android.R.id.list); mProgressBar = view.findViewById(android.R.id.progress); mEmptyView = view.findViewById(android.R.id.empty); mErrorReporter = new ErrorReporter(getActivity(), view, AppContract.AppVersions.CONTENT_URI); Bitmap placeHolder = BitmapFactory.decodeResource(getResources(), R.drawable.placeholder); mRemoteImageLoader = RemoteImageLoader.createUsingDp(getActivity(), placeHolder, IMAGE_SIZE_DP, IMAGE_SIZE_DP);/*w w w .java 2 s . co m*/ mDownloadHelper = new DownloadHelper(getActivity(), DownloadService.ACTION_SYNC, this, Uri.withAppendedPath(mUri, AppContract.AppVersions.CONTENT_PATH)); mListView.addHeaderView(createHeaderView(inflater)); mAdapter = new AppVersionsAdapter(getActivity(), this); mListView.setAdapter(mAdapter); LoaderManager lm = getLoaderManager(); lm.initLoader(LOADER_APP, null, this); lm.initLoader(LOADER_APP_VERSIONS, null, this); lm.initLoader(LOADER_DOWNLOADS, null, mLoaderCallback); setHasOptionsMenu(true); return view; }
From source file:org.jamienicol.episodes.ShowActivity.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_NAME, ShowsTable.COLUMN_STARRED, ShowsTable.COLUMN_ARCHIVED, ShowsTable.COLUMN_FANART_PATH }; return new CursorLoader(this, uri, projection, null, null, null); }
From source file:org.opendatakit.common.android.views.OdkCommon.java
/** * Return the base uri for the Tables app name with a trailing separator. * * @return// w w w. j av a 2 s . co m */ private String getBaseContentUri() { logDebug("getBaseContentUri()"); Uri contentUri = Uri.parse(mActivity.getWebViewContentUri()); String appName = mActivity.getAppName(); contentUri = Uri.withAppendedPath(contentUri, Uri.encode(appName)); return contentUri.toString() + "/"; }
From source file:com.owncloud.android.providers.UsersAndGroupsSearchProvider.java
private Cursor searchForUsersOrGroups(Uri uri) { MatrixCursor response = null;// w ww . j av a 2 s.c o m String userQuery = uri.getLastPathSegment().toLowerCase(); /// need to trust on the AccountUtils to get the current account since the query in the client side is not /// directly started by our code, but from SearchView implementation Account account = AccountUtils.getCurrentOwnCloudAccount(getContext()); /// request to the OC server about users and groups matching userQuery GetRemoteShareesOperation searchRequest = new GetRemoteShareesOperation(userQuery, REQUESTED_PAGE, RESULTS_PER_PAGE); RemoteOperationResult result = searchRequest.execute(account, getContext()); List<JSONObject> names = new ArrayList<JSONObject>(); if (result.isSuccess()) { for (Object o : result.getData()) { // Get JSonObjects from response names.add((JSONObject) o); } } else { showErrorMessage(result); } /// convert the responses from the OC server to the expected format if (names.size() > 0) { response = new MatrixCursor(COLUMNS); Iterator<JSONObject> namesIt = names.iterator(); int count = 0; JSONObject item; String displayName; Uri dataUri; Uri userBaseUri = new Uri.Builder().scheme("content").authority(DATA_USER).build(); Uri groupBaseUri = new Uri.Builder().scheme("content").authority(DATA_GROUP).build(); try { while (namesIt.hasNext()) { item = namesIt.next(); String userName = item.getString(GetRemoteShareesOperation.PROPERTY_LABEL); JSONObject value = item.getJSONObject(GetRemoteShareesOperation.NODE_VALUE); byte type = (byte) value.getInt(GetRemoteShareesOperation.PROPERTY_SHARE_TYPE); String shareWith = value.getString(GetRemoteShareesOperation.PROPERTY_SHARE_WITH); if (GetRemoteShareesOperation.GROUP_TYPE.equals(type)) { displayName = getContext().getString(R.string.share_group_clarification, userName); dataUri = Uri.withAppendedPath(groupBaseUri, shareWith); } else { displayName = userName; dataUri = Uri.withAppendedPath(userBaseUri, shareWith); } response.newRow().add(count++) // BaseColumns._ID .add(displayName) // SearchManager.SUGGEST_COLUMN_TEXT_1 .add(dataUri); } } catch (JSONException e) { Log_OC.e(TAG, "Exception while parsing data of users/groups", e); } } return response; }
From source file:com.frostwire.android.gui.views.ImageLoader.java
private Bitmap getBitmap(Context context, byte fileType, long id) { Bitmap bmp = null;//from w w w . j a v a2s . c o m try { ContentResolver cr = context.getContentResolver(); if (fileType == Constants.FILE_TYPE_PICTURES) { bmp = Images.Thumbnails.getThumbnail(cr, id, Images.Thumbnails.MICRO_KIND, null); } else if (fileType == Constants.FILE_TYPE_VIDEOS) { bmp = Video.Thumbnails.getThumbnail(cr, id, Video.Thumbnails.MICRO_KIND, null); } else if (fileType == Constants.FILE_TYPE_AUDIO) { bmp = MusicUtils.getArtwork(context, id, -1, 2); } else if (fileType == Constants.FILE_TYPE_APPLICATIONS) { InputStream is = cr.openInputStream( Uri.withAppendedPath(Applications.Media.CONTENT_URI_ITEM, String.valueOf(id))); bmp = BitmapFactory.decodeStream(is); is.close(); } } catch (Throwable e) { bmp = null; // ignore } return bmp; }