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 
25 import com.android.internal.logging.MetricsProto.MetricsEvent;
26 import com.android.settings.ChooseLockSettingsHelper;
27 import com.android.settings.R;
28 import com.android.settings.SetupWizardUtils;
29 import com.android.setupwizardlib.view.NavigationBar;
30 
31 public class SetupFingerprintEnrollFindSensor extends FingerprintEnrollFindSensor
32         implements NavigationBar.NavigationBarListener {
33 
34     @Override
getContentView()35     protected int getContentView() {
36         return R.layout.setup_fingerprint_enroll_find_sensor;
37     }
38 
39     @Override
getEnrollingIntent()40     protected Intent getEnrollingIntent() {
41         Intent intent = new Intent(this, SetupFingerprintEnrollEnrolling.class);
42         intent.putExtra(ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN, mToken);
43         if (mUserId != UserHandle.USER_NULL) {
44             intent.putExtra(Intent.EXTRA_USER_ID, mUserId);
45         }
46         SetupWizardUtils.copySetupExtras(getIntent(), intent);
47         return intent;
48     }
49 
50     @Override
onApplyThemeResource(Resources.Theme theme, int resid, boolean first)51     protected void onApplyThemeResource(Resources.Theme theme, int resid, boolean first) {
52         resid = SetupWizardUtils.getTheme(getIntent());
53         super.onApplyThemeResource(theme, resid, first);
54     }
55 
56     @Override
initViews()57     protected void initViews() {
58         SetupWizardUtils.setImmersiveMode(this);
59 
60         final View nextButton = findViewById(R.id.next_button);
61         if (nextButton != null) {
62             nextButton.setVisibility(View.GONE);
63         }
64 
65         getNavigationBar().setNavigationBarListener(this);
66         getNavigationBar().getBackButton().setVisibility(View.GONE);
67     }
68 
69     @Override
getNextButton()70     protected Button getNextButton() {
71         return getNavigationBar().getNextButton();
72     }
73 
74     @Override
onNavigateBack()75     public void onNavigateBack() {
76         onBackPressed();
77     }
78 
79     @Override
onNavigateNext()80     public void onNavigateNext() {
81         onNextButtonClick();
82     }
83 
84     @Override
getMetricsCategory()85     protected int getMetricsCategory() {
86         return MetricsEvent.FINGERPRINT_FIND_SENSOR_SETUP;
87     }
88 }
89