FaceUnlockViewpublic class FaceUnlockView extends android.widget.RelativeLayout
Fields Summary |
---|
private static final String | TAG |
Methods Summary |
---|
protected void | onMeasure(int widthMeasureSpec, int heightMeasureSpec)
final int minimumWidth = getSuggestedMinimumWidth();
final int minimumHeight = getSuggestedMinimumHeight();
int viewWidth = resolveMeasured(widthMeasureSpec, minimumWidth);
int viewHeight = resolveMeasured(heightMeasureSpec, minimumHeight);
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);
| private int | resolveMeasured(int measureSpec, int desired)
int result = 0;
int specSize = MeasureSpec.getSize(measureSpec);
switch (MeasureSpec.getMode(measureSpec)) {
case MeasureSpec.UNSPECIFIED:
result = desired;
break;
case MeasureSpec.AT_MOST:
result = Math.max(specSize, desired);
break;
case MeasureSpec.EXACTLY:
default:
result = specSize;
}
return result;
|
|