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;
}
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;
}
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);
}
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;
}
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);
}
Aggregations