• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2019 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.qs;
18 
19 import com.android.systemui.R;
20 import com.android.systemui.qs.carrier.QSCarrierGroupController;
21 
22 import javax.inject.Inject;
23 
24 public class QuickStatusBarHeaderController {
25     private final QuickStatusBarHeader mView;
26     private final QSCarrierGroupController mQSCarrierGroupController;
27 
QuickStatusBarHeaderController(QuickStatusBarHeader view, QSCarrierGroupController.Builder qsCarrierGroupControllerBuilder)28     private QuickStatusBarHeaderController(QuickStatusBarHeader view,
29             QSCarrierGroupController.Builder qsCarrierGroupControllerBuilder) {
30         mView = view;
31         mQSCarrierGroupController = qsCarrierGroupControllerBuilder
32                 .setQSCarrierGroup(mView.findViewById(R.id.carrier_group))
33                 .build();
34     }
35 
setListening(boolean listening)36     public void setListening(boolean listening) {
37         mQSCarrierGroupController.setListening(listening);
38         // TODO: move mView.setListening logic into here.
39         mView.setListening(listening);
40     }
41 
42 
43     public static class Builder {
44         private final QSCarrierGroupController.Builder mQSCarrierGroupControllerBuilder;
45         private QuickStatusBarHeader mView;
46 
47         @Inject
Builder(QSCarrierGroupController.Builder qsCarrierGroupControllerBuilder)48         public Builder(QSCarrierGroupController.Builder qsCarrierGroupControllerBuilder) {
49             mQSCarrierGroupControllerBuilder = qsCarrierGroupControllerBuilder;
50         }
51 
setQuickStatusBarHeader(QuickStatusBarHeader view)52         public Builder setQuickStatusBarHeader(QuickStatusBarHeader view) {
53             mView = view;
54             return this;
55         }
56 
build()57         public QuickStatusBarHeaderController build() {
58             return new QuickStatusBarHeaderController(mView, mQSCarrierGroupControllerBuilder);
59         }
60     }
61 }
62