Merge "Update BiometricPrompt UI for large displays" into sc-v2-dev am: 80b2606f14 am: 289f2a6266
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15995212 Change-Id: I79651075b5a07dcd7308f667b7b3b9b53668eeb5
This commit is contained in:
@@ -824,11 +824,29 @@ public abstract class AuthBiometricView extends LinearLayout {
|
||||
return new AuthDialog.LayoutParams(width, totalHeight);
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple heuristic which should return true displays that are larger than a normal phone.
|
||||
* For example, tablet displays, or the unfolded display for foldables.
|
||||
*/
|
||||
private boolean isLargeDisplay(int width, int height) {
|
||||
return width > 1200 && height > 1200;
|
||||
}
|
||||
|
||||
@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);
|
||||
|
||||
Log.d(TAG, "Width: " + width + ", height: " + height);
|
||||
|
||||
final int newWidth;
|
||||
if (isLargeDisplay(width, height)) {
|
||||
// TODO: 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.
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user