use of android.net.Uri.Builder in project devbricks by dailystudio.
the class ProviderUriBuilder method buildCommandUri.
public static Uri buildCommandUri(String authority, Class<? extends DatabaseObject> klass, int version, String command) {
if (authority == null || klass == null || version < 0 || command == null) {
return null;
}
Uri baseUri = Uri.parse("content://" + authority);
if (baseUri == null) {
return null;
}
Builder builder = baseUri.buildUpon();
if (builder == null) {
return null;
}
final String database = DatabaseObject.classToDatabase(klass);
final String table = DatabaseObject.classToTable(klass);
if (database == null || table == null) {
return null;
}
builder.appendPath(ProviderCommandUriParser.BASE_COMMAND);
builder.appendPath(database);
builder.appendPath(String.valueOf(version));
builder.appendPath(table);
builder.appendPath(command);
return builder.build();
}
use of android.net.Uri.Builder in project devbricks by dailystudio.
the class ProviderUriBuilder method buildQueryUri.
public static Uri buildQueryUri(String authority, Class<? extends DatabaseObject> klass, int version, long serial, boolean cursorOnly) {
if (authority == null || klass == null || version < 0) {
return null;
}
Uri baseUri = Uri.parse("content://" + authority);
if (baseUri == null) {
return null;
}
Builder builder = baseUri.buildUpon();
if (builder == null) {
return null;
}
final String database = DatabaseObject.classToDatabase(klass);
final String table = DatabaseObject.classToTable(klass);
if (database == null || table == null) {
return null;
}
builder.appendPath(cursorOnly ? ProviderQueryUriParser.BASE_QUERY_CURSOR : ProviderQueryUriParser.BASE_QUERY);
builder.appendPath(database);
builder.appendPath(String.valueOf(version));
builder.appendPath(table);
// if (serial > 0) {
// builder.appendPath(String.valueOf(serial));
// }
Uri uri = builder.build();
if (uri == null) {
return null;
}
if (serial > 0) {
uri = attachSerialParamter(uri, String.valueOf(serial));
}
return uri;
}
use of android.net.Uri.Builder in project android_packages_apps_Dialer by LineageOS.
the class HttpFetcher method obfuscateUrl.
private static String obfuscateUrl(String urlString) {
final Uri uri = Uri.parse(urlString);
final Builder builder = new Builder().scheme(uri.getScheme()).authority(uri.getAuthority()).path(uri.getPath());
final Set<String> names = uri.getQueryParameterNames();
for (String name : names) {
if (PARAM_ACCESS_TOKEN.equals(name)) {
builder.appendQueryParameter(name, "token");
} else {
final String value = uri.getQueryParameter(name);
if (PARAM_ID.equals(name)) {
builder.appendQueryParameter(name, MoreStrings.toSafeString(value));
} else {
builder.appendQueryParameter(name, value);
}
}
}
return builder.toString();
}
use of android.net.Uri.Builder in project Zom-Android by zom.
the class ContactListManagerAdapter method seedInitialPresences.
private void seedInitialPresences() {
Builder builder = Imps.Presence.SEED_PRESENCE_BY_ACCOUNT_CONTENT_URI.buildUpon();
ContentUris.appendId(builder, mConn.getAccountId());
mResolver.insert(builder.build(), new ContentValues(0));
}
use of android.net.Uri.Builder in project Zom-Android by zom.
the class ContactListManagerAdapter method insertBlockedContactToDataBase.
void insertBlockedContactToDataBase(Contact contact) {
// Remove the blocked contact if it already exists, to avoid duplicates and
// handle the odd case where a blocked contact's nickname has changed
removeBlockedContactFromDataBase(contact);
Uri.Builder builder = Imps.BlockedList.CONTENT_URI.buildUpon();
ContentUris.appendId(builder, mConn.getProviderId());
ContentUris.appendId(builder, mConn.getAccountId());
Uri uri = builder.build();
String username = mAdaptee.normalizeAddress(contact.getAddress().getAddress());
ContentValues values = new ContentValues(2);
values.put(Imps.BlockedList.USERNAME, username);
values.put(Imps.BlockedList.NICKNAME, contact.getName());
mResolver.insert(uri, values);
mValidatedBlockedContacts.add(username);
}
Aggregations