1 /*
2  * Copyright (C) 2015 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.fingerprint;
18 
19 import android.content.Intent;
20 import android.content.res.Resources;
21 import android.os.UserHandle;
22 import android.view.View;
23 import android.widget.Button;
24 import android.widget.TextView;
25 
26 import com.android.internal.logging.MetricsProto.MetricsEvent;
27 import com.android.settings.ChooseLockSettingsHelper;
28 import com.android.settings.R;
29 import com.android.settings.SetupWizardUtils;
30 import com.android.setupwizardlib.view.NavigationBar;
31 
32 public class SetupFingerprintEnrollFinish extends FingerprintEnrollFinish
33         implements NavigationBar.NavigationBarListener {
34 
35     @Override
getEnrollingIntent()36     protected Intent getEnrollingIntent() {
37         Intent intent = new Intent(this, SetupFingerprintEnrollEnrolling.class);
38         intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, mToken);
39         if (mUserId != UserHandle.USER_NULL) {
40             intent.putExtra(Intent.EXTRA_USER_ID, mUserId);
41         }
42         SetupWizardUtils.copySetupExtras(getIntent(), intent);
43         return intent;
44     }
45 
46     @Override
onApplyThemeResource(Resources.Theme theme, int resid, boolean first)47     protected void onApplyThemeResource(Resources.Theme theme, int resid, boolean first) {
48         resid = SetupWizardUtils.getTheme(getIntent());
49         super.onApplyThemeResource(theme, resid, first);
50     }
51 
52     @Override
initViews()53     protected void initViews() {
54         SetupWizardUtils.setImmersiveMode(this);
55 
56         final View nextButton = findViewById(R.id.next_button);
57         if (nextButton != null) {
58             nextButton.setVisibility(View.GONE);
59         }
60 
61         final NavigationBar navigationBar = getNavigationBar();
62         navigationBar.setNavigationBarListener(this);
63         navigationBar.getBackButton().setVisibility(View.GONE);
64 
65         final TextView message = (TextView) findViewById(R.id.message);
66         message.setText(R.string.setup_fingerprint_enroll_finish_message);
67 
68         final TextView secondaryMessage = (TextView) findViewById(R.id.message_secondary);
69         secondaryMessage.setVisibility(View.VISIBLE);
70     }
71 
72     @Override
getNextButton()73     protected Button getNextButton() {
74         return getNavigationBar().getNextButton();
75     }
76 
77     @Override
onNavigateBack()78     public void onNavigateBack() {
79         onBackPressed();
80     }
81 
82     @Override
onNavigateNext()83     public void onNavigateNext() {
84         onNextButtonClick();
85     }
86 
87     @Override
getMetricsCategory()88     protected int getMetricsCategory() {
89         return MetricsEvent.FINGERPRINT_ENROLL_FINISH_SETUP;
90     }
91 }
92