diff options
author | Scott Lobdell <slobdell@google.com> | 2021-03-29 16:12:49 +0000 |
---|---|---|
committer | Scott Lobdell <slobdell@google.com> | 2021-04-02 22:35:29 +0000 |
commit | 21cdef883cc867db55340b25d5c95e19b12ab383 (patch) | |
tree | 93d1444ebe783f53f5f0ae2647592723b27b3fb8 /packages/SystemUI/src/com/android/keyguard/NumPadKey.java | |
parent | 7deab3736bb5f3a92be8ac820096926dce2366ad (diff) | |
parent | d1d45f856fdf68835f5b42eacecab44e6dfa8545 (diff) |
Merge SP1A.210329.001
Change-Id: I1e21c5890b5b2e2f2855f09960bc8eec8aa922bf
Diffstat (limited to 'packages/SystemUI/src/com/android/keyguard/NumPadKey.java')
-rw-r--r-- | packages/SystemUI/src/com/android/keyguard/NumPadKey.java | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/NumPadKey.java b/packages/SystemUI/src/com/android/keyguard/NumPadKey.java index e6a9d4fdd547..89c1a7fe21ca 100644 --- a/packages/SystemUI/src/com/android/keyguard/NumPadKey.java +++ b/packages/SystemUI/src/com/android/keyguard/NumPadKey.java @@ -18,6 +18,7 @@ package com.android.keyguard; import android.content.Context; import android.content.res.TypedArray; +import android.graphics.drawable.Drawable; import android.graphics.drawable.LayerDrawable; import android.os.PowerManager; import android.os.SystemClock; @@ -31,6 +32,8 @@ import android.view.ViewGroup; import android.view.accessibility.AccessibilityManager; import android.widget.TextView; +import androidx.annotation.Nullable; + import com.android.internal.widget.LockPatternUtils; import com.android.settingslib.Utils; import com.android.systemui.R; @@ -48,6 +51,7 @@ public class NumPadKey extends ViewGroup { private int mTextViewResId; private PasswordTextView mTextView; + @Nullable private NumPadAnimator mAnimator; private View.OnClickListener mListener = new View.OnClickListener() { @@ -127,8 +131,13 @@ public class NumPadKey extends ViewGroup { setContentDescription(mDigitText.getText().toString()); - mAnimator = new NumPadAnimator(context, (LayerDrawable) getBackground(), - R.style.NumPadKey); + Drawable background = getBackground(); + if (background instanceof LayerDrawable) { + mAnimator = new NumPadAnimator(context, (LayerDrawable) background, + R.style.NumPadKey); + } else { + mAnimator = null; + } } /** @@ -136,10 +145,12 @@ public class NumPadKey extends ViewGroup { */ public void disableNewLayout() { findViewById(R.id.klondike_text).setVisibility(View.VISIBLE); - mAnimator = null; - ContextThemeWrapper ctw = new ContextThemeWrapper(getContext(), R.style.NumPadKey); - setBackground(getContext().getResources().getDrawable( - R.drawable.ripple_drawable_pin, ctw.getTheme())); + if (mAnimator != null) { + mAnimator = null; + ContextThemeWrapper ctw = new ContextThemeWrapper(getContext(), R.style.NumPadKey); + setBackground(getContext().getResources().getDrawable( + R.drawable.ripple_drawable_pin, ctw.getTheme())); + } } /** @@ -167,13 +178,6 @@ public class NumPadKey extends ViewGroup { } @Override - public void setLayoutParams(ViewGroup.LayoutParams params) { - if (mAnimator != null) mAnimator.updateMargin((ViewGroup.MarginLayoutParams) params); - - super.setLayoutParams(params); - } - - @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); measureChildren(widthMeasureSpec, heightMeasureSpec); |