From 47f80b5c9a02ae8326ebcd5453136720ec52b633 Mon Sep 17 00:00:00 2001 From: Samuel Fufa Date: Fri, 10 Sep 2021 15:58:04 -0700 Subject: [PATCH] [Search] Apply background to entire SearchInput view instead of just EditText Bug: 199555357 Test: visual Change-Id: Ice966416e901e7c601b44529d0422798e943e222 --- src/com/android/launcher3/ExtendedEditText.java | 16 ---------------- .../launcher3/allapps/AllAppsContainerView.java | 7 +++---- .../launcher3/allapps/SearchUiManager.java | 13 +++++++++++++ 3 files changed, 16 insertions(+), 20 deletions(-) diff --git a/src/com/android/launcher3/ExtendedEditText.java b/src/com/android/launcher3/ExtendedEditText.java index 21bc479c22..92432a836b 100644 --- a/src/com/android/launcher3/ExtendedEditText.java +++ b/src/com/android/launcher3/ExtendedEditText.java @@ -26,7 +26,6 @@ import android.view.View; import android.view.inputmethod.InputMethodManager; import android.widget.EditText; -import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.views.ActivityContext; @@ -99,18 +98,6 @@ public class ExtendedEditText extends EditText { } } - /** - * Sets whether EditText background should be visible - * @param maxAlpha defines the maximum alpha the background should animates to - */ - public void setBackgroundVisibility(boolean visible, float maxAlpha) {} - - /** - * Returns whether a visible background is set on EditText - */ - public boolean getBackgroundVisibility() { - return getBackground() != null; - } public void showKeyboard() { mShowImeAfterFirstLayout = !showSoftInput(); @@ -150,9 +137,6 @@ public class ExtendedEditText extends EditText { if (!TextUtils.isEmpty(getText())) { setText(""); } - if (FeatureFlags.ENABLE_DEVICE_SEARCH.get()) { - return; - } if (isFocused()) { View nextFocus = focusSearch(View.FOCUS_DOWN); if (nextFocus != null) { diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java index e779ee80ea..424ea22006 100644 --- a/src/com/android/launcher3/allapps/AllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java @@ -59,7 +59,6 @@ import com.android.launcher3.DeviceProfile; import com.android.launcher3.DeviceProfile.OnDeviceProfileChangeListener; import com.android.launcher3.DragSource; import com.android.launcher3.DropTarget.DragObject; -import com.android.launcher3.ExtendedEditText; import com.android.launcher3.Insettable; import com.android.launcher3.InsettableFrameLayout; import com.android.launcher3.R; @@ -639,6 +638,7 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo public void onClearSearchResult() { mIsSearching = false; + mHeader.setCollapsed(false); rebindAdapters(); getActiveRecyclerView().scrollToTop(); } @@ -814,14 +814,13 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo invalidateHeader(); } if (mSearchUiManager.getEditText() != null) { - ExtendedEditText editText = mSearchUiManager.getEditText(); - boolean bgVisible = editText.getBackgroundVisibility(); + boolean bgVisible = mSearchUiManager.getBackgroundVisibility(); if (scrolledOffset == 0 && !mIsSearching) { bgVisible = true; } else if (scrolledOffset > mHeaderThreshold) { bgVisible = false; } - editText.setBackgroundVisibility(bgVisible, 1 - prog); + mSearchUiManager.setBackgroundVisibility(bgVisible, 1 - prog); } } diff --git a/src/com/android/launcher3/allapps/SearchUiManager.java b/src/com/android/launcher3/allapps/SearchUiManager.java index 924a392389..7478b53d55 100644 --- a/src/com/android/launcher3/allapps/SearchUiManager.java +++ b/src/com/android/launcher3/allapps/SearchUiManager.java @@ -48,6 +48,19 @@ public interface SearchUiManager { @Nullable ExtendedEditText getEditText(); + /** + * Sets whether EditText background should be visible + * @param maxAlpha defines the maximum alpha the background should animates to + */ + default void setBackgroundVisibility(boolean visible, float maxAlpha) {} + + /** + * Returns whether a visible background is set on EditText + */ + default boolean getBackgroundVisibility() { + return false; + } + /** * sets highlight result's title */