1 /*
2  * Copyright (C) 2020 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.keyguard.dagger;
18 
19 import android.view.LayoutInflater;
20 import android.view.ViewGroup;
21 
22 import com.android.keyguard.KeyguardHostView;
23 import com.android.keyguard.KeyguardMessageArea;
24 import com.android.keyguard.KeyguardSecurityContainer;
25 import com.android.keyguard.KeyguardSecurityViewFlipper;
26 import com.android.systemui.R;
27 import com.android.systemui.dagger.qualifiers.RootView;
28 import com.android.systemui.statusbar.phone.KeyguardBouncer;
29 
30 import dagger.Module;
31 import dagger.Provides;
32 
33 /**
34  * Module to create and access view related to the {@link KeyguardBouncer}.
35  */
36 @Module
37 public interface KeyguardBouncerModule {
38     /** */
39     @Provides
40     @KeyguardBouncerScope
41     @RootView
providesRootView(LayoutInflater layoutInflater)42     static ViewGroup providesRootView(LayoutInflater layoutInflater) {
43         return (ViewGroup) layoutInflater.inflate(R.layout.keyguard_bouncer, null);
44     }
45 
46     /** */
47     @Provides
48     @KeyguardBouncerScope
providesKeyguardMessageArea(@ootView ViewGroup viewGroup)49     static KeyguardMessageArea providesKeyguardMessageArea(@RootView ViewGroup viewGroup) {
50         return viewGroup.findViewById(R.id.keyguard_message_area);
51     }
52 
53     /** */
54     @Provides
55     @KeyguardBouncerScope
providesKeyguardHostView(@ootView ViewGroup rootView)56     static KeyguardHostView providesKeyguardHostView(@RootView ViewGroup rootView) {
57         return rootView.findViewById(R.id.keyguard_host_view);
58     }
59 
60     /** */
61     @Provides
62     @KeyguardBouncerScope
providesKeyguardSecurityContainer(KeyguardHostView hostView)63     static KeyguardSecurityContainer providesKeyguardSecurityContainer(KeyguardHostView hostView) {
64         return hostView.findViewById(R.id.keyguard_security_container);
65     }
66 
67     /** */
68     @Provides
69     @KeyguardBouncerScope
providesKeyguardSecurityViewFlipper( KeyguardSecurityContainer containerView)70     static KeyguardSecurityViewFlipper providesKeyguardSecurityViewFlipper(
71             KeyguardSecurityContainer containerView) {
72         return containerView.findViewById(R.id.view_flipper);
73     }
74 }
75