diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java index a40f8b3809..d05b556bea 100644 --- a/src/com/android/launcher3/allapps/AllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java @@ -165,6 +165,7 @@ public class AllAppsContainerView extends RelativeLayout implements DragSource, } onAppsUpdated(); mSearchUiManager.refreshSearchResult(); + mHeader.onAppsUpdated(); } /** diff --git a/src/com/android/launcher3/allapps/FloatingHeaderView.java b/src/com/android/launcher3/allapps/FloatingHeaderView.java index e4f8ad3ab4..23917683fa 100644 --- a/src/com/android/launcher3/allapps/FloatingHeaderView.java +++ b/src/com/android/launcher3/allapps/FloatingHeaderView.java @@ -219,6 +219,9 @@ public class FloatingHeaderView extends RelativeLayout implements p.y = getTop() - mCurrentRV.getTop() - mParent.getTop(); } + public void onAppsUpdated() { + mPredictionRow.onAppsUpdated(); + } } diff --git a/src/com/android/launcher3/allapps/PredictionRowView.java b/src/com/android/launcher3/allapps/PredictionRowView.java index e834ff4dfc..bc934dd42b 100644 --- a/src/com/android/launcher3/allapps/PredictionRowView.java +++ b/src/com/android/launcher3/allapps/PredictionRowView.java @@ -105,7 +105,7 @@ public class PredictionRowView extends LinearLayout { public void setNumAppsPerRow(int numPredictedAppsPerRow) { if (mNumPredictedAppsPerRow != numPredictedAppsPerRow) { mNumPredictedAppsPerRow = numPredictedAppsPerRow; - onAppsUpdated(); + onPredictionsUpdated(); } } @@ -120,7 +120,7 @@ public class PredictionRowView extends LinearLayout { * Sets the current set of predicted apps. * * This can be called before we get the full set of applications, we should merge the results - * only in onAppsUpdated() which is idempotent. + * only in onPredictionsUpdated() which is idempotent. * * If the number of predicted apps is the same as the previous list of predicted apps, * we can optimize by swapping them in place. @@ -130,10 +130,10 @@ public class PredictionRowView extends LinearLayout { mPredictedAppComponents.addAll(apps); mPredictedApps.clear(); mPredictedApps.addAll(processPredictedAppComponents(mPredictedAppComponents)); - onAppsUpdated(); + onPredictionsUpdated(); } - private void onAppsUpdated() { + private void onPredictionsUpdated() { int childCountBefore = getChildCount(); if (getChildCount() != mNumPredictedAppsPerRow) { while (getChildCount() > mNumPredictedAppsPerRow) { @@ -170,6 +170,24 @@ public class PredictionRowView extends LinearLayout { } } + /** + * Refreshes the app icons in the row view, while preserving the same set of predictions. + */ + public void onAppsUpdated() { + for (int i = 0; i < getChildCount(); i++) { + View child = getChildAt(i); + if (!(child instanceof BubbleTextView)) { + continue; + } + if (i >= mPredictedApps.size()) { + break; + } + BubbleTextView icon = (BubbleTextView) getChildAt(i); + icon.reset(); + icon.applyFromApplicationInfo(mPredictedApps.get(i)); + } + } + private List processPredictedAppComponents( List> components) { if (mComponentToAppMap.isEmpty()) {