diff --git a/src/org/thoughtcrime/securesms/ConversationAdapter.java b/src/org/thoughtcrime/securesms/ConversationAdapter.java index 73ab9dbe14..fe8faa761f 100644 --- a/src/org/thoughtcrime/securesms/ConversationAdapter.java +++ b/src/org/thoughtcrime/securesms/ConversationAdapter.java @@ -190,10 +190,12 @@ public class ConversationAdapter } @Override - protected void onBindItemViewHolder(ViewHolder viewHolder, @NonNull MessageRecord messageRecord, int position) { - long start = System.currentTimeMillis(); - MessageRecord previousRecord = position < getItemCount() - 1 ? getRecordForPositionOrThrow(position + 1) : null; - MessageRecord nextRecord = position > 0 ? getRecordForPositionOrThrow(position - 1) : null; + protected void onBindItemViewHolder(ViewHolder viewHolder, @NonNull MessageRecord messageRecord, int adjustedPosition) { + + long start = System.currentTimeMillis(); + int rawPosition = getRawCursorPosition(adjustedPosition); + MessageRecord previousRecord = rawPosition < getItemCount() - 1 && !isFooterPosition(rawPosition + 1) ? getRecordForPositionOrThrow(rawPosition + 1) : null; + MessageRecord nextRecord = rawPosition > 0 && !isHeaderPosition(rawPosition - 1) ? getRecordForPositionOrThrow(rawPosition - 1) : null; viewHolder.getView().bind(messageRecord, Optional.fromNullable(previousRecord), diff --git a/src/org/thoughtcrime/securesms/database/CursorRecyclerViewAdapter.java b/src/org/thoughtcrime/securesms/database/CursorRecyclerViewAdapter.java index 31b9cc42ac..9d12340ef3 100644 --- a/src/org/thoughtcrime/securesms/database/CursorRecyclerViewAdapter.java +++ b/src/org/thoughtcrime/securesms/database/CursorRecyclerViewAdapter.java @@ -211,6 +211,13 @@ public abstract class CursorRecyclerViewAdapter