diff --git a/src/org/thoughtcrime/securesms/ConversationAdapter.java b/src/org/thoughtcrime/securesms/ConversationAdapter.java index a048c35dad..59e2fa721c 100644 --- a/src/org/thoughtcrime/securesms/ConversationAdapter.java +++ b/src/org/thoughtcrime/securesms/ConversationAdapter.java @@ -353,12 +353,12 @@ public class ConversationAdapter viewHolder.setText(getContext().getResources().getQuantityString(R.plurals.ConversationAdapter_n_unread_messages, (position + 1), (position + 1))); } - public static class LastSeenHeader extends StickyHeaderDecoration { + static class LastSeenHeader extends StickyHeaderDecoration { private final ConversationAdapter adapter; private final long lastSeenTimestamp; - public LastSeenHeader(ConversationAdapter adapter, long lastSeenTimestamp) { + LastSeenHeader(ConversationAdapter adapter, long lastSeenTimestamp) { super(adapter, false, false); this.adapter = adapter; this.lastSeenTimestamp = lastSeenTimestamp; @@ -380,6 +380,11 @@ public class ConversationAdapter return currentRecordTimestamp > lastSeenTimestamp && previousRecordTimestamp < lastSeenTimestamp; } + @Override + protected int getHeaderTop(RecyclerView parent, View child, View header, int adapterPos, int layoutPos) { + return parent.getLayoutManager().getDecoratedTop(child); + } + @Override protected HeaderViewHolder getHeader(RecyclerView parent, StickyHeaderAdapter stickyAdapter, int position) { HeaderViewHolder viewHolder = adapter.onCreateLastSeenViewHolder(parent); diff --git a/src/org/thoughtcrime/securesms/util/StickyHeaderDecoration.java b/src/org/thoughtcrime/securesms/util/StickyHeaderDecoration.java index 573cbacabb..f2115acadd 100644 --- a/src/org/thoughtcrime/securesms/util/StickyHeaderDecoration.java +++ b/src/org/thoughtcrime/securesms/util/StickyHeaderDecoration.java @@ -127,7 +127,7 @@ public class StickyHeaderDecoration extends RecyclerView.ItemDecoration { } } - private int getHeaderTop(RecyclerView parent, View child, View header, int adapterPos, + protected int getHeaderTop(RecyclerView parent, View child, View header, int adapterPos, int layoutPos) { int headerHeight = getHeaderHeightForLayout(header); @@ -172,7 +172,7 @@ public class StickyHeaderDecoration extends RecyclerView.ItemDecoration { } } - private int getHeaderHeightForLayout(View header) { + protected int getHeaderHeightForLayout(View header) { return renderInline ? 0 : header.getHeight(); }