summaryrefslogtreecommitdiff
path: root/packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputView.java
diff options
context:
space:
mode:
authorLucas Dupin <dupin@google.com>2020-11-19 03:18:10 +0000
committerLucas Dupin <dupin@google.com>2020-12-01 14:23:16 -0800
commit7b8636fdb0dfc5ef727365cdf42a2fb56bdffeb2 (patch)
tree35429253346bc7c59558a354d760026f13869499 /packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputView.java
parent60797526531ad856bc3428ebc1af14a472c998ed (diff)
1/N The road to Material NEXT (bouncer and shade)
Styling bouncer and shade so they have solid backgrounds and read colors from themes instead of named resources. Scrim now fetches colorBackgroundFloating, and views get their background from colorBackground. Switching from light to dark theme will make bouncer colors update without re-inflating any views. Bug: 173561906 Bug: 173561901 Test: atest ScrimControllerTest Test: atest KeyguardSecurityContainerControllerTest Test: manual, switching to dark theme annd showing notif guts Change-Id: I372e8b688d7bbddd698381accd074b7655788cd0
Diffstat (limited to 'packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputView.java')
-rw-r--r--packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputView.java30
1 files changed, 28 insertions, 2 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputView.java
index 7fa43116a7b1..4ddfccb21c73 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputView.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardPinBasedInputView.java
@@ -24,12 +24,16 @@ import static com.android.keyguard.KeyguardSecurityView.PROMPT_REASON_TIMEOUT;
import static com.android.keyguard.KeyguardSecurityView.PROMPT_REASON_USER_REQUEST;
import android.content.Context;
+import android.content.res.ColorStateList;
import android.graphics.Rect;
import android.util.AttributeSet;
+import android.view.ContextThemeWrapper;
import android.view.KeyEvent;
import android.view.View;
+import android.widget.ImageButton;
import com.android.internal.widget.LockscreenCredential;
+import com.android.settingslib.Utils;
import com.android.systemui.R;
/**
@@ -39,8 +43,9 @@ public abstract class KeyguardPinBasedInputView extends KeyguardAbsKeyInputView
protected PasswordTextView mPasswordEntry;
private View mOkButton;
- private View mDeleteButton;
- private View[] mButtons = new View[10];
+ private ImageButton mDeleteButton;
+ private NumPadKey[] mButtons = new NumPadKey[10];
+ private View mDivider;
public KeyguardPinBasedInputView(Context context) {
this(context, null);
@@ -147,6 +152,7 @@ public abstract class KeyguardPinBasedInputView extends KeyguardAbsKeyInputView
mDeleteButton = findViewById(R.id.delete_button);
mDeleteButton.setVisibility(View.VISIBLE);
+ mDivider = findViewById(R.id.divider);
mButtons[0] = findViewById(R.id.key0);
mButtons[1] = findViewById(R.id.key1);
@@ -161,6 +167,26 @@ public abstract class KeyguardPinBasedInputView extends KeyguardAbsKeyInputView
mPasswordEntry.requestFocus();
super.onFinishInflate();
+ reloadColors();
+ }
+
+ /**
+ * Reload colors from resources.
+ **/
+ public void reloadColors() {
+ for (NumPadKey key : mButtons) {
+ key.reloadColors();
+ }
+ mPasswordEntry.reloadColors();
+ int deleteColor = Utils.getColorAttr(getContext(), android.R.attr.textColorSecondary)
+ .getDefaultColor();
+ mDeleteButton.setImageTintList(ColorStateList.valueOf(deleteColor));
+ mDivider.setBackground(getContext().getDrawable(R.drawable.pin_divider));
+
+ ContextThemeWrapper themedContext = new ContextThemeWrapper(mContext,
+ R.style.Widget_TextView_NumPadKey);
+ mDeleteButton.setBackground(themedContext.getDrawable(R.drawable.ripple_drawable_pin));
+ mOkButton.setBackground(themedContext.getDrawable(R.drawable.ripple_drawable_pin));
}
@Override