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

Commit 1a28bbb9 authored by Adam Cohen's avatar Adam Cohen Committed by Android (Google) Code Review
Browse files

Merge "Fixing a bug where StackView wasn't always laid out correctly upon loading"

parents 2f803bea f04e2257
Loading
Loading
Loading
Loading
+28 −15
Original line number Diff line number Diff line
@@ -215,10 +215,14 @@ public class StackView extends AdapterViewAnimator {

        // Implement the faked perspective
        if (toIndex != -1) {
            transformViewAtIndex(toIndex, view);
        }
    }

    private void transformViewAtIndex(int index, View view) {
        float maxPerpectiveShift = mViewHeight * PERSPECTIVE_SHIFT_FACTOR;
            int index = toIndex;

            if (toIndex == mNumActiveViews -1) index--;
        if (index == mNumActiveViews -1) index--;

        float r = (index * 1.0f) / (mNumActiveViews - 2);

@@ -237,6 +241,14 @@ public class StackView extends AdapterViewAnimator {
        ObjectAnimator pa = new ObjectAnimator(100, view, scaleX, scaleY, translationY);
        pa.start();
    }

    private void updateChildTransforms() {
        for (int i = 0; i < mNumActiveViews - 1; i++) {
            View v = getViewAtRelativeIndex(i);
            if (v != null) {
                transformViewAtIndex(i, v);
            }
        }
    }

    /**
@@ -271,6 +283,7 @@ public class StackView extends AdapterViewAnimator {
    private void onLayout() {
        if (!mFirstLayoutHappened) {
            mViewHeight = Math.round(SLIDE_UP_RATIO * getMeasuredHeight());
            updateChildTransforms();
            mSwipeThreshold = Math.round(SWIPE_THRESHOLD_RATIO * mViewHeight);
            mFirstLayoutHappened = true;
        }