Attempt to fix date headers overlaping scheduled messages.

This commit is contained in:
Cody Henthorne
2026-04-28 14:06:33 -04:00
committed by Greyson Parrelli
parent cc3bedd154
commit edfe89683b
2 changed files with 10 additions and 1 deletions
@@ -100,6 +100,8 @@ class ScheduledMessagesBottomSheet : FixedRoundedCornerBottomSheetDialogFragment
setCondensedMode(ConversationItemDisplayMode.Condensed(ConversationItemDisplayMode.MessageMode.SCHEDULED))
}
val stickyHeaders = StickyHeaderDecoration(messageAdapter, false, false, ConversationAdapter.HEADER_TYPE_INLINE_DATE)
val list: RecyclerView = view.findViewById<RecyclerView>(R.id.scheduled_list).apply {
layoutManager = SmoothScrollingLinearLayoutManager(requireContext(), true)
adapter = messageAdapter
@@ -107,7 +109,7 @@ class ScheduledMessagesBottomSheet : FixedRoundedCornerBottomSheetDialogFragment
doOnNextLayout {
// Adding this without waiting for a layout pass would result in an indeterminate amount of padding added to the top of the view
addItemDecoration(StickyHeaderDecoration(messageAdapter, false, false, ConversationAdapter.HEADER_TYPE_INLINE_DATE))
addItemDecoration(stickyHeaders)
}
}
@@ -127,6 +129,9 @@ class ScheduledMessagesBottomSheet : FixedRoundedCornerBottomSheetDialogFragment
} else if (!list.canScrollVertically(1)) {
list.layoutManager?.scrollToPosition(0)
}
stickyHeaders.invalidateCache()
list.invalidateItemDecorations()
}
recyclerViewColorizer.setChatColors(conversationRecipient.chatColors)
}
@@ -200,6 +200,10 @@ public class StickyHeaderDecoration extends RecyclerView.ItemDecoration {
((LinearLayoutManager)parent.getLayoutManager()).getReverseLayout();
}
public void invalidateCache() {
headerCache.clear();
}
/**
* The adapter to assist the {@link StickyHeaderDecoration} in creating and binding the header views.
*/