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:
Emily Chuang
2018-10-16 18:49:29 +08:00
committed by Fan Zhang
parent 0a546d1916
commit 18a99faaf1
6 changed files with 80 additions and 17 deletions

View File

@@ -107,12 +107,12 @@ public class ConditionManager {
*/
public void startMonitoringStateChange() {
if (mIsListeningToStateChange) {
Log.d(TAG, "Already listening to condition state changes, skipping");
return;
}
mIsListeningToStateChange = true;
for (ConditionalCardController controller : mCardControllers) {
controller.startMonitoringStateChange();
Log.d(TAG, "Already listening to condition state changes, skipping monitor setup");
} else {
mIsListeningToStateChange = true;
for (ConditionalCardController controller : mCardControllers) {
controller.startMonitoringStateChange();
}
}
// Force a refresh on listener
onConditionChanged();