1 /*
2  * Copyright (C) 2023 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 
18 package com.android.systemui.biometrics.ui.binder
19 
20 import android.view.View
21 import com.android.systemui.R
22 import com.android.systemui.keyguard.ui.binder.UdfpsAodFingerprintViewBinder
23 import com.android.systemui.keyguard.ui.binder.UdfpsBackgroundViewBinder
24 import com.android.systemui.keyguard.ui.binder.UdfpsFingerprintViewBinder
25 import com.android.systemui.keyguard.ui.viewmodel.BackgroundViewModel
26 import com.android.systemui.keyguard.ui.viewmodel.FingerprintViewModel
27 import com.android.systemui.keyguard.ui.viewmodel.UdfpsAodViewModel
28 import com.android.systemui.keyguard.ui.viewmodel.UdfpsKeyguardInternalViewModel
29 import kotlinx.coroutines.ExperimentalCoroutinesApi
30 
31 @ExperimentalCoroutinesApi
32 object UdfpsKeyguardInternalViewBinder {
33 
34     @JvmStatic
35     fun bind(
36         view: View,
37         viewModel: UdfpsKeyguardInternalViewModel,
38         aodViewModel: UdfpsAodViewModel,
39         fingerprintViewModel: FingerprintViewModel,
40         backgroundViewModel: BackgroundViewModel,
41     ) {
42         view.accessibilityDelegate = viewModel.accessibilityDelegate
43 
44         // bind child views
45         UdfpsAodFingerprintViewBinder.bind(view.requireViewById(R.id.udfps_aod_fp), aodViewModel)
46         UdfpsFingerprintViewBinder.bind(
47             view.requireViewById(R.id.udfps_lockscreen_fp),
48             fingerprintViewModel
49         )
50         UdfpsBackgroundViewBinder.bind(
51             view.requireViewById(R.id.udfps_keyguard_fp_bg),
52             backgroundViewModel
53         )
54     }
55 }
56