Search in sources :

Example 6 with Builder

use of android.net.Uri.Builder in project devbricks by dailystudio.

the class ProviderUriBuilder method attachSerialParamter.

private static Uri attachSerialParamter(Uri uri, String serial) {
    if (uri == null || serial == null) {
        return uri;
    }
    Builder builder = uri.buildUpon();
    if (builder == null) {
        return uri;
    }
    builder.appendQueryParameter(ProviderQueryUriParser.QUERY_KEY_SERIAL, serial);
    return builder.build();
}
Also used : Builder(android.net.Uri.Builder)

Example 7 with Builder

use of android.net.Uri.Builder in project devbricks by dailystudio.

the class ProviderUriBuilder method attachCreateTableParamter.

public static Uri attachCreateTableParamter(Uri uri, String createTabelParamter) {
    if (uri == null || createTabelParamter == null) {
        return uri;
    }
    Builder builder = uri.buildUpon();
    if (builder == null) {
        return uri;
    }
    builder.appendQueryParameter(ProviderQueryUriParser.QUERY_KEY_CREATE_TABLE, createTabelParamter);
    return builder.build();
}
Also used : Builder(android.net.Uri.Builder)

Example 8 with Builder

use of android.net.Uri.Builder in project Zom-Android by zom.

the class Imps method isUnencrypted.

public static boolean isUnencrypted(Context context) {
    try {
        Cursor cursor = null;
        Uri uri = Imps.Provider.CONTENT_URI_WITH_ACCOUNT;
        Builder builder = uri.buildUpon();
        builder.appendQueryParameter(ImApp.CACHEWORD_PASSWORD_KEY, "");
        builder = builder.appendQueryParameter(ImApp.NO_CREATE_KEY, "1");
        uri = builder.build();
        cursor = context.getContentResolver().query(uri, null, Imps.Provider.CATEGORY + "=?", /* selection */
        new String[] { ImApp.IMPS_CATEGORY }, /* selection args */
        null);
        if (cursor != null) {
            cursor.close();
            return true;
        } else {
            return false;
        }
    } catch (Exception e) {
        // Only complain if we thought this password should succeed
        Log.e(ImApp.LOG_TAG, e.getMessage(), e);
        // needs to be unlocked
        return false;
    }
}
Also used : Builder(android.net.Uri.Builder) Cursor(android.database.Cursor) Uri(android.net.Uri)

Example 9 with Builder

use of android.net.Uri.Builder in project Zom-Android by zom.

the class Imps method setEmptyPassphrase.

public static boolean setEmptyPassphrase(Context ctx, boolean noCreate) {
    String pkey = "";
    Uri uri = Provider.CONTENT_URI_WITH_ACCOUNT;
    Builder builder = uri.buildUpon().appendQueryParameter(ImApp.CACHEWORD_PASSWORD_KEY, pkey);
    if (noCreate) {
        builder.appendQueryParameter(ImApp.NO_CREATE_KEY, "1");
    }
    uri = builder.build();
    Cursor cursor = ctx.getContentResolver().query(uri, null, null, null, null);
    if (cursor != null) {
        cursor.close();
        return true;
    }
    return false;
}
Also used : Builder(android.net.Uri.Builder) Cursor(android.database.Cursor) Uri(android.net.Uri)

Example 10 with Builder

use of android.net.Uri.Builder in project Zom-Android by zom.

the class ContactListManagerAdapter method removeObsoleteContactsAndLists.

private void removeObsoleteContactsAndLists() {
    // remove all contacts for this provider & account which have not been
    // added since login, yet still exist in db from a prior login
    Exclusion exclusion = new Exclusion(Imps.Contacts.USERNAME, mValidatedContacts);
    mResolver.delete(mContactUrl, exclusion.getSelection(), exclusion.getSelectionArgs());
    // remove all blocked contacts for this provider & account which have not been
    // added since login, yet still exist in db from a prior login
    exclusion = new Exclusion(Imps.BlockedList.USERNAME, mValidatedBlockedContacts);
    Uri.Builder builder = Imps.BlockedList.CONTENT_URI.buildUpon();
    ContentUris.appendId(builder, mConn.getProviderId());
    ContentUris.appendId(builder, mConn.getAccountId());
    Uri uri = builder.build();
    mResolver.delete(uri, exclusion.getSelection(), exclusion.getSelectionArgs());
    // remove all contact lists for this provider & account which have not been
    // added since login, yet still exist in db from a prior login
    exclusion = new Exclusion(Imps.ContactList.NAME, mValidatedContactLists);
    builder = Imps.ContactList.CONTENT_URI.buildUpon();
    ContentUris.appendId(builder, mConn.getProviderId());
    ContentUris.appendId(builder, mConn.getAccountId());
    uri = builder.build();
    mResolver.delete(uri, exclusion.getSelection(), exclusion.getSelectionArgs());
}
Also used : 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