1 package com.android.systemui.qs.dagger 2 3 import android.content.Context 4 import android.view.LayoutInflater 5 import android.view.View 6 import com.android.systemui.dagger.qualifiers.RootView 7 import com.android.systemui.qs.QSContainerImpl 8 import com.android.systemui.qs.QSFooter 9 import com.android.systemui.qs.QSFooterView 10 import com.android.systemui.qs.QSFooterViewController 11 import com.android.systemui.qs.QSPanel 12 import com.android.systemui.qs.QuickQSPanel 13 import com.android.systemui.qs.QuickStatusBarHeader 14 import com.android.systemui.qs.customize.QSCustomizer 15 import com.android.systemui.res.R 16 import dagger.Module 17 import dagger.Provides 18 19 @Module 20 interface QSScopeModule { 21 companion object { 22 const val QS_USING_MEDIA_PLAYER = "qs_using_media_player" 23 const val QS_USING_COLLAPSED_LANDSCAPE_MEDIA = "qs_using_collapsed_landscape_media" 24 25 @Provides 26 @QSThemedContext 27 @JvmStatic provideThemedContextnull28 fun provideThemedContext(@RootView view: View): Context { 29 return view.context 30 } 31 32 /** */ 33 @Provides 34 @QSThemedContext 35 @JvmStatic provideThemedLayoutInflaternull36 fun provideThemedLayoutInflater(@QSThemedContext context: Context): LayoutInflater { 37 return LayoutInflater.from(context) 38 } 39 40 /** */ 41 @Provides 42 @JvmStatic provideQSPanelnull43 fun provideQSPanel(@RootView view: View): QSPanel { 44 return view.requireViewById<QSPanel>(R.id.quick_settings_panel) 45 } 46 47 /** */ 48 @Provides 49 @JvmStatic providesQSContainerImplnull50 fun providesQSContainerImpl(@RootView view: View): QSContainerImpl { 51 return view.requireViewById<QSContainerImpl>(R.id.quick_settings_container) 52 } 53 54 /** */ 55 @Provides 56 @JvmStatic providesQuickStatusBarHeadernull57 fun providesQuickStatusBarHeader(@RootView view: View): QuickStatusBarHeader { 58 return view.requireViewById<QuickStatusBarHeader>(R.id.header) 59 } 60 61 /** */ 62 @Provides 63 @JvmStatic providesQuickQSPanelnull64 fun providesQuickQSPanel(quickStatusBarHeader: QuickStatusBarHeader): QuickQSPanel { 65 return quickStatusBarHeader.requireViewById<QuickQSPanel>(R.id.quick_qs_panel) 66 } 67 68 /** */ 69 @Provides 70 @JvmStatic providesQSFooterViewnull71 fun providesQSFooterView(@RootView view: View): QSFooterView { 72 return view.requireViewById<QSFooterView>(R.id.qs_footer) 73 } 74 75 /** */ 76 @Provides 77 @QSScope 78 @JvmStatic providesQSFooternull79 fun providesQSFooter(qsFooterViewController: QSFooterViewController): QSFooter { 80 qsFooterViewController.init() 81 return qsFooterViewController 82 } 83 84 /** */ 85 @Provides 86 @QSScope 87 @JvmStatic providesQSCutomizernull88 fun providesQSCutomizer(@RootView view: View): QSCustomizer { 89 return view.requireViewById<QSCustomizer>(R.id.qs_customize) 90 } 91 } 92 } 93