1 package com.android.systemui.biometrics.ui 2 3 import android.content.Context 4 import android.graphics.Insets 5 import android.util.AttributeSet 6 import android.view.View 7 import android.view.WindowInsets 8 import android.view.WindowInsets.Type 9 import android.widget.LinearLayout 10 import com.android.systemui.biometrics.AuthPanelController 11 import com.android.systemui.biometrics.ui.binder.CredentialViewBinder 12 import com.android.systemui.biometrics.ui.binder.Spaghetti 13 import com.android.systemui.biometrics.ui.viewmodel.CredentialViewModel 14 15 /** Pattern credential view for BiometricPrompt. */ 16 class CredentialPatternView(context: Context, attrs: AttributeSet?) : 17 LinearLayout(context, attrs), CredentialView, View.OnApplyWindowInsetsListener { 18 19 /** Initializes the view. */ initnull20 override fun init( 21 viewModel: CredentialViewModel, 22 host: CredentialView.Host, 23 panelViewController: AuthPanelController, 24 animatePanel: Boolean, 25 legacyCallback: Spaghetti.Callback, 26 ) { 27 CredentialViewBinder.bind( 28 this, 29 host, 30 viewModel, 31 panelViewController, 32 animatePanel, 33 legacyCallback 34 ) 35 } 36 onFinishInflatenull37 override fun onFinishInflate() { 38 super.onFinishInflate() 39 setOnApplyWindowInsetsListener(this) 40 } 41 onApplyWindowInsetsnull42 override fun onApplyWindowInsets(v: View, insets: WindowInsets): WindowInsets { 43 val statusBarInsets: Insets = insets.getInsets(Type.statusBars()) 44 val navigationInsets: Insets = insets.getInsets(Type.navigationBars()) 45 46 setPadding(0, statusBarInsets.top, 0, navigationInsets.bottom) 47 return WindowInsets.CONSUMED 48 } 49 } 50