Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ffa3bb97 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Ensures in all apps that the scrollposition and floating header...

Merge "Ensures in all apps that the scrollposition and floating header translation are reset correctly on closing all apps and switching tabs." into ub-launcher3-master
parents 7c5756bc f66589db
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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();
+5 −12
Original line number Diff line number Diff line
@@ -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() {