mirror of
https://github.com/oxen-io/session-android.git
synced 2025-01-11 16:33:39 +00:00
Make header decorations play well together
// FREEBIE
This commit is contained in:
parent
d9b42c4369
commit
143fb1fe21
@ -353,12 +353,12 @@ public class ConversationAdapter <V extends View & BindableConversationItem>
|
||||
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 <V extends View & BindableConversationItem>
|
||||
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);
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user