Add DiffCallback to handle Contextual Cards update.
Use DiffCallback in ContextualCardsAdapter to only update items that are changed instead of touching those unchanged ones. Also fix a bug where ConditionContexualCardCard#onStart is incorrectly skipped. Fixes: 112245748 Bug: 118165942 Test: robotests Change-Id: I7989d621764fe40a3fceb8c9f40baced840818ba
This commit is contained in:
@@ -115,10 +115,6 @@ public class ContextualCardManager implements CardContentLoader.CardContentLoade
|
||||
|
||||
@Override
|
||||
public void onContextualCardUpdated(Map<Integer, List<ContextualCard>> updateList) {
|
||||
//TODO(b/112245748): Should implement a DiffCallback.
|
||||
//Keep the old list for comparison.
|
||||
final List<ContextualCard> prevCards = mContextualCards;
|
||||
|
||||
final Set<Integer> cardTypes = updateList.keySet();
|
||||
//Remove the existing data that matches the certain cardType before inserting new data.
|
||||
final List<ContextualCard> cardsToKeep = mContextualCards
|
||||
|
Reference in New Issue
Block a user