Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 10270f2b authored by Ficus Kirkpatrick's avatar Ficus Kirkpatrick Committed by The Android Open Source Project
Browse files

Automated import from //branches/master/...@141740,141740

parent f85f081d
Loading
Loading
Loading
Loading
+26 −7
Original line number Diff line number Diff line
@@ -233,18 +233,37 @@ public final class Telephony {
         */
        public static boolean moveMessageToFolder(Context context,
                Uri uri, int folder) {
            if ((uri == null) || ((folder != MESSAGE_TYPE_INBOX)
                                  && (folder != MESSAGE_TYPE_OUTBOX)
                                  && (folder != MESSAGE_TYPE_SENT)
                                  && (folder != MESSAGE_TYPE_DRAFT)
                                  && (folder != MESSAGE_TYPE_FAILED)
                                  && (folder != MESSAGE_TYPE_QUEUED))) {
            if (uri == null) {
                return false;
            }
            
            ContentValues values = new ContentValues(1);
            boolean markAsUnread = false;
            boolean markAsRead = false;
            switch(folder) {
            case MESSAGE_TYPE_INBOX:
            case MESSAGE_TYPE_DRAFT:
                break;
            case MESSAGE_TYPE_OUTBOX:
            case MESSAGE_TYPE_SENT:
                markAsRead = true;
                break;
            case MESSAGE_TYPE_FAILED:
            case MESSAGE_TYPE_QUEUED:
                markAsUnread = true;
                break;
            default:
                return false;
            }

            ContentValues values = new ContentValues(2);

            values.put(TYPE, folder);
            if (markAsUnread) {
                values.put(READ, Integer.valueOf(0));
            } else if (markAsRead) {
                values.put(READ, Integer.valueOf(1));
            }
            
            return 1 == SqliteWrapper.update(context, context.getContentResolver(),
                            uri, values, null, null);
        }