use of android.net.Uri.Builder in project DroidPlugin by DroidPluginTeam.
the class AbstractContentProviderStub method buildNewUri.
private Uri buildNewUri(Uri uri, String targetAuthority) {
Uri.Builder b = new Builder();
b.scheme(uri.getScheme());
b.authority(targetAuthority);
b.path(uri.getPath());
if (VERSION.SDK_INT >= VERSION_CODES.HONEYCOMB) {
Set<String> names = uri.getQueryParameterNames();
if (names != null && names.size() > 0) {
for (String name : names) {
if (!TextUtils.equals(name, Env.EXTRA_TARGET_AUTHORITY)) {
b.appendQueryParameter(name, uri.getQueryParameter(name));
}
}
}
} else {
b.query(uri.getQuery());
}
b.fragment(uri.getFragment());
return b.build();
}
use of android.net.Uri.Builder in project android_packages_apps_Dialer by LineageOS.
the class DefaultContactListAdapter method configureLoader.
@Override
public void configureLoader(CursorLoader loader, long directoryId) {
String sortOrder = null;
if (isSearchMode()) {
String query = getQueryString();
if (query == null) {
query = "";
}
query = query.trim();
if (TextUtils.isEmpty(query)) {
// Regardless of the directory, we don't want anything returned,
// so let's just send a "nothing" query to the local directory.
loader.setUri(Contacts.CONTENT_URI);
loader.setProjection(getProjection(false));
loader.setSelection("0");
} else {
final Builder builder = ContactsCompat.getContentUri().buildUpon();
appendSearchParameters(builder, query, directoryId);
loader.setUri(builder.build());
loader.setProjection(getProjection(true));
}
} else {
final ContactListFilter filter = getFilter();
configureUri(loader, directoryId, filter);
loader.setProjection(getProjection(false));
configureSelection(loader, directoryId, filter);
}
if (getSortOrder() == ContactsPreferences.SORT_ORDER_PRIMARY) {
if (sortOrder == null) {
sortOrder = Contacts.SORT_KEY_PRIMARY;
} else {
sortOrder += ", " + Contacts.SORT_KEY_PRIMARY;
}
} else {
if (sortOrder == null) {
sortOrder = Contacts.SORT_KEY_ALTERNATIVE;
} else {
sortOrder += ", " + Contacts.SORT_KEY_ALTERNATIVE;
}
}
loader.setSortOrder(sortOrder);
}
use of android.net.Uri.Builder in project android_packages_apps_Dialer by LineageOS.
the class ContactPhotoManager method appendBusinessContactType.
/**
* Adds a business contact type encoded fragment to the URL. Used to ensure photo URLS from Nearby
* Places can be identified as business photo URLs rather than URLs for personal contact photos.
*
* @param photoUrl The photo URL to modify.
* @return URL with the contact type parameter added and set to TYPE_BUSINESS.
*/
public static String appendBusinessContactType(String photoUrl) {
Uri uri = Uri.parse(photoUrl);
Builder builder = uri.buildUpon();
builder.encodedFragment(String.valueOf(LetterTileDrawable.TYPE_BUSINESS));
return builder.build().toString();
}
use of android.net.Uri.Builder in project android_packages_apps_Dialer by LineageOS.
the class ContactPhotoManager method removeContactType.
/**
* Removes the contact type information stored in the photo URI encoded fragment.
*
* @param photoUri The photo URI to remove the contact type from.
* @return The photo URI with contact type removed.
*/
public static Uri removeContactType(Uri photoUri) {
String encodedFragment = photoUri.getEncodedFragment();
if (!TextUtils.isEmpty(encodedFragment)) {
Builder builder = photoUri.buildUpon();
builder.encodedFragment(null);
return builder.build();
}
return photoUri;
}
use of android.net.Uri.Builder in project devbricks by dailystudio.
the class ProviderUriBuilder method buildResultUri.
public static Uri buildResultUri(String authority, String database, int version, String table, long rowId) {
if (authority == null || database == null || table == null) {
return null;
}
Uri baseUri = Uri.parse("content://" + authority);
if (baseUri == null) {
return null;
}
Builder builder = baseUri.buildUpon();
if (builder == null) {
return null;
}
builder.appendPath(ProviderResultUriParser.BASE_RESULT);
builder.appendPath(database);
builder.appendPath(String.valueOf(version));
builder.appendPath(table);
if (rowId > 0) {
builder.appendPath(String.valueOf(rowId));
}
return builder.build();
}
Aggregations