diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2018-11-20 13:52:55 -0800 |
---|---|---|
committer | Sunny Goyal <sunnygoyal@google.com> | 2018-11-20 13:53:33 -0800 |
commit | 33611be9734fec8fa2d449c51743c7f551a4af06 (patch) | |
tree | 3a1671687a5abff826d21f3fdea13f774a2a47d5 /src/com/android/launcher3/allapps | |
parent | 373e2534d3434d95fac56c95668b3f2daa982f39 (diff) | |
download | android_packages_apps_Trebuchet-33611be9734fec8fa2d449c51743c7f551a4af06.tar.gz android_packages_apps_Trebuchet-33611be9734fec8fa2d449c51743c7f551a4af06.tar.bz2 android_packages_apps_Trebuchet-33611be9734fec8fa2d449c51743c7f551a4af06.zip |
Removing Launcher dependency in search box layout
Bug: 118758696
Change-Id: Id918c44b8bd2a97ab577481b7584afbe56e8a591
Diffstat (limited to 'src/com/android/launcher3/allapps')
4 files changed, 17 insertions, 6 deletions
diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java index 3d15c757d..86b96b4e4 100644 --- a/src/com/android/launcher3/allapps/AllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java @@ -304,6 +304,8 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo mNavBarScrimHeight = insets.bottom; InsettableFrameLayout.dispatchInsets(this, insets); + mLauncher.getAllAppsController() + .setScrollRangeDelta(mSearchUiManager.getScrollRangeDelta(insets)); } @Override diff --git a/src/com/android/launcher3/allapps/AllAppsTransitionController.java b/src/com/android/launcher3/allapps/AllAppsTransitionController.java index 2d6be7b08..ffbf34c7b 100644 --- a/src/com/android/launcher3/allapps/AllAppsTransitionController.java +++ b/src/com/android/launcher3/allapps/AllAppsTransitionController.java @@ -221,7 +221,7 @@ public class AllAppsTransitionController implements StateHandler, OnDeviceProfil /** * Updates the total scroll range but does not update the UI. */ - public void setScrollRangeDelta(float delta) { + void setScrollRangeDelta(float delta) { mScrollRangeDelta = delta; mShiftRange = mLauncher.getDeviceProfile().heightPx - mScrollRangeDelta; diff --git a/src/com/android/launcher3/allapps/SearchUiManager.java b/src/com/android/launcher3/allapps/SearchUiManager.java index 51b90f71e..cf9a0884b 100644 --- a/src/com/android/launcher3/allapps/SearchUiManager.java +++ b/src/com/android/launcher3/allapps/SearchUiManager.java @@ -15,6 +15,7 @@ */ package com.android.launcher3.allapps; +import android.graphics.Rect; import android.view.KeyEvent; import android.view.animation.Interpolator; @@ -42,6 +43,11 @@ public interface SearchUiManager { void preDispatchKeyEvent(KeyEvent keyEvent); /** + * Returns the vertical shift for the all-apps view, so that it aligns with the hotseat. + */ + float getScrollRangeDelta(Rect insets); + + /** * Called as part of state transition to update the content UI */ void setContentVisibility(int visibleElements, PropertySetter setter, diff --git a/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java b/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java index b1e23d4e2..1ff484b49 100644 --- a/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java +++ b/src/com/android/launcher3/allapps/search/AppsSearchContainerLayout.java @@ -208,13 +208,16 @@ public class AppsSearchContainerLayout extends ExtendedEditText 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); + @Override + public float getScrollRangeDelta(Rect insets) { + if (mLauncher.getDeviceProfile().isVerticalBarLayout()) { + return 0; } else { - mLauncher.getAllAppsController().setScrollRangeDelta( - insets.bottom + mlp.topMargin + mFixedTranslationY); + int topMargin = Math.round(Math.max( + -mFixedTranslationY, insets.top - mMarginTopAdjusting)); + return insets.bottom + topMargin + mFixedTranslationY; } } |