• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2024 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 package com.android.systemui.car.hvac;
17 
18 import android.view.View;
19 
20 import com.android.systemui.car.systembar.ButtonSelectionStateController;
21 import com.android.systemui.car.systembar.CarSystemBarButton;
22 import com.android.systemui.car.systembar.CarSystemBarButtonController;
23 import com.android.systemui.car.systembar.element.CarSystemBarElementController;
24 import com.android.systemui.car.systembar.element.CarSystemBarElementStateController;
25 import com.android.systemui.car.systembar.element.CarSystemBarElementStatusBarDisableController;
26 import com.android.systemui.car.wm.scalableui.EventDispatcher;
27 import com.android.systemui.settings.UserTracker;
28 
29 import dagger.assisted.Assisted;
30 import dagger.assisted.AssistedFactory;
31 import dagger.assisted.AssistedInject;
32 
33 /**
34  * A CarSystemBarElementController for handling notification button interactions.
35  */
36 public class HvacButtonController extends CarSystemBarButtonController {
37 
38     private final HvacPanelOverlayViewController mHvacPanelOverlayViewController;
39 
40     @AssistedInject
HvacButtonController(@ssisted CarSystemBarButton hvacButton, CarSystemBarElementStatusBarDisableController disableController, CarSystemBarElementStateController stateController, HvacPanelOverlayViewController hvacPanelOverlayViewController, UserTracker userTracker, EventDispatcher eventDispatcher, ButtonSelectionStateController buttonSelectionStateController)41     public HvacButtonController(@Assisted CarSystemBarButton hvacButton,
42             CarSystemBarElementStatusBarDisableController disableController,
43             CarSystemBarElementStateController stateController,
44             HvacPanelOverlayViewController hvacPanelOverlayViewController,
45             UserTracker userTracker, EventDispatcher eventDispatcher,
46             ButtonSelectionStateController buttonSelectionStateController) {
47         super(hvacButton, disableController, stateController, userTracker, eventDispatcher,
48                 buttonSelectionStateController);
49 
50         mHvacPanelOverlayViewController = hvacPanelOverlayViewController;
51         mHvacPanelOverlayViewController.registerViewStateListener(hvacButton);
52         hvacButton.setOnClickListener(this::onHvacClick);
53     }
54 
55     @AssistedFactory
56     public interface Factory extends
57             CarSystemBarElementController.Factory<CarSystemBarButton,
58                     HvacButtonController> {
59     }
60 
onHvacClick(View v)61     private void onHvacClick(View v) {
62         mHvacPanelOverlayViewController.toggle();
63     }
64 }
65