mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-21 17:29:32 +01:00
Fix flashing when send/recv messages in a new conversation.
This commit is contained in:
committed by
Greyson Parrelli
parent
b92a41ab70
commit
4f3c545eda
@@ -225,7 +225,7 @@ public class ConversationAdapter
|
||||
case MESSAGE_TYPE_HEADER:
|
||||
return new HeaderViewHolder(CachedInflater.from(parent.getContext()).inflate(R.layout.cursor_adapter_header_footer_view, parent, false));
|
||||
case MESSAGE_TYPE_FOOTER:
|
||||
return new HeaderFooterViewHolder(CachedInflater.from(parent.getContext()).inflate(R.layout.cursor_adapter_header_footer_view, parent, false));
|
||||
return new FooterViewHolder(CachedInflater.from(parent.getContext()).inflate(R.layout.cursor_adapter_header_footer_view, parent, false));
|
||||
default:
|
||||
throw new IllegalStateException("Cannot create viewholder for type: " + viewType);
|
||||
}
|
||||
@@ -748,7 +748,7 @@ public class ConversationAdapter
|
||||
}
|
||||
}
|
||||
|
||||
public static class HeaderFooterViewHolder extends RecyclerView.ViewHolder {
|
||||
public abstract static class HeaderFooterViewHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
private ViewGroup container;
|
||||
|
||||
@@ -777,6 +777,10 @@ public class ConversationAdapter
|
||||
}
|
||||
}
|
||||
|
||||
public static class FooterViewHolder extends HeaderFooterViewHolder {
|
||||
FooterViewHolder(@NonNull View itemView) { super(itemView); }
|
||||
}
|
||||
|
||||
public static class HeaderViewHolder extends HeaderFooterViewHolder {
|
||||
HeaderViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
|
||||
@@ -45,7 +45,8 @@ class ConversationItemAnimator(
|
||||
if (viewHolder is ConversationAdapter.HeaderViewHolder &&
|
||||
!pendingSlideAnimations.containsKey(viewHolder) &&
|
||||
!slideAnimations.containsKey(viewHolder) &&
|
||||
shouldPlayMessageAnimations()
|
||||
shouldPlayMessageAnimations() &&
|
||||
isParentFilled()
|
||||
) {
|
||||
pendingSlideAnimations[viewHolder] = TweeningInfo(0f, viewHolder.itemView.height.toFloat())
|
||||
dispatchAnimationStarted(viewHolder)
|
||||
@@ -71,7 +72,7 @@ class ConversationItemAnimator(
|
||||
return false
|
||||
}
|
||||
|
||||
if (operation == Operation.CHANGE && !isParentFilled() || slideAnimations.containsKey(viewHolder)) {
|
||||
if (operation == Operation.CHANGE || slideAnimations.containsKey(viewHolder)) {
|
||||
dispatchAnimationFinished(viewHolder)
|
||||
return false
|
||||
}
|
||||
@@ -100,8 +101,7 @@ class ConversationItemAnimator(
|
||||
}
|
||||
|
||||
override fun animatePersistence(viewHolder: RecyclerView.ViewHolder, preLayoutInfo: ItemHolderInfo, postLayoutInfo: ItemHolderInfo): Boolean {
|
||||
val isInMultiSelectMode = isInMultiSelectMode()
|
||||
return if (!isInMultiSelectMode && shouldPlayMessageAnimations()) {
|
||||
return if (!isInMultiSelectMode() && shouldPlayMessageAnimations() && isParentFilled()) {
|
||||
if (pendingSlideAnimations.contains(viewHolder) || slideAnimations.containsKey(viewHolder)) {
|
||||
dispatchAnimationFinished(viewHolder)
|
||||
false
|
||||
|
||||
Reference in New Issue
Block a user