Dave Mankoff | c4fe6c4 | 2019-11-18 17:03:29 -0500 | [diff] [blame] | 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; |
Fabian Kozynski | 00afd49 | 2020-02-15 19:58:10 -0500 | [diff] [blame] | 20 | import com.android.systemui.qs.carrier.QSCarrierGroupController; |
Dave Mankoff | c4fe6c4 | 2019-11-18 17:03:29 -0500 | [diff] [blame] | 21 | |
| 22 | import javax.inject.Inject; |
| 23 | |
| 24 | public class QuickStatusBarHeaderController { |
| 25 | private final QuickStatusBarHeader mView; |
| 26 | private final QSCarrierGroupController mQSCarrierGroupController; |
| 27 | |
| 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 | |
| 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 |
| 48 | public Builder(QSCarrierGroupController.Builder qsCarrierGroupControllerBuilder) { |
| 49 | mQSCarrierGroupControllerBuilder = qsCarrierGroupControllerBuilder; |
| 50 | } |
| 51 | |
| 52 | public Builder setQuickStatusBarHeader(QuickStatusBarHeader view) { |
| 53 | mView = view; |
| 54 | return this; |
| 55 | } |
| 56 | |
| 57 | public QuickStatusBarHeaderController build() { |
| 58 | return new QuickStatusBarHeaderController(mView, mQSCarrierGroupControllerBuilder); |
| 59 | } |
| 60 | } |
| 61 | } |