use of android.content.ContentValues in project qksms by moezbhatti.
the class Message method markRead.
public void markRead() {
ContentValues cv = new ContentValues();
cv.put("read", true);
cv.put("seen", true);
if (isMms()) {
context.getContentResolver().update(Uri.parse("content://mms/" + getId()), cv, null, null);
} else {
context.getContentResolver().update(Uri.parse("content://sms/" + getId()), cv, null, null);
}
}
use of android.content.ContentValues in project qksms by moezbhatti.
the class Message method markSeen.
public void markSeen() {
ContentValues cv = new ContentValues();
cv.put("seen", true);
if (isMms()) {
context.getContentResolver().update(Uri.parse("content://mms/" + getId()), cv, null, null);
} else {
context.getContentResolver().update(Uri.parse("content://sms/" + getId()), cv, null, null);
}
}
use of android.content.ContentValues in project qksms by moezbhatti.
the class SmsHelper method markMmsSeen.
public static void markMmsSeen(Context context) {
Cursor cursor = context.getContentResolver().query(MMS_CONTENT_PROVIDER, new String[] { SmsHelper.COLUMN_ID }, SmsHelper.UNSEEN_SELECTION + " AND " + SmsHelper.UNREAD_SELECTION, null, null);
if (cursor == null) {
Log.i(TAG, "No unseen messages");
return;
}
MessageColumns.ColumnsMap map = new MessageColumns.ColumnsMap(cursor);
if (cursor.moveToFirst()) {
ContentValues cv = new ContentValues();
cv.put("seen", true);
do {
context.getContentResolver().update(Uri.parse("content://mms/" + cursor.getLong(map.mColumnMsgId)), cv, null, null);
} while (cursor.moveToNext());
}
cursor.close();
}
use of android.content.ContentValues in project qksms by moezbhatti.
the class SmsHelper method markSmsSeen.
public static void markSmsSeen(Context context) {
Cursor cursor = context.getContentResolver().query(RECEIVED_MESSAGE_CONTENT_PROVIDER, new String[] { SmsHelper.COLUMN_ID }, SmsHelper.UNSEEN_SELECTION + " AND " + SmsHelper.UNREAD_SELECTION, null, null);
if (cursor == null) {
Log.i(TAG, "No unseen messages");
return;
}
MessageColumns.ColumnsMap map = new MessageColumns.ColumnsMap(cursor);
if (cursor.moveToFirst()) {
ContentValues cv = new ContentValues();
cv.put("seen", true);
do {
context.getContentResolver().update(Uri.parse("content://sms/" + cursor.getLong(map.mColumnMsgId)), cv, null, null);
} while (cursor.moveToNext());
}
cursor.close();
}
use of android.content.ContentValues in project Signal-Android by WhisperSystems.
the class AttachmentDatabase method insertAttachmentsForPlaceholder.
public long insertAttachmentsForPlaceholder(@NonNull MasterSecret masterSecret, long mmsId, @NonNull AttachmentId attachmentId, @NonNull InputStream inputStream) throws MmsException {
SQLiteDatabase database = databaseHelper.getWritableDatabase();
Pair<File, Long> partData = setAttachmentData(masterSecret, inputStream);
ContentValues values = new ContentValues();
values.put(DATA, partData.first.getAbsolutePath());
values.put(SIZE, partData.second);
values.put(TRANSFER_STATE, TRANSFER_PROGRESS_DONE);
values.put(CONTENT_LOCATION, (String) null);
values.put(CONTENT_DISPOSITION, (String) null);
values.put(DIGEST, (byte[]) null);
values.put(NAME, (String) null);
if (database.update(TABLE_NAME, values, PART_ID_WHERE, attachmentId.toStrings()) == 0) {
//noinspection ResultOfMethodCallIgnored
partData.first.delete();
} else {
notifyConversationListeners(DatabaseFactory.getMmsDatabase(context).getThreadIdForMessage(mmsId));
notifyConversationListListeners();
}
thumbnailExecutor.submit(new ThumbnailFetchCallable(masterSecret, attachmentId));
return partData.second;
}
Aggregations