Add dialog when user touches fingerprint icon
Bug: 20495507 Change-Id: I6779aba7ca988fd9a8eee07afca2a410de144a26
This commit is contained in:
@@ -788,6 +788,10 @@
|
|||||||
<string name="security_settings_fingerprint_enroll_setup_screen_lock">Setup screen lock</string>
|
<string name="security_settings_fingerprint_enroll_setup_screen_lock">Setup screen lock</string>
|
||||||
<!-- Button text to exit fingerprint wizard after everything is done [CHAR LIMIT=15] -->
|
<!-- Button text to exit fingerprint wizard after everything is done [CHAR LIMIT=15] -->
|
||||||
<string name="security_settings_fingerprint_enroll_done">Done</string>
|
<string name="security_settings_fingerprint_enroll_done">Done</string>
|
||||||
|
<!-- Dialog title for dialog which shows when user touches the icon on the screen, instead of the sensor at the back [CHAR LIMIT=45] -->
|
||||||
|
<string name="security_settings_fingerprint_enroll_touch_dialog_title">Whoops, that\'s not the sensor</string>
|
||||||
|
<!-- Dialog message for dialog which shows when user touches the icon on the screen, instead of the sensor at the back [CHAR LIMIT=45] -->
|
||||||
|
<string name="security_settings_fingerprint_enroll_touch_dialog_message">Use the fingerprint sensor on your device.</string>
|
||||||
<!-- Button text shown at the end of enrollment that allows the user to add another fingerprint -->
|
<!-- Button text shown at the end of enrollment that allows the user to add another fingerprint -->
|
||||||
<string name="fingerprint_enroll_button_add">Add another</string>
|
<string name="fingerprint_enroll_button_add">Add another</string>
|
||||||
<!-- Button text shown at the end of enrollment that allows the user to move to the next step -->
|
<!-- Button text shown at the end of enrollment that allows the user to move to the next step -->
|
||||||
|
@@ -18,12 +18,17 @@ package com.android.settings.fingerprint;
|
|||||||
|
|
||||||
import android.animation.Animator;
|
import android.animation.Animator;
|
||||||
import android.animation.ObjectAnimator;
|
import android.animation.ObjectAnimator;
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.app.Dialog;
|
||||||
|
import android.app.DialogFragment;
|
||||||
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.hardware.fingerprint.FingerprintManager;
|
import android.hardware.fingerprint.FingerprintManager;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.CancellationSignal;
|
import android.os.CancellationSignal;
|
||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.animation.AnimationUtils;
|
import android.view.animation.AnimationUtils;
|
||||||
import android.view.animation.Interpolator;
|
import android.view.animation.Interpolator;
|
||||||
@@ -42,6 +47,12 @@ public class FingerprintEnrollEnrolling extends FingerprintEnrollBase {
|
|||||||
private static final int PROGRESS_BAR_MAX = 10000;
|
private static final int PROGRESS_BAR_MAX = 10000;
|
||||||
private static final int FINISH_DELAY = 250;
|
private static final int FINISH_DELAY = 250;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* How many times the user needs to touch the icon until we show the dialog that this is not the
|
||||||
|
* fingerprint sensor.
|
||||||
|
*/
|
||||||
|
private static final int ICON_TOUCH_COUNT_SHOW_UNTIL_DIALOG_SHOWN = 3;
|
||||||
|
|
||||||
private PowerManager mPowerManager;
|
private PowerManager mPowerManager;
|
||||||
private CancellationSignal mEnrollmentCancel = new CancellationSignal();
|
private CancellationSignal mEnrollmentCancel = new CancellationSignal();
|
||||||
private int mEnrollmentSteps;
|
private int mEnrollmentSteps;
|
||||||
@@ -53,6 +64,7 @@ public class FingerprintEnrollEnrolling extends FingerprintEnrollBase {
|
|||||||
private TextView mRepeatMessage;
|
private TextView mRepeatMessage;
|
||||||
private TextView mErrorText;
|
private TextView mErrorText;
|
||||||
private Interpolator mFastOutSlowInInterpolator;
|
private Interpolator mFastOutSlowInInterpolator;
|
||||||
|
private int mIconTouchCount;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@@ -67,6 +79,19 @@ public class FingerprintEnrollEnrolling extends FingerprintEnrollBase {
|
|||||||
mFingerprintAnimator = (ImageView) findViewById(R.id.fingerprint_animator);
|
mFingerprintAnimator = (ImageView) findViewById(R.id.fingerprint_animator);
|
||||||
mFastOutSlowInInterpolator = AnimationUtils.loadInterpolator(
|
mFastOutSlowInInterpolator = AnimationUtils.loadInterpolator(
|
||||||
this, android.R.interpolator.fast_out_slow_in);
|
this, android.R.interpolator.fast_out_slow_in);
|
||||||
|
findViewById(R.id.fingerprint_animator).setOnTouchListener(new View.OnTouchListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onTouch(View v, MotionEvent event) {
|
||||||
|
if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
|
||||||
|
mIconTouchCount++;
|
||||||
|
if (mIconTouchCount == ICON_TOUCH_COUNT_SHOW_UNTIL_DIALOG_SHOWN) {
|
||||||
|
showIconTouchDialog();
|
||||||
|
mIconTouchCount = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
startEnrollment();
|
startEnrollment();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,6 +150,10 @@ public class FingerprintEnrollEnrolling extends FingerprintEnrollBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void showIconTouchDialog() {
|
||||||
|
new IconTouchDialog().show(getFragmentManager(), null /* tag */);
|
||||||
|
}
|
||||||
|
|
||||||
private final Animator.AnimatorListener mProgressAnimationListener
|
private final Animator.AnimatorListener mProgressAnimationListener
|
||||||
= new Animator.AnimatorListener() {
|
= new Animator.AnimatorListener() {
|
||||||
|
|
||||||
@@ -184,4 +213,22 @@ public class FingerprintEnrollEnrolling extends FingerprintEnrollBase {
|
|||||||
launchFinish(mToken);
|
launchFinish(mToken);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private static class IconTouchDialog extends DialogFragment {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||||
|
builder.setTitle(R.string.security_settings_fingerprint_enroll_touch_dialog_title)
|
||||||
|
.setMessage(R.string.security_settings_fingerprint_enroll_touch_dialog_message)
|
||||||
|
.setPositiveButton(R.string.security_settings_fingerprint_enroll_dialog_ok,
|
||||||
|
new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
dialog.dismiss();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return builder.create();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user