summaryrefslogtreecommitdiff
path: root/packages/SystemUI/src/com/android/keyguard/NumPadKey.java
diff options
context:
space:
mode:
Diffstat (limited to 'packages/SystemUI/src/com/android/keyguard/NumPadKey.java')
-rw-r--r--packages/SystemUI/src/com/android/keyguard/NumPadKey.java37
1 files changed, 7 insertions, 30 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/NumPadKey.java b/packages/SystemUI/src/com/android/keyguard/NumPadKey.java
index 89c1a7fe21ca..35ace0d1a404 100644
--- a/packages/SystemUI/src/com/android/keyguard/NumPadKey.java
+++ b/packages/SystemUI/src/com/android/keyguard/NumPadKey.java
@@ -18,12 +18,10 @@ 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.graphics.drawable.RippleDrawable;
import android.os.PowerManager;
import android.os.SystemClock;
import android.util.AttributeSet;
-import android.view.ContextThemeWrapper;
import android.view.HapticFeedbackConstants;
import android.view.LayoutInflater;
import android.view.MotionEvent;
@@ -32,8 +30,6 @@ 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;
@@ -51,7 +47,6 @@ public class NumPadKey extends ViewGroup {
private int mTextViewResId;
private PasswordTextView mTextView;
- @Nullable
private NumPadAnimator mAnimator;
private View.OnClickListener mListener = new View.OnClickListener() {
@@ -131,26 +126,8 @@ public class NumPadKey extends ViewGroup {
setContentDescription(mDigitText.getText().toString());
- Drawable background = getBackground();
- if (background instanceof LayerDrawable) {
- mAnimator = new NumPadAnimator(context, (LayerDrawable) background,
- R.style.NumPadKey);
- } else {
- mAnimator = null;
- }
- }
-
- /**
- * By default, the new layout will be enabled. Invoking will revert to the old style
- */
- public void disableNewLayout() {
- findViewById(R.id.klondike_text).setVisibility(View.VISIBLE);
- if (mAnimator != null) {
- mAnimator = null;
- ContextThemeWrapper ctw = new ContextThemeWrapper(getContext(), R.style.NumPadKey);
- setBackground(getContext().getResources().getDrawable(
- R.drawable.ripple_drawable_pin, ctw.getTheme()));
- }
+ mAnimator = new NumPadAnimator(context, (RippleDrawable) getBackground(),
+ R.style.NumPadKey);
}
/**
@@ -164,14 +141,14 @@ public class NumPadKey extends ViewGroup {
mDigitText.setTextColor(textColor);
mKlondikeText.setTextColor(klondikeColor);
- if (mAnimator != null) mAnimator.reloadColors(getContext());
+ mAnimator.reloadColors(getContext());
}
@Override
public boolean onTouchEvent(MotionEvent event) {
if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
doHapticKeyClick();
- if (mAnimator != null) mAnimator.start();
+ mAnimator.start();
}
return super.onTouchEvent(event);
@@ -185,7 +162,7 @@ public class NumPadKey extends ViewGroup {
// 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;
+ int height = width;
setMeasuredDimension(getMeasuredWidth(), height);
}
@@ -206,7 +183,7 @@ public class NumPadKey extends ViewGroup {
left = centerX - mKlondikeText.getMeasuredWidth() / 2;
mKlondikeText.layout(left, top, left + mKlondikeText.getMeasuredWidth(), bottom);
- if (mAnimator != null) mAnimator.onLayout(b - t);
+ mAnimator.onLayout(b - t);
}
@Override