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 package com.android.settings.remoteauth.finish
18 
19 import android.os.Bundle
20 import android.view.View
21 import androidx.navigation.fragment.NavHostFragment.Companion.findNavController
22 import com.airbnb.lottie.LottieAnimationView
23 import com.android.settings.R
24 import com.android.settings.remoteauth.RemoteAuthEnrollBase
25 import com.android.settingslib.widget.LottieColorUtils
26 import com.google.android.setupcompat.template.FooterButton
27 
28 /**
29  * Displays the enrollment finish view.
30  */
31 class RemoteAuthEnrollFinish :
32     RemoteAuthEnrollBase(
33         layoutResId = R.layout.remote_auth_enroll_finish,
34         glifLayoutId = R.id.setup_wizard_layout,
35     ) {
36 
onViewCreatednull37     override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
38         super.onViewCreated(view, savedInstanceState)
39         LottieColorUtils.applyDynamicColors(
40             requireContext(),
41             view.findViewById<LottieAnimationView>(R.id.enroll_finish_animation)
42         )
43     }
44 
initializePrimaryFooterButtonnull45     override fun initializePrimaryFooterButton(): FooterButton {
46         return FooterButton.Builder(requireContext())
47             .setText(R.string.security_settings_remoteauth_enroll_finish_btn_next)
48             .setListener(this::onPrimaryFooterButtonClick)
49             .setButtonType(FooterButton.ButtonType.NEXT)
50             .setTheme(com.google.android.setupdesign.R.style.SudGlifButton_Primary)
51             .build()
52     }
53 
initializeSecondaryFooterButtonnull54     override fun initializeSecondaryFooterButton(): FooterButton? = null
55 
56     fun onPrimaryFooterButtonClick(view: View) {
57         findNavController(this).navigate(R.id.action_finish_to_settings)
58     }
59 
60     private companion object {
61         const val TAG = "RemoteAuthEnrollFinish"
62     }
63 }