Search in sources :

Example 16 with Builder

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();
}
Also used : Builder(android.net.Uri.Builder) Uri(android.net.Uri)

Example 17 with Builder

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;
}
Also used : Builder(android.net.Uri.Builder) Uri(android.net.Uri)

Example 18 with Builder

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();
}
Also used : Builder(android.net.Uri.Builder) Uri(android.net.Uri)

Example 19 with Builder

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));
}
Also used : ContentValues(android.content.ContentValues) Builder(android.net.Uri.Builder)

Example 20 with Builder

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);
}
Also used : ContentValues(android.content.ContentValues) Uri(android.net.Uri) Builder(android.net.Uri.Builder)

Aggregations

Builder (android.net.Uri.Builder)35 Uri (android.net.Uri)27 ContentValues (android.content.ContentValues)5 Cursor (android.database.Cursor)5 Intent (android.content.Intent)2 SpannableString (android.text.SpannableString)2 ContactListFilter (com.android.contacts.common.list.ContactListFilter)2 AlertDialog (android.app.AlertDialog)1 ContentResolver (android.content.ContentResolver)1 GeneralSecurityException (java.security.GeneralSecurityException)1 ArrayList (java.util.ArrayList)1 Contact (org.awesomeapp.messenger.model.Contact)1