• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.systembar;
18 
19 import android.content.Context;
20 import android.content.res.TypedArray;
21 import android.util.AttributeSet;
22 
23 import com.android.systemui.statusbar.AlphaOptimizedImageView;
24 
25 /**
26  * AppGridButton is used to display the app grid and toggle recents.
27  */
28 public class AppGridButton extends CarSystemBarButton {
29     private RecentsButtonStateProvider mRecentsButtonStateProvider;
30 
AppGridButton(Context context, AttributeSet attrs)31     public AppGridButton(Context context, AttributeSet attrs) {
32         super(context, attrs);
33     }
34 
35     @Override
init()36     protected void init() {
37         mRecentsButtonStateProvider = new RecentsButtonStateProvider(getContext(), this);
38     }
39 
40     @Override
setUpIntents(TypedArray typedArray)41     protected void setUpIntents(TypedArray typedArray) {
42         mRecentsButtonStateProvider.setUpIntents(typedArray, super::setUpIntents);
43     }
44 
45     @Override
getButtonClickListener()46     protected OnClickListener getButtonClickListener() {
47         return mRecentsButtonStateProvider.getButtonClickListener(super.getButtonClickListener());
48     }
49 
50     @Override
updateImage(AlphaOptimizedImageView icon)51     protected void updateImage(AlphaOptimizedImageView icon) {
52         mRecentsButtonStateProvider.updateImage(icon, super::updateImage);
53     }
54 
55     @Override
refreshIconAlpha(AlphaOptimizedImageView icon)56     protected void refreshIconAlpha(AlphaOptimizedImageView icon) {
57         mRecentsButtonStateProvider.refreshIconAlpha(icon, super::refreshIconAlpha);
58     }
59 }
60