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
diff --git a/src/com/android/launcher3/allapps/FloatingHeaderView.java b/src/com/android/launcher3/allapps/FloatingHeaderView.java
index 11d3fb9..4bb6a00 100644
--- a/src/com/android/launcher3/allapps/FloatingHeaderView.java
+++ b/src/com/android/launcher3/allapps/FloatingHeaderView.java
@@ -111,8 +111,8 @@
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 @@
}
}
mFixedRows = rows.toArray(new FloatingHeaderRow[rows.size()]);
+ setPadding(0, mHeaderTopPadding, 0, 0);
mAllRows = mFixedRows;
}
@@ -199,7 +200,7 @@
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 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 {