2 * Copyright (C) 2015 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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
17 package com.android.settings.fingerprint;
19 import android.content.Intent;
20 import android.content.res.Resources;
21 import android.os.UserHandle;
22 import android.support.v14.preference.PreferenceFragment;
23 import android.view.View;
24 import android.widget.Button;
26 import com.android.internal.logging.MetricsProto.MetricsEvent;
27 import com.android.internal.widget.LockPatternUtils;
28 import com.android.settings.R;
29 import com.android.settings.SetupChooseLockGeneric;
30 import com.android.settings.SetupWizardUtils;
31 import com.android.setupwizardlib.SetupWizardRecyclerLayout;
32 import com.android.setupwizardlib.view.NavigationBar;
34 public class SetupFingerprintEnrollIntroduction extends FingerprintEnrollIntroduction
35 implements NavigationBar.NavigationBarListener {
38 protected Intent getChooseLockIntent() {
39 Intent intent = new Intent(this, SetupChooseLockGeneric.class);
40 SetupWizardUtils.copySetupExtras(getIntent(), intent);
45 protected Intent getFindSensorIntent() {
46 final Intent intent = new Intent(this, SetupFingerprintEnrollFindSensor.class);
47 SetupWizardUtils.copySetupExtras(getIntent(), intent);
52 protected void onApplyThemeResource(Resources.Theme theme, int resid, boolean first) {
53 resid = SetupWizardUtils.getTheme(getIntent());
54 super.onApplyThemeResource(theme, resid, first);
58 protected void initViews() {
59 SetupWizardUtils.setImmersiveMode(this);
60 getNavigationBar().setNavigationBarListener(this);
61 Button nextButton = getNavigationBar().getNextButton();
62 nextButton.setText(null);
63 nextButton.setEnabled(false);
64 SetupWizardRecyclerLayout layout = (SetupWizardRecyclerLayout) getSetupWizardLayout();
65 layout.setDividerInset(getResources().getDimensionPixelSize(
66 R.dimen.suw_items_icon_divider_inset));
70 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
71 if (requestCode == FINGERPRINT_FIND_SENSOR_REQUEST) {
75 LockPatternUtils lockPatternUtils = new LockPatternUtils(this);
76 data.putExtra(SetupChooseLockGeneric.
77 SetupChooseLockGenericFragment.EXTRA_PASSWORD_QUALITY,
78 lockPatternUtils.getKeyguardStoredPasswordQuality(UserHandle.myUserId()));
80 super.onActivityResult(requestCode, resultCode, data);
84 protected void onCancelButtonClick() {
85 SetupSkipDialog dialog = SetupSkipDialog.newInstance(
86 getIntent().getBooleanExtra(SetupSkipDialog.EXTRA_FRP_SUPPORTED, false));
87 dialog.show(getFragmentManager());
91 public void onNavigateBack() {
96 public void onNavigateNext() {
97 // next is handled via the onNextButtonClick method in FingerprintEnrollIntroduction
101 protected int getMetricsCategory() {
102 return MetricsEvent.FINGERPRINT_ENROLL_INTRO_SETUP;