SetupFingerprintEnrollFindSensor.java revision 9d1bfd1e8de6e46137a9571507c03526880d6a46
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
17package com.android.settings.fingerprint;
18
19import android.content.Intent;
20import android.content.res.Resources;
21import android.os.UserHandle;
22import android.view.View;
23import android.widget.Button;
24
25import com.android.internal.logging.MetricsProto.MetricsEvent;
26import com.android.settings.ChooseLockSettingsHelper;
27import com.android.settings.R;
28import com.android.settings.SetupWizardUtils;
29import com.android.setupwizardlib.view.NavigationBar;
30
31public class SetupFingerprintEnrollFindSensor extends FingerprintEnrollFindSensor
32        implements NavigationBar.NavigationBarListener {
33
34    @Override
35    protected int getContentView() {
36        return R.layout.setup_fingerprint_enroll_find_sensor;
37    }
38
39    @Override
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
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
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
70    protected Button getNextButton() {
71        return getNavigationBar().getNextButton();
72    }
73
74    @Override
75    public void onNavigateBack() {
76        onBackPressed();
77    }
78
79    @Override
80    public void onNavigateNext() {
81        onNextButtonClick();
82    }
83
84    @Override
85    protected int getMetricsCategory() {
86        return MetricsEvent.FINGERPRINT_FIND_SENSOR_SETUP;
87    }
88}
89