Search in sources :

Example 26 with Builder

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

the class Imps method deleteMessageInDb.

public static int deleteMessageInDb(ContentResolver resolver, String id) {
    Uri.Builder builder = Messages.OTR_MESSAGES_CONTENT_URI_BY_PACKET_ID.buildUpon();
    builder.appendPath(id);
    int result = resolver.delete(builder.build(), null, null);
    if (result <= 0) {
        builder = Imps.Messages.CONTENT_URI_MESSAGES_BY_PACKET_ID.buildUpon();
        builder.appendPath(id);
        result = resolver.delete(builder.build(), null, null);
    }
    return result;
}
Also used : Uri(android.net.Uri) Builder(android.net.Uri.Builder)

Example 27 with Builder

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

the class Imps method messageExists.

public static boolean messageExists(ContentResolver resolver, String id) {
    boolean result = false;
    Uri.Builder builder = Messages.OTR_MESSAGES_CONTENT_URI_BY_PACKET_ID.buildUpon();
    builder.appendPath(id);
    Cursor c = resolver.query(builder.build(), null, null, null, null);
    if (c != null) {
        if (c.getCount() > 0)
            result = true;
        c.close();
    }
    return result;
}
Also used : Cursor(android.database.Cursor) Uri(android.net.Uri) Builder(android.net.Uri.Builder)

Example 28 with Builder

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

the class Imps method updateMessageBody.

public static int updateMessageBody(ContentResolver resolver, String id, String body, String mimeType) {
    Uri.Builder builder = Imps.Messages.OTR_MESSAGES_CONTENT_URI.buildUpon();
    builder.appendPath(id);
    ContentValues values = new ContentValues();
    values.put(Imps.Messages.BODY, body);
    if (mimeType != null)
        values.put(Imps.Messages.MIME_TYPE, mimeType);
    return resolver.update(builder.build(), values, null, null);
}
Also used : ContentValues(android.content.ContentValues) Uri(android.net.Uri) Builder(android.net.Uri.Builder)

Example 29 with Builder

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

the class Imps method updateMessageInDb.

public static int updateMessageInDb(ContentResolver resolver, String id, int type, long time, long contactId) {
    Uri.Builder builder = Imps.Messages.OTR_MESSAGES_CONTENT_URI_BY_PACKET_ID.buildUpon();
    builder.appendPath(id);
    ContentValues values = new ContentValues(2);
    values.put(Imps.Messages.TYPE, type);
    values.put(Imps.Messages.THREAD_ID, contactId);
    if (time != -1)
        values.put(Imps.Messages.DATE, time);
    int result = resolver.update(builder.build(), values, null, null);
    if (result == 0) {
        builder = Imps.Messages.CONTENT_URI_MESSAGES_BY_PACKET_ID.buildUpon();
        builder.appendPath(id);
        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 30 with Builder

use of android.net.Uri.Builder in project android_packages_apps_Dialer by LineageOS.

the class DefaultContactListAdapter method configureUri.

protected void configureUri(CursorLoader loader, long directoryId, ContactListFilter filter) {
    Uri uri = Contacts.CONTENT_URI;
    if (directoryId == Directory.DEFAULT && isSectionHeaderDisplayEnabled()) {
        uri = ContactListAdapter.buildSectionIndexerUri(uri);
    }
    // The "All accounts" filter is the same as the entire contents of Directory.DEFAULT
    if (filter != null && filter.filterType != ContactListFilter.FILTER_TYPE_CUSTOM && filter.filterType != ContactListFilter.FILTER_TYPE_SINGLE_CONTACT) {
        final Uri.Builder builder = uri.buildUpon();
        builder.appendQueryParameter(ContactsContract.DIRECTORY_PARAM_KEY, String.valueOf(Directory.DEFAULT));
        if (filter.filterType == ContactListFilter.FILTER_TYPE_ACCOUNT) {
            filter.addAccountQueryParameterToUrl(builder);
        }
        uri = builder.build();
    }
    loader.setUri(uri);
}
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