OSDN Git Service

Add accessibility actions to the drag-and-drop locale list
[android-x86/packages-apps-Settings.git] / src / com / android / settings / fingerprint / SetupFingerprintEnrollIntroduction.java
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.support.v14.preference.PreferenceFragment;
23 import android.view.View;
24 import android.widget.Button;
25
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;
33
34 public class SetupFingerprintEnrollIntroduction extends FingerprintEnrollIntroduction
35         implements NavigationBar.NavigationBarListener {
36
37     @Override
38     protected Intent getChooseLockIntent() {
39         Intent intent = new Intent(this, SetupChooseLockGeneric.class);
40         SetupWizardUtils.copySetupExtras(getIntent(), intent);
41         return intent;
42     }
43
44     @Override
45     protected Intent getFindSensorIntent() {
46         final Intent intent = new Intent(this, SetupFingerprintEnrollFindSensor.class);
47         SetupWizardUtils.copySetupExtras(getIntent(), intent);
48         return intent;
49     }
50
51     @Override
52     protected void onApplyThemeResource(Resources.Theme theme, int resid, boolean first) {
53         resid = SetupWizardUtils.getTheme(getIntent());
54         super.onApplyThemeResource(theme, resid, first);
55     }
56
57     @Override
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));
67     }
68
69     @Override
70     protected void onActivityResult(int requestCode, int resultCode, Intent data) {
71         if (requestCode == FINGERPRINT_FIND_SENSOR_REQUEST) {
72             if (data == null) {
73                 data = new Intent();
74             }
75             LockPatternUtils lockPatternUtils = new LockPatternUtils(this);
76             data.putExtra(SetupChooseLockGeneric.
77                     SetupChooseLockGenericFragment.EXTRA_PASSWORD_QUALITY,
78                     lockPatternUtils.getKeyguardStoredPasswordQuality(UserHandle.myUserId()));
79         }
80         super.onActivityResult(requestCode, resultCode, data);
81     }
82
83     @Override
84     protected void onCancelButtonClick() {
85         SetupSkipDialog dialog = SetupSkipDialog.newInstance(
86                 getIntent().getBooleanExtra(SetupSkipDialog.EXTRA_FRP_SUPPORTED, false));
87         dialog.show(getFragmentManager());
88     }
89
90     @Override
91     public void onNavigateBack() {
92         onBackPressed();
93     }
94
95     @Override
96     public void onNavigateNext() {
97         // next is handled via the onNextButtonClick method in FingerprintEnrollIntroduction
98     }
99
100     @Override
101     protected int getMetricsCategory() {
102         return MetricsEvent.FINGERPRINT_ENROLL_INTRO_SETUP;
103     }
104 }