[Fingerprint] Add skip dialog during SUW

During setup wizard, add a skip dialog to confirm whether the user
wants to skip fingerprint setup or not.

Bug: 23228889
Change-Id: I2c1c26522b085e722e7bd7b34a26d2a38412bee4
This commit is contained in:
Maurice Lam
2015-08-27 21:28:23 -07:00
parent fbfdede15b
commit 48cf33a94e
2 changed files with 60 additions and 2 deletions

View File

@@ -759,6 +759,13 @@
<string name="setup_fingerprint_enroll_finish_message">Just touch the fingerprint sensor to wake and unlock your device.</string>
<!-- Message shown when fingerprint enrollment is completed, telling user about the fingerprint icon that will be shown whenever they can use their fingerprint [CHAR LIMIT=NONE] -->
<string name="setup_fingerprint_enroll_finish_message_secondary">When you see this icon, you can use your fingerprint.</string>
<!-- Title of the dialog shown when the user tries to skip fingerprint setup, asking them to confirm the action [CHAR LIMIT=40] -->
<string name="setup_fingerprint_enroll_enrolling_skip_title">Skip fingerprint setup?</string>
<!-- Content of the dialog shown when the user tries to skip fingerprint setup, asking them to confirm the action [CHAR LIMIT=NONE] -->
<string name="setup_fingerprint_enroll_enrolling_skip_message">To set up fingerprint access, stay on this screen and follow the instructions.</string>
<!-- Label of the button for the user to stay on fingerprint setup screen [CHAR LIMIT=20] -->
<string name="setup_fingerprint_enroll_enrolling_stay_button">Stay</string>
<!-- Button text to setup screen lock in onboard dialog [CHAR LIMIT=34] -->
<string name="security_settings_fingerprint_enroll_setup_screen_lock">Set up screen lock</string>
<!-- Button text to exit fingerprint wizard after everything is done [CHAR LIMIT=15] -->

View File

@@ -16,19 +16,29 @@
package com.android.settings.fingerprint;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.app.FragmentManager;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import com.android.internal.logging.MetricsLogger;
import com.android.settings.R;
import com.android.settings.SetupWizardUtils;
import com.android.setupwizardlib.util.SystemBarHelper;
import com.android.setupwizardlib.view.NavigationBar;
public class SetupFingerprintEnrollEnrolling extends FingerprintEnrollEnrolling
implements NavigationBar.NavigationBarListener {
private static final String TAG_DIALOG = "dialog";
@Override
protected Intent getFinishIntent() {
final Intent intent = new Intent(this, SetupFingerprintEnrollFinish.class);
@@ -69,12 +79,53 @@ public class SetupFingerprintEnrollEnrolling extends FingerprintEnrollEnrolling
@Override
public void onNavigateNext() {
setResult(RESULT_SKIP);
finish();
new SkipDialog().show(getFragmentManager(), TAG_DIALOG);
}
@Override
protected int getMetricsCategory() {
return MetricsLogger.FINGERPRINT_ENROLLING_SETUP;
}
public static class SkipDialog extends DialogFragment {
@Override
public void show(FragmentManager manager, String tag) {
if (manager.findFragmentByTag(tag) == null) {
super.show(manager, tag);
}
}
public SkipDialog() {
// no-arg constructor for fragment
}
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
final AlertDialog dialog = new AlertDialog.Builder(getActivity())
.setTitle(R.string.setup_fingerprint_enroll_enrolling_skip_title)
.setMessage(R.string.setup_fingerprint_enroll_enrolling_skip_message)
.setCancelable(false)
.setPositiveButton(R.string.skip_label,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
Activity activity = getActivity();
if (activity != null) {
activity.setResult(RESULT_SKIP);
activity.finish();
}
}
})
.setNegativeButton(R.string.setup_fingerprint_enroll_enrolling_stay_button,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
}
})
.create();
SystemBarHelper.hideSystemBars(dialog);
return dialog;
}
}
}