OSDN Git Service

Merge "Allow users to pick a notification assistant."
[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.widget.Button;
23 import android.widget.TextView;
24
25 import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
26 import com.android.internal.widget.LockPatternUtils;
27 import com.android.settings.R;
28 import com.android.settings.SetupChooseLockGeneric;
29 import com.android.settings.SetupWizardUtils;
30
31 public class SetupFingerprintEnrollIntroduction extends FingerprintEnrollIntroduction {
32
33     @Override
34     protected Intent getChooseLockIntent() {
35         Intent intent = new Intent(this, SetupChooseLockGeneric.class);
36         SetupWizardUtils.copySetupExtras(getIntent(), intent);
37         return intent;
38     }
39
40     @Override
41     protected Intent getFindSensorIntent() {
42         final Intent intent = new Intent(this, SetupFingerprintEnrollFindSensor.class);
43         SetupWizardUtils.copySetupExtras(getIntent(), intent);
44         return intent;
45     }
46
47     @Override
48     protected void onApplyThemeResource(Resources.Theme theme, int resid, boolean first) {
49         resid = SetupWizardUtils.getTheme(getIntent());
50         super.onApplyThemeResource(theme, resid, first);
51     }
52
53     @Override
54     protected void initViews() {
55         super.initViews();
56
57         TextView description = (TextView) findViewById(R.id.description_text);
58         description.setText(
59                 R.string.security_settings_fingerprint_enroll_introduction_message_setup);
60
61         Button nextButton = getNextButton();
62         nextButton.setText(
63                 R.string.security_settings_fingerprint_enroll_introduction_continue_setup);
64
65         final Button cancelButton = (Button) findViewById(R.id.fingerprint_cancel_button);
66         cancelButton.setText(
67                 R.string.security_settings_fingerprint_enroll_introduction_cancel_setup);
68     }
69
70     @Override
71     protected void onActivityResult(int requestCode, int resultCode, Intent data) {
72         if (requestCode == FINGERPRINT_FIND_SENSOR_REQUEST) {
73             if (data == null) {
74                 data = new Intent();
75             }
76             LockPatternUtils lockPatternUtils = new LockPatternUtils(this);
77             data.putExtra(SetupChooseLockGeneric.
78                     SetupChooseLockGenericFragment.EXTRA_PASSWORD_QUALITY,
79                     lockPatternUtils.getKeyguardStoredPasswordQuality(UserHandle.myUserId()));
80         }
81         super.onActivityResult(requestCode, resultCode, data);
82     }
83
84     @Override
85     protected void onCancelButtonClick() {
86         SetupSkipDialog dialog = SetupSkipDialog.newInstance(
87                 getIntent().getBooleanExtra(SetupSkipDialog.EXTRA_FRP_SUPPORTED, false));
88         dialog.show(getFragmentManager());
89     }
90
91     @Override
92     public int getMetricsCategory() {
93         return MetricsEvent.FINGERPRINT_ENROLL_INTRO_SETUP;
94     }
95 }