<!-- Text shown when "Add fingerprint" button is disabled -->
<string name="fingerprint_add_max">You can add up to <xliff:g id="count" example="5">%d</xliff:g> fingerprints</string>
+ <!-- Title shown in a dialog which asks the user to confirm when the last fingerprint gets deleted by him. [CHAR LIMIT=35]-->
+ <string name="fingerprint_last_delete_title">Remove all fingerprints?</string>
+
+ <!-- Message shown in a dialog which asks the user to confirm when the last fingerprint gets deleted by him. [CHAR LIMIT=NONE]-->
+ <string name="fingerprint_last_delete_message">You won\'t be able to use your fingerprints to unlock your phone, authorize purchases, or sign in to apps with them.</string>
+
+ <!-- Button to confirm the last removing the last fingerprint. [CHAR LIMIT=20]-->
+ <string name="fingerprint_last_delete_confirm">Yes, remove</string>
+
<!-- Content description for the fingerprint icon when the user is prompted to enter his credentials. Not shown on the screen. [CHAR LIMIT=NONE] -->
<string name="confirm_fingerprint_icon_content_description">Use your fingerprint to continue.</string>
import com.android.settings.R;
import com.android.settings.SettingsPreferenceFragment;
import com.android.settings.SubSettings;
-import com.android.settings.search.Indexable;
import java.util.List;
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
- if (DEBUG) Log.v(TAG, "Removing fpId=" + mFp.getFingerId());
- FingerprintSettingsFragment parent
- = (FingerprintSettingsFragment) getTargetFragment();
- parent.deleteFingerPrint(mFp);
- dialog.dismiss();
+ onDeleteClick(dialog);
}
})
.create();
return alertDialog;
}
+ private void onDeleteClick(DialogInterface dialog) {
+ if (DEBUG) Log.v(TAG, "Removing fpId=" + mFp.getFingerId());
+ FingerprintSettingsFragment parent
+ = (FingerprintSettingsFragment) getTargetFragment();
+ if (parent.mFingerprintManager.getEnrolledFingerprints().size() > 1) {
+ parent.deleteFingerPrint(mFp);
+ } else {
+ ConfirmLastDeleteDialog lastDeleteDialog = new ConfirmLastDeleteDialog();
+ Bundle args = new Bundle();
+ args.putParcelable("fingerprint", mFp);
+ lastDeleteDialog.setArguments(args);
+ lastDeleteDialog.setTargetFragment(getTargetFragment(), 0);
+ lastDeleteDialog.show(getFragmentManager(),
+ ConfirmLastDeleteDialog.class.getName());
+ }
+ dialog.dismiss();
+ }
+
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
}
}
}
+
+ public static class ConfirmLastDeleteDialog extends DialogFragment {
+
+ private Fingerprint mFp;
+
+ @Override
+ public Dialog onCreateDialog(Bundle savedInstanceState) {
+ mFp = getArguments().getParcelable("fingerprint");
+ final AlertDialog alertDialog = new AlertDialog.Builder(getActivity())
+ .setTitle(R.string.fingerprint_last_delete_title)
+ .setMessage(R.string.fingerprint_last_delete_message)
+ .setPositiveButton(R.string.fingerprint_last_delete_confirm,
+ new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ FingerprintSettingsFragment parent
+ = (FingerprintSettingsFragment) getTargetFragment();
+ parent.deleteFingerPrint(mFp);
+ dialog.dismiss();
+ }
+ })
+ .setNegativeButton(
+ R.string.cancel,
+ new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ dialog.dismiss();
+ }
+ })
+ .create();
+ return alertDialog;
+ }
+ }
}
public static class FingerprintPreference extends Preference {