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 android.content.res.Configuration; 20 21 import com.android.systemui.qs.dagger.QSScope; 22 import com.android.systemui.statusbar.policy.ConfigurationController; 23 import com.android.systemui.util.ViewController; 24 25 import javax.inject.Inject; 26 27 /** */ 28 @QSScope 29 public class QSContainerImplController extends ViewController<QSContainerImpl> { 30 private final QSPanelController mQsPanelController; 31 private final QuickStatusBarHeaderController mQuickStatusBarHeaderController; 32 private final ConfigurationController mConfigurationController; 33 34 private final ConfigurationController.ConfigurationListener mConfigurationListener = 35 new ConfigurationController.ConfigurationListener() { 36 @Override 37 public void onConfigChanged(Configuration newConfig) { 38 mView.updateResources(mQsPanelController, mQuickStatusBarHeaderController); 39 } 40 }; 41 42 @Inject QSContainerImplController(QSContainerImpl view, QSPanelController qsPanelController, QuickStatusBarHeaderController quickStatusBarHeaderController, ConfigurationController configurationController)43 QSContainerImplController(QSContainerImpl view, QSPanelController qsPanelController, 44 QuickStatusBarHeaderController quickStatusBarHeaderController, 45 ConfigurationController configurationController) { 46 super(view); 47 mQsPanelController = qsPanelController; 48 mQuickStatusBarHeaderController = quickStatusBarHeaderController; 49 mConfigurationController = configurationController; 50 } 51 52 @Override onInit()53 public void onInit() { 54 mQuickStatusBarHeaderController.init(); 55 } 56 setListening(boolean listening)57 public void setListening(boolean listening) { 58 mQuickStatusBarHeaderController.setListening(listening); 59 } 60 61 @Override onViewAttached()62 protected void onViewAttached() { 63 mView.updateResources(mQsPanelController, mQuickStatusBarHeaderController); 64 mConfigurationController.addCallback(mConfigurationListener); 65 } 66 67 @Override onViewDetached()68 protected void onViewDetached() { 69 mConfigurationController.removeCallback(mConfigurationListener); 70 } 71 getView()72 public QSContainerImpl getView() { 73 return mView; 74 } 75 } 76