List of usage examples for android.net Uri buildUpon
public abstract Builder buildUpon();
From source file:edu.mit.mobile.android.locast.data.TaggableItem.java
/** * Given a base content URI of a taggable item and a list of tags, constructs a URI * representing all the items of the baseUri that match all the listed tags. * * @param baseUri a content URI of a TaggableItem * @param tags a collection of tags/*ww w . j a va 2 s. c o m*/ * @return a URI representing all the items that match all the given tags */ public static Uri getTagUri(Uri baseUri, Collection<String> tags) { if (tags.isEmpty()) { return baseUri; } final List<String> path = baseUri.getPathSegments(); // AUTHORITY/casts/tags if (path.size() >= 2 && Tag.PATH.equals(path.get(path.size() - 1))) { baseUri = ProviderUtils.removeLastPathSegment(baseUri); } return baseUri.buildUpon().appendQueryParameter(SERVER_QUERY_PARAMETER, Tag.toTagQuery(tags)).build(); }
From source file:com.android.mail.utils.NotificationActionUtils.java
private static Uri buildWearUri(Uri uri) { return uri.buildUpon().appendQueryParameter("type", "wear").build(); }
From source file:com.rukman.emde.smsgroups.platform.GMSContactOperations.java
private static Uri addCallerIsSyncAdapterParameter(Uri uri, boolean isSyncOperation) { if (isSyncOperation) { // If we're in the middle of a real sync-adapter operation, then go ahead // and tell the Contacts provider that we're the sync adapter. That // gives us some special permissions - like the ability to really // delete a contact, and the ability to clear the dirty flag. ///*www .j av a 2s.co m*/ // If we're not in the middle of a sync operation (for example, we just // locally created/edited a new contact), then we don't want to use // the special permissions, and the system will automagically mark // the contact as 'dirty' for us! return uri.buildUpon().appendQueryParameter(ContactsContract.CALLER_IS_SYNCADAPTER, "true").build(); } return uri; }
From source file:es.example.contacts.ui.ContactDetailFragment.java
private static Uri addCallerIsSyncAdapterParameter(Uri uri, boolean isSyncOperation) { if (isSyncOperation) { return uri.buildUpon().appendQueryParameter(ContactsContract.CALLER_IS_SYNCADAPTER, "true").build(); }//w w w.ja va 2 s. c o m return uri; }
From source file:com.google.android.gm.ay.java
public static void a(final Activity activity, final Account account, final String s) { final Uri build = Uri .parse(c.a(activity.getContentResolver(), "gmail_context_sensitive_help_url", "http://support.google.com/mail")) .buildUpon().appendPath("topic").appendPath(activity.getString(2131297018)).build(); final Locale default1 = Locale.getDefault(); final Uri build2 = build.buildUpon() .appendQueryParameter("hl", default1.getLanguage() + "_" + default1.getCountry().toLowerCase()) .build();/*from w w w.j a va 2s. c o m*/ final GoogleHelp a = GoogleHelp.gi(s).L(build2).h(GoogleHelp.j(activity)).z(g((Context) activity, account)) .a(2131558417, activity.getString(2131296702), h((Context) activity, build2)) .a(2131558418, activity.getString(2131297062), h((Context) activity, Uri.parse(c.a(activity.getContentResolver(), "gmail_privacy_policy_url", "https://www.google.com/policies/privacy/")))) .a(2131558419, activity.getString(2131297061), new Intent((Context) activity, (Class) LicenseActivity.class)) .a(2131558420, activity.getString(2131297063), h((Context) activity, Uri.parse(c.a(activity.getContentResolver(), "gmail_terms_of_service_url", "https://www.google.com/policies/terms/")))); if (account != null) { a.d(account.uf()); } new a(activity).e(a.QA()); }
From source file:org.quantumbadger.redreader.fragments.PostListingFragment.java
private static Uri setUriDownloadCount(final Uri input, final int count) { return input.buildUpon().appendQueryParameter("limit", String.valueOf(count)).build(); }
From source file:com.silentcircle.contacts.GroupMemberLoader.java
private Uri createUri() { Uri uri = Data.CONTENT_URI; uri = uri.buildUpon() .appendQueryParameter(ScContactsContract.DIRECTORY_PARAM_KEY, String.valueOf(Directory.DEFAULT)) .build();//from w ww . j a va 2 s. c o m return uri; }
From source file:com.jefftharris.passwdsafe.sync.GDriveLaunchActivity.java
@Override protected void onCreate(Bundle args) { super.onCreate(args); Intent intent = getIntent();//www . ja va 2 s.com String action = intent.getAction(); boolean doFinish = true; if (action.equals("com.google.android.apps.drive.DRIVE_OPEN")) { String fileId = intent.getStringExtra("resourceId"); PasswdSafeUtil.dbginfo(TAG, "Open GDrive file %s", fileId); Pair<DbProvider, DbFile> rc = getFile(fileId); if (rc != null) { Uri uri = PasswdSafeContract.Providers.CONTENT_URI; Uri.Builder builder = uri.buildUpon(); ContentUris.appendId(builder, rc.first.itsId); builder.appendPath(PasswdSafeContract.Files.TABLE); ContentUris.appendId(builder, rc.second.itsId); uri = builder.build(); PasswdSafeUtil.dbginfo(TAG, "uri %s", uri); Intent viewIntent = PasswdSafeUtil.createOpenIntent(uri, null); try { startActivity(viewIntent); } catch (ActivityNotFoundException e) { Log.e(TAG, "Can not open file", e); } } else { PasswdSafeUtil.showFatalMsg(getString(R.string.cant_launch_drive_file), this); doFinish = false; } } if (doFinish) { finish(); } }
From source file:com.he5ed.lib.cloudprovider.apis.BoxApi.java
/** * Build authorization url base on type of cloud service * * @return Uri/*from w ww . ja v a 2 s. co m*/ */ public static Uri buildAuthUri(String stateString) { Uri uri = Uri.parse(AUTH_URL); return uri.buildUpon().appendQueryParameter("response_type", "code") .appendQueryParameter("client_id", CLIENT_ID).appendQueryParameter("redirect_uri", REDIRECT_URL) .appendQueryParameter("state", stateString).build(); }
From source file:com.he5ed.lib.cloudprovider.apis.BoxApi.java
/** * Get current user information uri//from w w w .j a va 2 s. c o m * * @return Uri */ public static Uri getUserInfoUri() { Uri uri = Uri.parse(API_BASE_URL); return uri.buildUpon().appendEncodedPath("users/me").build(); }