From 5df6364d89107d923bb937e8fc7be763cf4f6d8a Mon Sep 17 00:00:00 2001 From: Fan Zhang Date: Wed, 13 Jul 2016 09:49:03 -0700 Subject: [PATCH] Cross fade escalation card when content changes. Fixes: 30079520 Whenever escalation card needs to change content: - Instead of rebuilding entire data set, rebuild just escalation data. - Instead of notify entire data set change, only notify the position change for escalation card. This triggers the cross-fade animation in RecyclerView's DefaultItemAnimator. Change-Id: Ia19593d852fa6a1c366aecf9330d8274d7295e85 --- .../dashboard/SupportItemAdapter.java | 50 ++++++++++++++----- 1 file changed, 37 insertions(+), 13 deletions(-) diff --git a/src/com/android/settings/dashboard/SupportItemAdapter.java b/src/com/android/settings/dashboard/SupportItemAdapter.java index 1d4e99adca1..a0ba57bee01 100644 --- a/src/com/android/settings/dashboard/SupportItemAdapter.java +++ b/src/com/android/settings/dashboard/SupportItemAdapter.java @@ -148,7 +148,7 @@ public final class SupportItemAdapter extends RecyclerView.Adapter 0) { + final int itemType = getItemViewType(0 /* position */); + if (itemType == TYPE_SIGN_IN_BUTTON + || itemType == TYPE_ESCALATION_OPTIONS + || itemType == TYPE_ESCALATION_OPTIONS_OFFLINE) { + mSupportData.remove(0 /* position */); + addEscalationCards(); + notifyItemChanged(0 /* position */); + } + } + } + + private void addOnlineEscalationCards() { final boolean hasPhoneOperation = mSupportFeatureProvider.isSupportTypeEnabled(mActivity, PHONE); final boolean hasChatOperation = @@ -218,7 +242,7 @@ public final class SupportItemAdapter extends RecyclerView.Adapter