Search in sources :

Example 56 with ContentValues

use of android.content.ContentValues in project Signal-Android by WhisperSystems.

the class RecipientPreferenceDatabase method setSeenInviteReminder.

public void setSeenInviteReminder(Recipients recipients, boolean seen) {
    ContentValues values = new ContentValues(1);
    values.put(SEEN_INVITE_REMINDER, seen ? 1 : 0);
    updateOrInsert(recipients, values);
}
Also used : ContentValues(android.content.ContentValues)

Example 57 with ContentValues

use of android.content.ContentValues in project Signal-Android by WhisperSystems.

the class RecipientPreferenceDatabase method setMuted.

public void setMuted(Recipients recipients, long until) {
    Log.w(TAG, "Setting muted until: " + until);
    ContentValues values = new ContentValues();
    values.put(MUTE_UNTIL, until);
    updateOrInsert(recipients, values);
}
Also used : ContentValues(android.content.ContentValues)

Example 58 with ContentValues

use of android.content.ContentValues in project Signal-Android by WhisperSystems.

the class GroupDatabase method updateMembers.

public void updateMembers(byte[] id, List<String> members) {
    ContentValues contents = new ContentValues();
    contents.put(MEMBERS, Util.join(members, ","));
    contents.put(ACTIVE, 1);
    databaseHelper.getWritableDatabase().update(TABLE_NAME, contents, GROUP_ID + " = ?", new String[] { GroupUtil.getEncodedId(id) });
}
Also used : ContentValues(android.content.ContentValues)

Example 59 with ContentValues

use of android.content.ContentValues in project Signal-Android by WhisperSystems.

the class GroupDatabase method create.

public void create(byte[] groupId, String title, List<String> members, SignalServiceAttachmentPointer avatar, String relay) {
    ContentValues contentValues = new ContentValues();
    contentValues.put(GROUP_ID, GroupUtil.getEncodedId(groupId));
    contentValues.put(TITLE, title);
    contentValues.put(MEMBERS, Util.join(members, ","));
    if (avatar != null) {
        contentValues.put(AVATAR_ID, avatar.getId());
        contentValues.put(AVATAR_KEY, avatar.getKey());
        contentValues.put(AVATAR_CONTENT_TYPE, avatar.getContentType());
        contentValues.put(AVATAR_DIGEST, avatar.getDigest().orNull());
    }
    contentValues.put(AVATAR_RELAY, relay);
    contentValues.put(TIMESTAMP, System.currentTimeMillis());
    contentValues.put(ACTIVE, 1);
    databaseHelper.getWritableDatabase().insert(TABLE_NAME, null, contentValues);
    notifyConversationListListeners();
}
Also used : ContentValues(android.content.ContentValues)

Example 60 with ContentValues

use of android.content.ContentValues in project Signal-Android by WhisperSystems.

the class GroupDatabase method update.

public void update(byte[] groupId, String title, SignalServiceAttachmentPointer avatar) {
    ContentValues contentValues = new ContentValues();
    if (title != null)
        contentValues.put(TITLE, title);
    if (avatar != null) {
        contentValues.put(AVATAR_ID, avatar.getId());
        contentValues.put(AVATAR_CONTENT_TYPE, avatar.getContentType());
        contentValues.put(AVATAR_KEY, avatar.getKey());
        contentValues.put(AVATAR_DIGEST, avatar.getDigest().orNull());
    }
    databaseHelper.getWritableDatabase().update(TABLE_NAME, contentValues, GROUP_ID + " = ?", new String[] { GroupUtil.getEncodedId(groupId) });
    RecipientFactory.clearCache(context);
    notifyDatabaseListeners();
    notifyConversationListListeners();
}
Also used : ContentValues(android.content.ContentValues)

Aggregations

ContentValues (android.content.ContentValues)3993 Cursor (android.database.Cursor)720 SQLiteDatabase (android.database.sqlite.SQLiteDatabase)638 Uri (android.net.Uri)619 Test (org.junit.Test)374 SQLException (android.database.SQLException)231 ContentResolver (android.content.ContentResolver)212 ArrayList (java.util.ArrayList)192 Intent (android.content.Intent)162 File (java.io.File)156 IOException (java.io.IOException)131 RemoteException (android.os.RemoteException)96 CursorAssert.assertThatCursor (org.hisp.dhis.android.core.data.database.CursorAssert.assertThatCursor)91 NonNull (android.support.annotation.NonNull)74 Date (java.util.Date)73 MediumTest (android.test.suitebuilder.annotation.MediumTest)63 HashMap (java.util.HashMap)62 JSONException (org.json.JSONException)60 SQLiteException (android.database.sqlite.SQLiteException)53 ContentProviderOperation (android.content.ContentProviderOperation)49