diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2018-04-30 21:31:50 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2018-04-30 21:31:50 +0000 |
commit | 1ea6d9cb8ee4f0784fb441f8923ca3d7f3a1bf78 (patch) | |
tree | 7e8f07bae93b282500e7bb0f0567dc53defe8de0 | |
parent | 6dcf142f61dfa18039349022e537dfe218bebcc2 (diff) | |
parent | df296898dade92c961cbe28904fd3a959211f518 (diff) | |
download | android_packages_apps_Trebuchet-1ea6d9cb8ee4f0784fb441f8923ca3d7f3a1bf78.tar.gz android_packages_apps_Trebuchet-1ea6d9cb8ee4f0784fb441f8923ca3d7f3a1bf78.tar.bz2 android_packages_apps_Trebuchet-1ea6d9cb8ee4f0784fb441f8923ca3d7f3a1bf78.zip |
Merge "Fixing Search box not getting aligned properly based on insets" into ub-launcher3-edmonton
-rw-r--r-- | res/layout/search_container_all_apps.xml | 1 | ||||
-rw-r--r-- | src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java | 15 |
2 files changed, 12 insertions, 4 deletions
diff --git a/res/layout/search_container_all_apps.xml b/res/layout/search_container_all_apps.xml index 14d7b53b6..fd9cb60fc 100644 --- a/res/layout/search_container_all_apps.xml +++ b/res/layout/search_container_all_apps.xml @@ -20,7 +20,6 @@ android:layout_height="@dimen/all_apps_search_bar_field_height" android:layout_centerHorizontal="true" android:layout_gravity="top|center_horizontal" - android:layout_marginTop="8dp" android:background="@drawable/bg_all_apps_searchbox" android:elevation="1dp" android:focusableInTouchMode="true" diff --git a/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java b/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java index ad61c55db..ab6635e45 100644 --- a/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java +++ b/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java @@ -62,6 +62,10 @@ public class AppsSearchContainerLayout extends ExtendedEditText private AlphabeticalAppsList mApps; private AllAppsContainerView mAppsView; + // This value was used to position the QSB. We store it here for translationY animations. + private final float mFixedTranslationY; + private final float mMarginTopAdjusting; + public AppsSearchContainerLayout(Context context) { this(context, null); } @@ -79,6 +83,9 @@ public class AppsSearchContainerLayout extends ExtendedEditText mSearchQueryBuilder = new SpannableStringBuilder(); Selection.setSelection(mSearchQueryBuilder, 0); + mFixedTranslationY = getTranslationY(); + mMarginTopAdjusting = mFixedTranslationY - getPaddingTop(); + // Update the hint to contain the icon. // Prefix the original hint with two spaces. The first space gets replaced by the icon // using span. The second space is used for a singe space character between the hint @@ -195,14 +202,16 @@ public class AppsSearchContainerLayout extends ExtendedEditText @Override public void setInsets(Rect insets) { + MarginLayoutParams mlp = (MarginLayoutParams) getLayoutParams(); + mlp.topMargin = Math.round(Math.max(-mFixedTranslationY, insets.top - mMarginTopAdjusting)); + requestLayout(); + DeviceProfile dp = mLauncher.getDeviceProfile(); if (dp.isVerticalBarLayout()) { mLauncher.getAllAppsController().setScrollRangeDelta(0); } else { - MarginLayoutParams mlp = ((MarginLayoutParams) getLayoutParams()); - int myBot = mlp.topMargin + (int) getTranslationY() + mlp.height; mLauncher.getAllAppsController().setScrollRangeDelta( - dp.hotseatBarBottomPaddingPx + myBot); + insets.bottom + mlp.topMargin + mFixedTranslationY); } } } |