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