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

Commit fa8cb026 authored by Fabian Kozynski's avatar Fabian Kozynski Committed by Android (Google) Code Review
Browse files

Merge "[Flexiglass] Fix 1px rounding error" into main

parents dc9cbe84 9c4b182c
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -103,8 +103,7 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout {
    }
    private int mLastMaxHeight = -1;

    @Override
    public void setPageMargin(int marginPixels) {
    public void setPageMargin(int marginPixelsStart, int marginPixelsEnd) {
        // Using page margins creates some rounding issues that interfere with the correct position
        // in the onPageChangedListener and therefore present bad positions to the PageIndicator.
        // Instead, we use negative margins in the container and positive padding in the pages,
@@ -113,14 +112,19 @@ public class PagedTileLayout extends ViewPager implements QSTileLayout {
        // QSContainerImpl resources are set onAttachedView, so this view will always have the right
        // values when attached.
        MarginLayoutParams lp = (MarginLayoutParams) getLayoutParams();
        lp.setMarginStart(-marginPixels);
        lp.setMarginEnd(-marginPixels);
        lp.setMarginStart(-marginPixelsStart);
        lp.setMarginEnd(-marginPixelsEnd);
        setLayoutParams(lp);

        int nPages = mPages.size();
        for (int i = 0; i < nPages; i++) {
            View v = mPages.get(i);
            v.setPadding(marginPixels, v.getPaddingTop(), marginPixels, v.getPaddingBottom());
            v.setPadding(
                    marginPixelsStart,
                    v.getPaddingTop(),
                    marginPixelsEnd,
                    v.getPaddingBottom()
            );
        }
    }

+14 −1
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ import androidx.annotation.Nullable;
import com.android.systemui.Dumpable;
import com.android.systemui.qs.customize.QSCustomizer;
import com.android.systemui.res.R;
import com.android.systemui.scene.shared.flag.SceneContainerFlag;
import com.android.systemui.shade.LargeScreenHeaderHelper;
import com.android.systemui.shade.TouchLogger;
import com.android.systemui.util.LargeScreenUtils;
@@ -300,7 +301,7 @@ public class QSContainerImpl extends FrameLayout implements Dumpable {
                // QS panel lays out some of its content full width
                qsPanelController.setContentMargins(mContentHorizontalPadding,
                        mContentHorizontalPadding);
                qsPanelController.setPageMargin(mTilesPageMargin);
                setPageMargins(qsPanelController);
            } else if (view == mHeader) {
                quickStatusBarHeaderController.setContentMargins(mContentHorizontalPadding,
                        mContentHorizontalPadding);
@@ -318,6 +319,18 @@ public class QSContainerImpl extends FrameLayout implements Dumpable {
        }
    }

    private void setPageMargins(QSPanelController qsPanelController) {
        if (SceneContainerFlag.isEnabled()) {
            if (mHorizontalMargins == mTilesPageMargin * 2 + 1) {
                qsPanelController.setPageMargin(mTilesPageMargin, mTilesPageMargin + 1);
            } else {
                qsPanelController.setPageMargin(mTilesPageMargin, mTilesPageMargin);
            }
        } else {
            qsPanelController.setPageMargin(mTilesPageMargin, mTilesPageMargin);
        }
    }

    /**
     * Clip QS bottom using a concave shape.
     */
+2 −2
Original line number Diff line number Diff line
@@ -638,9 +638,9 @@ public class QSPanel extends LinearLayout implements Tunable {
        return mListening;
    }

    protected void setPageMargin(int pageMargin) {
    protected void setPageMargin(int pageMarginStart, int pageMarginEnd) {
        if (mTileLayout instanceof PagedTileLayout) {
            ((PagedTileLayout) mTileLayout).setPageMargin(pageMargin);
            ((PagedTileLayout) mTileLayout).setPageMargin(pageMarginStart, pageMarginEnd);
        }
    }

+2 −2
Original line number Diff line number Diff line
@@ -284,8 +284,8 @@ public class QSPanelController extends QSPanelControllerBase<QSPanel> {
        return mView.isExpanded();
    }

    void setPageMargin(int pageMargin) {
        mView.setPageMargin(pageMargin);
    void setPageMargin(int pageMarginStart, int pageMarginEnd) {
        mView.setPageMargin(pageMarginStart, pageMarginEnd);
    }

    /**