From 94cb9e5288eeaa65811fcd259e17c4c318288510 Mon Sep 17 00:00:00 2001 From: Mario Bertschler Date: Fri, 12 Jan 2018 16:07:08 -0800 Subject: [PATCH] Fixes on updates on the PredictionRowView > resetup header if content switches from empty to non-empty > scroll to top on reset Change-Id: Idc523a94990e9a8f9d639485fa5c7ec60eb378de --- src/com/android/launcher3/allapps/FloatingHeaderView.java | 1 + src/com/android/launcher3/allapps/PredictionRowView.java | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/src/com/android/launcher3/allapps/FloatingHeaderView.java b/src/com/android/launcher3/allapps/FloatingHeaderView.java index 1419a2a7c2..e4f8ad3ab4 100644 --- a/src/com/android/launcher3/allapps/FloatingHeaderView.java +++ b/src/com/android/launcher3/allapps/FloatingHeaderView.java @@ -176,6 +176,7 @@ public class FloatingHeaderView extends RelativeLayout implements mAnimator.start(); mHeaderCollapsed = false; mSnappedScrolledY = -mMaxTranslation; + mCurrentRV.scrollToTop(); } public boolean isExpanded() { diff --git a/src/com/android/launcher3/allapps/PredictionRowView.java b/src/com/android/launcher3/allapps/PredictionRowView.java index 4aacc6d70e..e834ff4dfc 100644 --- a/src/com/android/launcher3/allapps/PredictionRowView.java +++ b/src/com/android/launcher3/allapps/PredictionRowView.java @@ -134,6 +134,7 @@ public class PredictionRowView extends LinearLayout { } private void onAppsUpdated() { + int childCountBefore = getChildCount(); if (getChildCount() != mNumPredictedAppsPerRow) { while (getChildCount() > mNumPredictedAppsPerRow) { removeViewAt(0); @@ -160,6 +161,13 @@ public class PredictionRowView extends LinearLayout { icon.setVisibility(View.INVISIBLE); } } + + if (getChildCount() > 0 && childCountBefore == 0 + || getChildCount() == 0 && childCountBefore > 0) { + // setting up header to adjust the height + // only necessary if childcount switches from/to 0 + Launcher.getLauncher(getContext()).getAppsView().setupHeader(); + } } private List processPredictedAppComponents(