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

Commit ee350b65 authored by Kevin Chyn's avatar Kevin Chyn
Browse files

Update BiometricPrompt UI for large displays

Piggy backs on existing SystemUI Util method that determines when
split notification shade, lockscreen, etc should be shown.

Bug: 201811580
Test: manual
Change-Id: I59089884992018e183d15c47e07967b91d27f935
parent 7f569944
Loading
Loading
Loading
Loading
+15 −1
Original line number Diff line number Diff line
@@ -824,11 +824,25 @@ public abstract class AuthBiometricView extends LinearLayout {
        return new AuthDialog.LayoutParams(width, totalHeight);
    }

    private boolean isLargeDisplay() {
        return com.android.systemui.util.Utils.shouldUseSplitNotificationShade(getResources());
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        final int width = MeasureSpec.getSize(widthMeasureSpec);
        final int height = MeasureSpec.getSize(heightMeasureSpec);
        final int newWidth = Math.min(width, height);

        final boolean isLargeDisplay = isLargeDisplay();

        final int newWidth;
        if (isLargeDisplay) {
            // TODO(b/201811580): Unless we can come up with a one-size-fits-all equation, we may
            //  want to consider moving this to an overlay.
            newWidth = 2 * Math.min(width, height) / 3;
        } else {
            newWidth = Math.min(width, height);
        }

        // Use "newWidth" instead, so the landscape dialog width is the same as the portrait
        // width.
+0 −18
Original line number Diff line number Diff line
@@ -117,24 +117,6 @@ public class AuthPanelController extends ViewOutlineProvider {
        mUseFullScreen = fullScreen;
    }

    public ValueAnimator getTranslationAnimator(float relativeTranslationY) {
        final ValueAnimator animator = ValueAnimator.ofFloat(
                mPanelView.getY(), mPanelView.getY() - relativeTranslationY);
        animator.addUpdateListener(animation -> {
            final float translation = (float) animation.getAnimatedValue();
            mPanelView.setTranslationY(translation);
        });
        return animator;
    }

    public ValueAnimator getAlphaAnimator(float alpha) {
        final ValueAnimator animator = ValueAnimator.ofFloat(mPanelView.getAlpha(), alpha);
        animator.addUpdateListener(animation -> {
            mPanelView.setAlpha((float) animation.getAnimatedValue());
        });
        return animator;
    }

    public void updateForContentDimensions(int contentWidth, int contentHeight,
            int animateDurationMs) {
        if (DEBUG) {