Merge "Add dialog to confirm last fingerprint removal" into mnc-dev
This commit is contained in:
@@ -777,6 +777,15 @@
|
|||||||
<!-- Text shown when "Add fingerprint" button is disabled -->
|
<!-- 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>
|
<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] -->
|
<!-- 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>
|
<string name="confirm_fingerprint_icon_content_description">Use your fingerprint to continue.</string>
|
||||||
|
|
||||||
|
@@ -63,7 +63,6 @@ import com.android.settings.HelpUtils;
|
|||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.SettingsPreferenceFragment;
|
import com.android.settings.SettingsPreferenceFragment;
|
||||||
import com.android.settings.SubSettings;
|
import com.android.settings.SubSettings;
|
||||||
import com.android.settings.search.Indexable;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -569,11 +568,7 @@ public class FingerprintSettings extends SubSettings {
|
|||||||
new DialogInterface.OnClickListener() {
|
new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
if (DEBUG) Log.v(TAG, "Removing fpId=" + mFp.getFingerId());
|
onDeleteClick(dialog);
|
||||||
FingerprintSettingsFragment parent
|
|
||||||
= (FingerprintSettingsFragment) getTargetFragment();
|
|
||||||
parent.deleteFingerPrint(mFp);
|
|
||||||
dialog.dismiss();
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.create();
|
.create();
|
||||||
@@ -599,6 +594,24 @@ public class FingerprintSettings extends SubSettings {
|
|||||||
return alertDialog;
|
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
|
@Override
|
||||||
public void onSaveInstanceState(Bundle outState) {
|
public void onSaveInstanceState(Bundle outState) {
|
||||||
super.onSaveInstanceState(outState);
|
super.onSaveInstanceState(outState);
|
||||||
@@ -610,6 +623,39 @@ public class FingerprintSettings extends SubSettings {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 {
|
public static class FingerprintPreference extends Preference {
|
||||||
|
Reference in New Issue
Block a user