From ab9ad20be600d1cbdc6b54a491d5fbb4c2cf9c16 Mon Sep 17 00:00:00 2001 From: Samuel Fufa Date: Wed, 7 Oct 2020 15:18:24 -0700 Subject: [PATCH] Search UI cleanup - offset all apps header padding with search input margin - avoid check shouldDraw check on HeaderRow. (race condition) Bug: 170263425 Change-Id: I11a1fbb448aa6afd18ec0984af9bb8b1d7600f69 --- .../android/launcher3/allapps/FloatingHeaderView.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/com/android/launcher3/allapps/FloatingHeaderView.java b/src/com/android/launcher3/allapps/FloatingHeaderView.java index 11d3fb995a..4bb6a00dd0 100644 --- a/src/com/android/launcher3/allapps/FloatingHeaderView.java +++ b/src/com/android/launcher3/allapps/FloatingHeaderView.java @@ -111,8 +111,8 @@ public class FloatingHeaderView extends LinearLayout implements public FloatingHeaderView(@NonNull Context context, @Nullable AttributeSet attrs) { super(context, attrs); - mHeaderTopPadding = context.getResources() - .getDimensionPixelSize(R.dimen.all_apps_header_top_padding); + mHeaderTopPadding = FeatureFlags.ENABLE_DEVICE_SEARCH.get() ? 0 : + context.getResources().getDimensionPixelSize(R.dimen.all_apps_header_top_padding); } @Override @@ -130,6 +130,7 @@ public class FloatingHeaderView extends LinearLayout implements } } mFixedRows = rows.toArray(new FloatingHeaderRow[rows.size()]); + setPadding(0, mHeaderTopPadding, 0, 0); mAllRows = mFixedRows; } @@ -199,7 +200,7 @@ public class FloatingHeaderView extends LinearLayout implements public View getFocusedChild() { if (FeatureFlags.ENABLE_DEVICE_SEARCH.get()) { for (FloatingHeaderRow row : mAllRows) { - if (row.hasVisibleContent() && row.shouldDraw()) { + if (row.hasVisibleContent()) { return row.getFocusedChild(); } } @@ -247,7 +248,9 @@ public class FloatingHeaderView extends LinearLayout implements public int getMaxTranslation() { if (mMaxTranslation == 0 && mTabsHidden) { - return getResources().getDimensionPixelSize(R.dimen.all_apps_search_bar_bottom_padding); + int paddingOffset = getResources().getDimensionPixelSize( + R.dimen.all_apps_search_bar_bottom_padding); + return FeatureFlags.ENABLE_DEVICE_SEARCH.get() ? 0 : paddingOffset; } else if (mMaxTranslation > 0 && mTabsHidden) { return mMaxTranslation + getPaddingTop(); } else {