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

Commit 1bbe3d4b authored by Adrian Roos's avatar Adrian Roos Committed by Android (Google) Code Review
Browse files

Merge "Fix user switcher ripple emanation point" into mnc-dev

parents f7a9aaa1 970be531
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -42,14 +42,21 @@ public class QSDetailClipper {
        }
        final int w = mDetail.getWidth() - x;
        final int h = mDetail.getHeight() - y;
        int innerR = 0;
        if (x < 0 || w < 0 || y < 0 || h < 0) {
            innerR = Math.abs(x);
            innerR = Math.min(innerR, Math.abs(y));
            innerR = Math.min(innerR, Math.abs(w));
            innerR = Math.min(innerR, Math.abs(h));
        }
        int r = (int) Math.ceil(Math.sqrt(x * x + y * y));
        r = (int) Math.max(r, Math.ceil(Math.sqrt(w * w + y * y)));
        r = (int) Math.max(r, Math.ceil(Math.sqrt(w * w + h * h)));
        r = (int) Math.max(r, Math.ceil(Math.sqrt(x * x + h * h)));
        if (in) {
            mAnimator = ViewAnimationUtils.createCircularReveal(mDetail, x, y, 0, r);
            mAnimator = ViewAnimationUtils.createCircularReveal(mDetail, x, y, innerR, r);
        } else {
            mAnimator = ViewAnimationUtils.createCircularReveal(mDetail, x, y, r, 0);
            mAnimator = ViewAnimationUtils.createCircularReveal(mDetail, x, y, r, innerR);
        }
        mAnimator.setDuration((long)(mAnimator.getDuration() * 1.5));
        if (listener != null) {
+20 −2
Original line number Diff line number Diff line
@@ -215,9 +215,19 @@ public class QSPanel extends ViewGroup {
        mFooter.refreshState();
    }

    public void showDetailAdapter(boolean show, DetailAdapter adapter) {
    public void showDetailAdapter(boolean show, DetailAdapter adapter, int[] locationInWindow) {
        int xInWindow = locationInWindow[0];
        int yInWindow = locationInWindow[1];
        mDetail.getLocationInWindow(locationInWindow);

        Record r = new Record();
        r.detailAdapter = adapter;
        r.x = xInWindow - locationInWindow[0];
        r.y = yInWindow - locationInWindow[1];

        locationInWindow[0] = xInWindow;
        locationInWindow[1] = yInWindow;

        showDetail(show, r);
    }

@@ -337,7 +347,13 @@ public class QSPanel extends ViewGroup {
        if (r instanceof TileRecord) {
            handleShowDetailTile((TileRecord) r, show);
        } else {
            handleShowDetailImpl(r, show, getWidth() /* x */, 0/* y */);
            int x = 0;
            int y = 0;
            if (r != null) {
                x = r.x;
                y = r.y;
            }
            handleShowDetailImpl(r, show, x, y);
        }
    }

@@ -558,6 +574,8 @@ public class QSPanel extends ViewGroup {
    private static class Record {
        View detailView;
        DetailAdapter detailAdapter;
        int x;
        int y;
    }

    protected static final class TileRecord extends Record {
+11 −1
Original line number Diff line number Diff line
@@ -42,6 +42,8 @@ public class MultiUserSwitch extends FrameLayout implements View.OnClickListener
    private boolean mKeyguardMode;
    final UserManager mUserManager;

    private final int[] mTmpInt2 = new int[2];

    public MultiUserSwitch(Context context, AttributeSet attrs) {
        super(context, attrs);
        mUserManager = UserManager.get(getContext());
@@ -77,7 +79,15 @@ public class MultiUserSwitch extends FrameLayout implements View.OnClickListener
                    UserSwitcherController userSwitcherController =
                            mQsPanel.getHost().getUserSwitcherController();
                    if (userSwitcherController != null) {
                        mQsPanel.showDetailAdapter(true, userSwitcherController.userDetailAdapter);
                        View center = getChildCount() > 0 ? getChildAt(0) : this;

                        center.getLocationInWindow(mTmpInt2);
                        mTmpInt2[0] += center.getWidth() / 2;
                        mTmpInt2[1] += center.getHeight() / 2;

                        mQsPanel.showDetailAdapter(true,
                                userSwitcherController.userDetailAdapter,
                                mTmpInt2);
                    }
                }
            }