1 /*
2  * Copyright (C) 2021 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.systemui.car.keyguard;
18 
19 import android.annotation.ColorInt;
20 import android.content.Context;
21 import android.util.AttributeSet;
22 
23 import com.android.keyguard.KeyguardPINView;
24 import com.android.keyguard.NumPadButton;
25 import com.android.systemui.R;
26 
27 /**
28  * Car-specific {@link KeyguardPINView} to bypass unwanted view logic.
29  *
30  * TODO(b/204220809): Instead of extending {@link KeyguardPINView} separate shared logic into
31  * interface.
32  */
33 public class CarKeyguardPINView extends KeyguardPINView {
34     private final @ColorInt int mButtonImageColor;
35 
36     private NumPadButton mOkButton;
37     private NumPadButton mDeleteButton;
38 
CarKeyguardPINView(Context context)39     public CarKeyguardPINView(Context context) {
40         this(context, /* attrs= */ null);
41     }
42 
CarKeyguardPINView(Context context, AttributeSet attrs)43     public CarKeyguardPINView(Context context, AttributeSet attrs) {
44         super(context, attrs);
45 
46         mButtonImageColor = context.getColor(R.color.keyguard_keypad_image_color);
47     }
48 
49     @Override
onFinishInflate()50     protected void onFinishInflate() {
51         super.onFinishInflate();
52 
53         mOkButton = findViewById(R.id.key_enter);
54         mDeleteButton = findViewById(R.id.delete_button);
55     }
56 
57     @Override
startAppearAnimation()58     public void startAppearAnimation() {
59         super.startAppearAnimation();
60 
61         mOkButton.setColorFilter(mButtonImageColor);
62         mDeleteButton.setColorFilter(mButtonImageColor);
63     }
64 }
65