Search in sources :

Example 21 with Builder

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

the class ContactListManagerAdapter method removeBlockedContactFromDataBase.

void removeBlockedContactFromDataBase(Contact contact) {
    String address = mAdaptee.normalizeAddress(contact.getAddress().getAddress());
    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, Imps.BlockedList.USERNAME + "=?", new String[] { address });
    // int type = isTemporary(address) ? Imps.Contacts.TYPE_TEMPORARY : Imps.Contacts.TYPE_NORMAL;
    updateContactType(address, Imps.Contacts.TYPE_NORMAL);
}
Also used : Uri(android.net.Uri) Builder(android.net.Uri.Builder)

Example 22 with Builder

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

the class ContactListManagerAdapter method init.

private void init() {
    mContactListListenerAdapter = new ContactListListenerAdapter();
    mSubscriptionListenerAdapter = new SubscriptionRequestListenerAdapter();
    mContactLists = new HashMap<String, ContactListAdapter>();
    mTemporaryContacts = new HashMap<String, Contact>();
    // mOfflineContacts = new HashMap<String, Contact>();
    mValidatedContacts = new HashSet<String>();
    mValidatedContactLists = new HashSet<String>();
    mValidatedBlockedContacts = new HashSet<String>();
    mAdaptee.addContactListListener(mContactListListenerAdapter);
    mAdaptee.setSubscriptionRequestListener(mSubscriptionListenerAdapter);
    Uri.Builder builder = Imps.Avatars.CONTENT_URI_AVATARS_BY.buildUpon();
    ContentUris.appendId(builder, mConn.getProviderId());
    ContentUris.appendId(builder, mConn.getAccountId());
    mAvatarUrl = builder.build();
    builder = Imps.Contacts.CONTENT_URI_CONTACTS_BY.buildUpon();
    ContentUris.appendId(builder, mConn.getProviderId());
    ContentUris.appendId(builder, mConn.getAccountId());
    mContactUrl = builder.build();
    if (mConn.getAccountId() != -1)
        seedInitialPresences();
}
Also used : Uri(android.net.Uri) Builder(android.net.Uri.Builder) Contact(org.awesomeapp.messenger.model.Contact)

Example 23 with Builder

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

the class RouterActivity method cursorUnlocked.

@SuppressWarnings("deprecation")
private boolean cursorUnlocked() {
    try {
        Uri uri = Imps.Provider.CONTENT_URI_WITH_ACCOUNT;
        Builder builder = uri.buildUpon();
        /**
         *            if (pKey != null)
         *                builder.appendQueryParameter(ImApp.CACHEWORD_PASSWORD_KEY, pKey);
         *            if (!allowCreate)
         *                builder = builder.appendQueryParameter(ImApp.NO_CREATE_KEY, "1");
         */
        uri = builder.build();
        mProviderCursor = managedQuery(uri, PROVIDER_PROJECTION, Imps.Provider.CATEGORY + "=?", /* selection */
        new String[] { ImApp.IMPS_CATEGORY }, /* selection args */
        Imps.Provider.DEFAULT_SORT_ORDER);
        if (mProviderCursor != null) {
            ImPluginHelper.getInstance(this).loadAvailablePlugins();
            mProviderCursor.moveToFirst();
            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);
        Toast.makeText(this, getString(R.string.error_welcome_database), Toast.LENGTH_LONG).show();
        finish();
        // needs to be unlocked
        return false;
    }
}
Also used : Builder(android.net.Uri.Builder) Uri(android.net.Uri) GeneralSecurityException(java.security.GeneralSecurityException)

Example 24 with Builder

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

the class Imps method updateConfirmInDb.

public static int updateConfirmInDb(ContentResolver resolver, long threadId, String msgId, boolean isDelivered) {
    Uri.Builder builder = Imps.Messages.OTR_MESSAGES_CONTENT_URI_BY_PACKET_ID.buildUpon();
    builder.appendPath(msgId);
    ContentValues values = new ContentValues(1);
    values.put(Imps.Messages.IS_DELIVERED, isDelivered);
    values.put(Messages.THREAD_ID, threadId);
    int result = resolver.update(builder.build(), values, null, null);
    if (result == 0) {
        builder = Messages.CONTENT_URI_MESSAGES_BY_PACKET_ID.buildUpon();
        builder.appendPath(msgId);
        result = resolver.update(builder.build(), values, null, null);
    }
    return result;
}
Also used : ContentValues(android.content.ContentValues) Uri(android.net.Uri) Builder(android.net.Uri.Builder)

Example 25 with Builder

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

the class Imps method isUnlocked.

public static boolean isUnlocked(Context context) {
    try {
        Cursor cursor = null;
        Uri uri = Imps.Provider.CONTENT_URI_WITH_ACCOUNT;
        Builder builder = uri.buildUpon();
        builder = builder.appendQueryParameter(ImApp.NO_CREATE_KEY, "1");
        uri = builder.build();
        cursor = context.getContentResolver().query(uri, null, null, null, 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)

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