Loading res/layout/all_apps.xml +1 −1 Original line number Diff line number Diff line Loading @@ -87,7 +87,7 @@ android:layout_height="match_parent" android:background="@android:color/transparent" android:focusableInTouchMode="true" android:gravity="start|center_vertical" android:gravity="center" android:imeOptions="actionSearch|flagNoExtractUi" android:inputType="text|textNoSuggestions|textCapWords" android:maxLines="1" Loading src/com/android/launcher3/allapps/AllAppsContainerView.java +1 −32 Original line number Diff line number Diff line Loading @@ -15,7 +15,6 @@ */ package com.android.launcher3.allapps; import android.animation.ObjectAnimator; import android.annotation.SuppressLint; import android.content.Context; import android.content.res.Resources; Loading @@ -31,7 +30,6 @@ import android.view.MotionEvent; import android.view.View; import android.view.ViewConfiguration; import android.view.ViewGroup; import android.view.animation.AnimationUtils; import com.android.launcher3.AppInfo; import com.android.launcher3.BaseContainerView; Loading Loading @@ -242,6 +240,7 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc } mSearchBarController = searchController; mSearchBarController.initialize(mApps, mSearchInput, mLauncher, this); mSearchBarController.setHintView(findViewById(R.id.search_hint)); mAdapter.setSearchController(mSearchBarController); } Loading Loading @@ -312,36 +311,6 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc mSearchContainerOffsetTop = getResources().getDimensionPixelSize( R.dimen.all_apps_search_bar_margin_top); final View searchHint = findViewById(R.id.search_hint); final ObjectAnimator searchInputAnimator = ObjectAnimator.ofFloat(mSearchInput, View.TRANSLATION_X, 0); searchInputAnimator.setDuration(getContext().getResources().getInteger( R.integer.config_searchHintAnimationDuration)); searchInputAnimator.setInterpolator(AnimationUtils.loadInterpolator(getContext(), android.R.interpolator.accelerate_decelerate)); mSearchInput.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View view, boolean focused) { if (focused) { searchHint.setVisibility(View.INVISIBLE); if (searchInputAnimator.isRunning()) { searchInputAnimator.end(); } if (Utilities.isRtl(getContext().getResources())) { searchInputAnimator.setFloatValues(-searchHint.getLeft(), 0); } else { searchInputAnimator.setFloatValues(searchHint.getLeft(), 0); } searchInputAnimator.start(); } else { searchHint.setVisibility(View.VISIBLE); mSearchInput.setTranslationX(0); } } }); mElevationController = Utilities.ATLEAST_LOLLIPOP ? new HeaderElevationController.ControllerVL(mSearchContainer) : new HeaderElevationController.ControllerV16(mSearchContainer); Loading src/com/android/launcher3/allapps/AllAppsSearchBarController.java +26 −1 Original line number Diff line number Diff line Loading @@ -39,7 +39,8 @@ import java.util.ArrayList; * An interface to a search box that AllApps can command. */ public abstract class AllAppsSearchBarController implements TextWatcher, OnEditorActionListener, ExtendedEditText.OnBackKeyListener { implements TextWatcher, OnEditorActionListener, ExtendedEditText.OnBackKeyListener, View.OnFocusChangeListener { protected Launcher mLauncher; protected AlphabeticalAppsList mApps; Loading @@ -49,6 +50,8 @@ public abstract class AllAppsSearchBarController protected DefaultAppSearchAlgorithm mSearchAlgorithm; protected InputMethodManager mInputMethodManager; protected View mHintView; public void setVisibility(int visibility) { mInput.setVisibility(visibility); } Loading @@ -66,6 +69,7 @@ public abstract class AllAppsSearchBarController mInput.addTextChangedListener(this); mInput.setOnEditorActionListener(this); mInput.setOnBackKeyListener(this); mInput.setOnFocusChangeListener(this); mInputMethodManager = (InputMethodManager) mInput.getContext().getSystemService(Context.INPUT_METHOD_SERVICE); Loading Loading @@ -126,6 +130,27 @@ public abstract class AllAppsSearchBarController return false; } @Override public void onFocusChange(View view, boolean focused) { if (mHintView != null) { mHintView.setVisibility(focused ? View.INVISIBLE : View.VISIBLE); } } /** * Sets a view to serve as the search field's hint. */ public void setHintView(View hintView) { mHintView = hintView; } /** * Returns the search field's hint view. */ public View getHintView() { return mHintView; } /** * Resets the search bar state. */ Loading Loading
res/layout/all_apps.xml +1 −1 Original line number Diff line number Diff line Loading @@ -87,7 +87,7 @@ android:layout_height="match_parent" android:background="@android:color/transparent" android:focusableInTouchMode="true" android:gravity="start|center_vertical" android:gravity="center" android:imeOptions="actionSearch|flagNoExtractUi" android:inputType="text|textNoSuggestions|textCapWords" android:maxLines="1" Loading
src/com/android/launcher3/allapps/AllAppsContainerView.java +1 −32 Original line number Diff line number Diff line Loading @@ -15,7 +15,6 @@ */ package com.android.launcher3.allapps; import android.animation.ObjectAnimator; import android.annotation.SuppressLint; import android.content.Context; import android.content.res.Resources; Loading @@ -31,7 +30,6 @@ import android.view.MotionEvent; import android.view.View; import android.view.ViewConfiguration; import android.view.ViewGroup; import android.view.animation.AnimationUtils; import com.android.launcher3.AppInfo; import com.android.launcher3.BaseContainerView; Loading Loading @@ -242,6 +240,7 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc } mSearchBarController = searchController; mSearchBarController.initialize(mApps, mSearchInput, mLauncher, this); mSearchBarController.setHintView(findViewById(R.id.search_hint)); mAdapter.setSearchController(mSearchBarController); } Loading Loading @@ -312,36 +311,6 @@ public class AllAppsContainerView extends BaseContainerView implements DragSourc mSearchContainerOffsetTop = getResources().getDimensionPixelSize( R.dimen.all_apps_search_bar_margin_top); final View searchHint = findViewById(R.id.search_hint); final ObjectAnimator searchInputAnimator = ObjectAnimator.ofFloat(mSearchInput, View.TRANSLATION_X, 0); searchInputAnimator.setDuration(getContext().getResources().getInteger( R.integer.config_searchHintAnimationDuration)); searchInputAnimator.setInterpolator(AnimationUtils.loadInterpolator(getContext(), android.R.interpolator.accelerate_decelerate)); mSearchInput.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View view, boolean focused) { if (focused) { searchHint.setVisibility(View.INVISIBLE); if (searchInputAnimator.isRunning()) { searchInputAnimator.end(); } if (Utilities.isRtl(getContext().getResources())) { searchInputAnimator.setFloatValues(-searchHint.getLeft(), 0); } else { searchInputAnimator.setFloatValues(searchHint.getLeft(), 0); } searchInputAnimator.start(); } else { searchHint.setVisibility(View.VISIBLE); mSearchInput.setTranslationX(0); } } }); mElevationController = Utilities.ATLEAST_LOLLIPOP ? new HeaderElevationController.ControllerVL(mSearchContainer) : new HeaderElevationController.ControllerV16(mSearchContainer); Loading
src/com/android/launcher3/allapps/AllAppsSearchBarController.java +26 −1 Original line number Diff line number Diff line Loading @@ -39,7 +39,8 @@ import java.util.ArrayList; * An interface to a search box that AllApps can command. */ public abstract class AllAppsSearchBarController implements TextWatcher, OnEditorActionListener, ExtendedEditText.OnBackKeyListener { implements TextWatcher, OnEditorActionListener, ExtendedEditText.OnBackKeyListener, View.OnFocusChangeListener { protected Launcher mLauncher; protected AlphabeticalAppsList mApps; Loading @@ -49,6 +50,8 @@ public abstract class AllAppsSearchBarController protected DefaultAppSearchAlgorithm mSearchAlgorithm; protected InputMethodManager mInputMethodManager; protected View mHintView; public void setVisibility(int visibility) { mInput.setVisibility(visibility); } Loading @@ -66,6 +69,7 @@ public abstract class AllAppsSearchBarController mInput.addTextChangedListener(this); mInput.setOnEditorActionListener(this); mInput.setOnBackKeyListener(this); mInput.setOnFocusChangeListener(this); mInputMethodManager = (InputMethodManager) mInput.getContext().getSystemService(Context.INPUT_METHOD_SERVICE); Loading Loading @@ -126,6 +130,27 @@ public abstract class AllAppsSearchBarController return false; } @Override public void onFocusChange(View view, boolean focused) { if (mHintView != null) { mHintView.setVisibility(focused ? View.INVISIBLE : View.VISIBLE); } } /** * Sets a view to serve as the search field's hint. */ public void setHintView(View hintView) { mHintView = hintView; } /** * Returns the search field's hint view. */ public View getHintView() { return mHintView; } /** * Resets the search bar state. */ Loading