Merge "Fix broken keyguard in car sysui" into sc-dev
This commit is contained in:
@@ -17,6 +17,7 @@ package com.android.keyguard;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.ColorStateList;
|
import android.content.res.ColorStateList;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
import android.graphics.drawable.LayerDrawable;
|
import android.graphics.drawable.LayerDrawable;
|
||||||
import android.graphics.drawable.VectorDrawable;
|
import android.graphics.drawable.VectorDrawable;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
@@ -24,6 +25,8 @@ import android.view.ContextThemeWrapper;
|
|||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import com.android.settingslib.Utils;
|
import com.android.settingslib.Utils;
|
||||||
import com.android.systemui.R;
|
import com.android.systemui.R;
|
||||||
|
|
||||||
@@ -32,13 +35,19 @@ import com.android.systemui.R;
|
|||||||
*/
|
*/
|
||||||
public class NumPadButton extends AlphaOptimizedImageButton {
|
public class NumPadButton extends AlphaOptimizedImageButton {
|
||||||
|
|
||||||
|
@Nullable
|
||||||
private NumPadAnimator mAnimator;
|
private NumPadAnimator mAnimator;
|
||||||
|
|
||||||
public NumPadButton(Context context, AttributeSet attrs) {
|
public NumPadButton(Context context, AttributeSet attrs) {
|
||||||
super(context, attrs);
|
super(context, attrs);
|
||||||
|
|
||||||
mAnimator = new NumPadAnimator(context, (LayerDrawable) getBackground(),
|
Drawable background = getBackground();
|
||||||
attrs.getStyleAttribute());
|
if (background instanceof LayerDrawable) {
|
||||||
|
mAnimator = new NumPadAnimator(context, (LayerDrawable) background,
|
||||||
|
attrs.getStyleAttribute());
|
||||||
|
} else {
|
||||||
|
mAnimator = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -93,9 +102,11 @@ public class NumPadButton extends AlphaOptimizedImageButton {
|
|||||||
* By default, the new layout will be enabled. Invoking will revert to the old style
|
* By default, the new layout will be enabled. Invoking will revert to the old style
|
||||||
*/
|
*/
|
||||||
public void disableNewLayout() {
|
public void disableNewLayout() {
|
||||||
mAnimator = null;
|
if (mAnimator != null) {
|
||||||
ContextThemeWrapper ctw = new ContextThemeWrapper(getContext(), R.style.NumPadKey);
|
mAnimator = null;
|
||||||
setBackground(getContext().getResources().getDrawable(
|
ContextThemeWrapper ctw = new ContextThemeWrapper(getContext(), R.style.NumPadKey);
|
||||||
R.drawable.ripple_drawable_pin, ctw.getTheme()));
|
setBackground(getContext().getResources().getDrawable(
|
||||||
|
R.drawable.ripple_drawable_pin, ctw.getTheme()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ package com.android.keyguard;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
import android.graphics.drawable.LayerDrawable;
|
import android.graphics.drawable.LayerDrawable;
|
||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
@@ -31,6 +32,8 @@ import android.view.ViewGroup;
|
|||||||
import android.view.accessibility.AccessibilityManager;
|
import android.view.accessibility.AccessibilityManager;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import com.android.internal.widget.LockPatternUtils;
|
import com.android.internal.widget.LockPatternUtils;
|
||||||
import com.android.settingslib.Utils;
|
import com.android.settingslib.Utils;
|
||||||
import com.android.systemui.R;
|
import com.android.systemui.R;
|
||||||
@@ -48,6 +51,7 @@ public class NumPadKey extends ViewGroup {
|
|||||||
private int mTextViewResId;
|
private int mTextViewResId;
|
||||||
private PasswordTextView mTextView;
|
private PasswordTextView mTextView;
|
||||||
|
|
||||||
|
@Nullable
|
||||||
private NumPadAnimator mAnimator;
|
private NumPadAnimator mAnimator;
|
||||||
|
|
||||||
private View.OnClickListener mListener = new View.OnClickListener() {
|
private View.OnClickListener mListener = new View.OnClickListener() {
|
||||||
@@ -127,8 +131,13 @@ public class NumPadKey extends ViewGroup {
|
|||||||
|
|
||||||
setContentDescription(mDigitText.getText().toString());
|
setContentDescription(mDigitText.getText().toString());
|
||||||
|
|
||||||
mAnimator = new NumPadAnimator(context, (LayerDrawable) getBackground(),
|
Drawable background = getBackground();
|
||||||
R.style.NumPadKey);
|
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() {
|
public void disableNewLayout() {
|
||||||
findViewById(R.id.klondike_text).setVisibility(View.VISIBLE);
|
findViewById(R.id.klondike_text).setVisibility(View.VISIBLE);
|
||||||
mAnimator = null;
|
if (mAnimator != null) {
|
||||||
ContextThemeWrapper ctw = new ContextThemeWrapper(getContext(), R.style.NumPadKey);
|
mAnimator = null;
|
||||||
setBackground(getContext().getResources().getDrawable(
|
ContextThemeWrapper ctw = new ContextThemeWrapper(getContext(), R.style.NumPadKey);
|
||||||
R.drawable.ripple_drawable_pin, ctw.getTheme()));
|
setBackground(getContext().getResources().getDrawable(
|
||||||
|
R.drawable.ripple_drawable_pin, ctw.getTheme()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -121,9 +121,19 @@ public class PasswordTextView extends View {
|
|||||||
public PasswordTextView(Context context, AttributeSet attrs, int defStyleAttr,
|
public PasswordTextView(Context context, AttributeSet attrs, int defStyleAttr,
|
||||||
int defStyleRes) {
|
int defStyleRes) {
|
||||||
super(context, attrs, defStyleAttr, defStyleRes);
|
super(context, attrs, defStyleAttr, defStyleRes);
|
||||||
setFocusableInTouchMode(true);
|
TypedArray a = context.obtainStyledAttributes(attrs, android.R.styleable.View);
|
||||||
setFocusable(true);
|
try {
|
||||||
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.PasswordTextView);
|
// If defined, use the provided values. If not, set them to true by default.
|
||||||
|
boolean isFocusable = a.getBoolean(android.R.styleable.View_focusable,
|
||||||
|
/* defValue= */ true);
|
||||||
|
boolean isFocusableInTouchMode = a.getBoolean(
|
||||||
|
android.R.styleable.View_focusableInTouchMode, /* defValue= */ true);
|
||||||
|
setFocusable(isFocusable);
|
||||||
|
setFocusableInTouchMode(isFocusableInTouchMode);
|
||||||
|
} finally {
|
||||||
|
a.recycle();
|
||||||
|
}
|
||||||
|
a = context.obtainStyledAttributes(attrs, R.styleable.PasswordTextView);
|
||||||
try {
|
try {
|
||||||
mTextHeightRaw = a.getInt(R.styleable.PasswordTextView_scaledTextSize, 0);
|
mTextHeightRaw = a.getInt(R.styleable.PasswordTextView_scaledTextSize, 0);
|
||||||
mGravity = a.getInt(R.styleable.PasswordTextView_android_gravity, Gravity.CENTER);
|
mGravity = a.getInt(R.styleable.PasswordTextView_android_gravity, Gravity.CENTER);
|
||||||
|
|||||||
Reference in New Issue
Block a user