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

Commit ddbf138d authored by Brian Colonna's avatar Brian Colonna
Browse files

Fixed misplacement of cancel(X) button for Face Unlock

Before the FUL service started, the FUL cancel button was positioned
off of the right side of the window.  This was because the
FaceUnlockView (derived from RelativeLayout) was calling
super.onMeasure() incorrectly, preventing it from using the new
'square' size when laying out child views.

Change-Id: I2f1e86617da5c8f37123febab2e433288bdea062
parent 68d257d7
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -53,15 +53,17 @@ public class FaceUnlockView extends RelativeLayout {

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        super.onMeasure(widthMeasureSpec, heightMeasureSpec);

        final int minimumWidth = getSuggestedMinimumWidth();
        final int minimumHeight = getSuggestedMinimumHeight();
        int viewWidth = resolveMeasured(widthMeasureSpec, minimumWidth);
        int viewHeight = resolveMeasured(heightMeasureSpec, minimumHeight);

        viewWidth = viewHeight = Math.min(viewWidth, viewHeight);
        Log.v(TAG, "FaceUnlockView dimensions: " + viewWidth + "x" + viewHeight);
        setMeasuredDimension(viewWidth, viewHeight);
        final int chosenSize = Math.min(viewWidth, viewHeight);
        final int newWidthMeasureSpec =
                MeasureSpec.makeMeasureSpec(chosenSize, MeasureSpec.AT_MOST);
        final int newHeightMeasureSpec =
                MeasureSpec.makeMeasureSpec(chosenSize, MeasureSpec.AT_MOST);

        super.onMeasure(newWidthMeasureSpec, newHeightMeasureSpec);
    }
}