From f66589db3501e34ff9d81dd1ded4464c5be39218 Mon Sep 17 00:00:00 2001 From: Mario Bertschler Date: Tue, 12 Dec 2017 16:00:22 -0800 Subject: Ensures in all apps that the scrollposition and floating header translation are reset correctly on closing all apps and switching tabs. Change-Id: I86ba3e7bed4c27c485929af5920f76000d323875 --- .../android/launcher3/allapps/AllAppsContainerView.java | 1 + .../android/launcher3/allapps/FloatingHeaderView.java | 17 +++++------------ 2 files changed, 6 insertions(+), 12 deletions(-) (limited to 'src/com/android/launcher3') diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java index 7b89c5c43..f558568c8 100644 --- a/src/com/android/launcher3/allapps/AllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java @@ -495,6 +495,7 @@ public class AllAppsContainerView extends RelativeLayout implements DragSource, public void onPageSelected(int pos) { tabs.updateTabTextColor(pos); mHeader.setMainActive(pos == 0); + reset(); applyTouchDelegate(); if (mAH[pos].recyclerView != null) { mAH[pos].recyclerView.bindFastScrollbar(); diff --git a/src/com/android/launcher3/allapps/FloatingHeaderView.java b/src/com/android/launcher3/allapps/FloatingHeaderView.java index dc3afb5be..409985c23 100644 --- a/src/com/android/launcher3/allapps/FloatingHeaderView.java +++ b/src/com/android/launcher3/allapps/FloatingHeaderView.java @@ -107,6 +107,7 @@ public class FloatingHeaderView extends RelativeLayout implements mWorkRV = setupRV(mWorkRV, mAH[AllAppsContainerView.AdapterHolder.WORK].recyclerView); mParent = (ViewGroup) mMainRV.getParent(); setMainActive(true); + reset(); setupDivider(); } @@ -130,8 +131,6 @@ public class FloatingHeaderView extends RelativeLayout implements public void setMainActive(boolean active) { mCurrentRV = active ? mMainRV : mWorkRV; - mSnappedScrolledY = mCurrentRV.getCurrentScrollY() - mMaxTranslation; - setExpanded(true); } public PredictionRowView getPredictionRow() { @@ -142,10 +141,6 @@ public class FloatingHeaderView extends RelativeLayout implements return mDivider; } - public void reset() { - setExpanded(true); - } - private boolean canSnapAt(int currentScrollY) { return Math.abs(currentScrollY) <= mPredictionRow.getHeight(); } @@ -194,16 +189,14 @@ public class FloatingHeaderView extends RelativeLayout implements } } - private void setExpanded(boolean expand) { - int translateTo = expand ? 0 : -mMaxTranslation; + public void reset() { + int translateTo = 0; mAnimator.setIntValues(mTranslationY, translateTo); mAnimator.addUpdateListener(this); mAnimator.setDuration(150); mAnimator.start(); - mHeaderCollapsed = !expand; - mSnappedScrolledY = expand - ? mCurrentRV.getCurrentScrollY() - mMaxTranslation - : mCurrentRV.getCurrentScrollY(); + mHeaderCollapsed = false; + mSnappedScrolledY = -mMaxTranslation; } public boolean isExpanded() { -- cgit v1.2.3