private void checkInReplyToNameOf(ConversationOneMessage oMsg) { if (!SharedPreferencesUtil.isEmpty(oMsg.inReplyToName)) { MyLog.v( this, "Message id=" + oMsg.msgId + " has reply to name (" + oMsg.inReplyToName + ") but no reply to message id"); // Don't try to retrieve this message again. // It looks like such messages really exist. ConversationOneMessage oMsg2 = new ConversationOneMessage(0, oMsg.replyLevel - 1); // This allows to place the message on the timeline correctly oMsg2.createdDate = oMsg.createdDate - 60000; oMsg2.author = oMsg.inReplyToName; oMsg2.body = "(" + context.getText(R.string.id_of_this_message_was_not_specified) + ")"; addMessageToList(oMsg2); } }
private void loadMessageFromCursor(ConversationOneMessage oMsg, Cursor cursor) { /** * IDs of all known senders of this message except for the Author These "senders" reblogged the * message */ Set<Long> rebloggers = new HashSet<Long>(); int ind = 0; do { long senderId = cursor.getLong(cursor.getColumnIndex(Msg.SENDER_ID)); long authorId = cursor.getLong(cursor.getColumnIndex(Msg.AUTHOR_ID)); long linkedUserId = cursor.getLong(cursor.getColumnIndex(User.LINKED_USER_ID)); if (ind == 0) { // This is the same for all retrieved rows oMsg.inReplyToMsgId = cursor.getLong(cursor.getColumnIndex(Msg.IN_REPLY_TO_MSG_ID)); oMsg.createdDate = cursor.getLong(cursor.getColumnIndex(Msg.CREATED_DATE)); oMsg.author = cursor.getString(cursor.getColumnIndex(User.AUTHOR_NAME)); oMsg.body = cursor.getString(cursor.getColumnIndex(Msg.BODY)); String via = cursor.getString(cursor.getColumnIndex(Msg.VIA)); if (!TextUtils.isEmpty(via)) { oMsg.via = Html.fromHtml(via).toString().trim(); } if (MyPreferences.showAvatars()) { oMsg.avatarDrawable = new AvatarDrawable( authorId, cursor.getString(cursor.getColumnIndex(Avatar.FILE_NAME))); } int colIndex = cursor.getColumnIndex(User.IN_REPLY_TO_NAME); if (colIndex > -1) { oMsg.inReplyToName = cursor.getString(colIndex); if (TextUtils.isEmpty(oMsg.inReplyToName)) { oMsg.inReplyToName = ""; } } colIndex = cursor.getColumnIndex(User.RECIPIENT_NAME); if (colIndex > -1) { oMsg.recipientName = cursor.getString(colIndex); if (TextUtils.isEmpty(oMsg.recipientName)) { oMsg.recipientName = ""; } } } if (senderId != authorId) { rebloggers.add(senderId); } if (linkedUserId != 0) { if (oMsg.linkedUserId == 0) { oMsg.linkedUserId = linkedUserId; } if (cursor.getInt(cursor.getColumnIndex(MsgOfUser.REBLOGGED)) == 1 && linkedUserId != authorId) { rebloggers.add(linkedUserId); } if (cursor.getInt(cursor.getColumnIndex(MsgOfUser.FAVORITED)) == 1) { oMsg.favorited = true; } } ind++; } while (cursor.moveToNext()); for (long rebloggerId : rebloggers) { if (!TextUtils.isEmpty(oMsg.rebloggersString)) { oMsg.rebloggersString += ", "; } oMsg.rebloggersString += MyProvider.userIdToName(rebloggerId); } }