mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-09-28 07:51:42 +01:00
Avoid rebinding conversation items when pulsing them.
This commit is contained in:
committed by
Michelle Tang
parent
b8d43fa504
commit
fbf57fd522
@@ -17,6 +17,13 @@ interface ConversationAdapterBridge {
|
||||
const val PAYLOAD_NAME_COLORS = 1
|
||||
const val PAYLOAD_SELECTED = 2
|
||||
const val PAYLOAD_PARENT_SCROLLING = 3
|
||||
|
||||
/**
|
||||
* The pulse highlight is rendered entirely by the item decoration, so items that receive this
|
||||
* payload deliberately do nothing. It exists so that requesting a pulse does not force a full
|
||||
* rebind of an item that is already on screen.
|
||||
*/
|
||||
const val PAYLOAD_PULSE = 4
|
||||
}
|
||||
|
||||
fun hasNoConversationMessages(): Boolean
|
||||
|
||||
+5
-1
@@ -272,7 +272,7 @@ class ConversationAdapterV2(
|
||||
if (recordToPulse != null) {
|
||||
pulseRequest = ConversationAdapterBridge.PulseRequest(position, recordToPulse!!.messageRecord.isOutgoing)
|
||||
}
|
||||
notifyItemChanged(position)
|
||||
notifyItemChanged(position, ConversationAdapterBridge.PAYLOAD_PULSE)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -519,6 +519,10 @@ class ConversationAdapterV2(
|
||||
payloadApplied = true
|
||||
}
|
||||
|
||||
if (payload.contains(ConversationAdapterBridge.PAYLOAD_PULSE)) {
|
||||
payloadApplied = true
|
||||
}
|
||||
|
||||
return payloadApplied
|
||||
}
|
||||
|
||||
|
||||
+4
@@ -252,6 +252,10 @@ open class V2ConversationItemTextOnlyViewHolder<Model : MappingModel<Model>>(
|
||||
hasProcessedSupportedPayload = true
|
||||
}
|
||||
|
||||
if (ConversationAdapterBridge.PAYLOAD_PULSE in payload) {
|
||||
hasProcessedSupportedPayload = true
|
||||
}
|
||||
|
||||
if (hasProcessedSupportedPayload && V2Payload.WALLPAPER !in payload) {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user