public void uncheckAll() { int count = getCount(); for (int i = 0; i < count; i++) { Cursor cursor = (Cursor) getItem(i); Conversation conv = Conversation.from(mContext, cursor); conv.setIsChecked(false); } }
public void onReceive(Context context, Intent intent) { if (Log.isLoggable(LogTag.APP, Log.VERBOSE)) { Log.d(TAG, "[MessagingNotification] clear notification: mark all msgs seen"); } Conversation.markAllConversationsAsSeen(context); }
@Override public void bindView(View view, Context context, Cursor cursor) { if (!(view instanceof ConversationListItem)) { Log.e(TAG, "Unexpected bound view: " + view); return; } ConversationListItem headerView = (ConversationListItem) view; Conversation conv = Conversation.from(context, cursor); headerView.bind(context, conv); }
private Uri storeMessage(Context context, SmsMessage[] msgs, int error) { SmsMessage sms = msgs[0]; // Store the message in the content provider. ContentValues values = extractContentValues(sms); values.put(Sms.ERROR_CODE, error); int pduCount = msgs.length; if (pduCount == 1) { // There is only one part, so grab the body directly. values.put(Inbox.BODY, replaceFormFeeds(sms.getDisplayMessageBody())); } else { // Build up the body from the parts. StringBuilder body = new StringBuilder(); for (int i = 0; i < pduCount; i++) { sms = msgs[i]; if (sms.mWrappedSmsMessage != null) { body.append(sms.getDisplayMessageBody()); } } values.put(Inbox.BODY, replaceFormFeeds(body.toString())); } // Make sure we've got a thread id so after the insert we'll be able to delete // excess messages. Long threadId = values.getAsLong(Sms.THREAD_ID); String address = values.getAsString(Sms.ADDRESS); // Code for debugging and easy injection of short codes, non email addresses, etc. // See Contact.isAlphaNumber() for further comments and results. // switch (count++ % 8) { // case 0: address = "AB12"; break; // case 1: address = "12"; break; // case 2: address = "Jello123"; break; // case 3: address = "T-Mobile"; break; // case 4: address = "Mobile1"; break; // case 5: address = "Dogs77"; break; // case 6: address = "****1"; break; // case 7: address = "#4#5#6#"; break; // } if (!TextUtils.isEmpty(address)) { Contact cacheContact = Contact.get(address, true); if (cacheContact != null) { address = cacheContact.getNumber(); } } else { address = getString(R.string.unknown_sender); values.put(Sms.ADDRESS, address); } if (((threadId == null) || (threadId == 0)) && (address != null)) { threadId = Conversation.getOrCreateThreadId(context, address); values.put(Sms.THREAD_ID, threadId); } ContentResolver resolver = context.getContentResolver(); Uri insertedUri = SqliteWrapper.insert(context, resolver, Inbox.CONTENT_URI, values); // Now make sure we're not over the limit in stored messages Recycler.getSmsRecycler().deleteOldMessagesByThreadId(context, threadId); MmsWidgetProvider.notifyDatasetChanged(context); return insertedUri; }