diff options
Diffstat (limited to 'packages/SystemUI/src/com/android/keyguard/NumPadButton.java')
-rw-r--r-- | packages/SystemUI/src/com/android/keyguard/NumPadButton.java | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/NumPadButton.java b/packages/SystemUI/src/com/android/keyguard/NumPadButton.java index 0d31906d2f80..099e6f4b5341 100644 --- a/packages/SystemUI/src/com/android/keyguard/NumPadButton.java +++ b/packages/SystemUI/src/com/android/keyguard/NumPadButton.java @@ -17,6 +17,7 @@ package com.android.keyguard; import android.content.Context; import android.content.res.ColorStateList; +import android.content.res.Configuration; import android.graphics.drawable.Drawable; import android.graphics.drawable.RippleDrawable; import android.graphics.drawable.VectorDrawable; @@ -26,7 +27,6 @@ import android.view.MotionEvent; import androidx.annotation.Nullable; import com.android.settingslib.Utils; -import com.android.systemui.R; /** * Similar to the {@link NumPadKey}, but displays an image. @@ -35,6 +35,7 @@ public class NumPadButton extends AlphaOptimizedImageButton { @Nullable private NumPadAnimator mAnimator; + private int mOrientation; public NumPadButton(Context context, AttributeSet attrs) { super(context, attrs); @@ -49,13 +50,21 @@ public class NumPadButton extends AlphaOptimizedImageButton { } @Override + protected void onConfigurationChanged(Configuration newConfig) { + mOrientation = newConfig.orientation; + } + + @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); // Set width/height to the same value to ensure a smooth circle for the bg, but shrink // the height to match the old pin bouncer int width = getMeasuredWidth(); - int height = mAnimator == null ? (int) (width * .75f) : width; + + boolean shortenHeight = mAnimator == null + || mOrientation == Configuration.ORIENTATION_LANDSCAPE; + int height = shortenHeight ? (int) (width * .66f) : width; setMeasuredDimension(getMeasuredWidth(), height); } |