Improved code by using a single call to setPositiveButton.

The positive button is always the same so there's no need to use two different
calls, I just brought one outside the if statement. It was an artifact left
from a previous test where I was changing both of the buttons.
This commit is contained in:
Marco Dalla Libera
2019-08-15 14:45:24 +02:00
parent 409c3eec55
commit 5f90628d2d
2 changed files with 2 additions and 6 deletions

View File

@@ -904,10 +904,9 @@ namespace keepass2android
AlertDialog.Builder b = new AlertDialog.Builder(this);
b.SetTitle(Resource.String.fingerprint_prefs);
b.SetMessage(btn.Tag.ToString());
b.SetPositiveButton(Android.Resource.String.Ok, (o, eventArgs) => ((Dialog)o).Dismiss());
if (_fingerprintDec != null)
{
b.SetPositiveButton(Android.Resource.String.Ok, (o, eventArgs) => ((Dialog)o).Dismiss());
b.SetNegativeButton(Resource.String.disable_sensor, (senderAlert, alertArgs) =>
{
btn.SetImageResource(Resource.Drawable.ic_fingerprint_error);
@@ -917,7 +916,6 @@ namespace keepass2android
}
else
{
b.SetPositiveButton(Android.Resource.String.Ok, (o, eventArgs) => ((Dialog)o).Dismiss());
b.SetNegativeButton(Resource.String.enable_sensor, (senderAlert, alertArgs) =>
{
InitFingerprintUnlock();

View File

@@ -181,10 +181,9 @@ namespace keepass2android
AlertDialog.Builder b = new AlertDialog.Builder(this);
b.SetTitle(Resource.String.fingerprint_prefs);
b.SetMessage(btn.Tag.ToString());
b.SetPositiveButton(Android.Resource.String.Ok, (o, eventArgs) => ((Dialog)o).Dismiss());
if (_fingerprintIdentifier != null)
{
b.SetPositiveButton(Android.Resource.String.Ok, (o, eventArgs) => ((Dialog)o).Dismiss());
b.SetNegativeButton(Resource.String.disable_sensor, (senderAlert, alertArgs) =>
{
btn.SetImageResource(Resource.Drawable.ic_fingerprint_error);
@@ -194,7 +193,6 @@ namespace keepass2android
}
else
{
b.SetPositiveButton(Android.Resource.String.Ok, (o, eventArgs) => ((Dialog)o).Dismiss());
b.SetNegativeButton(Resource.String.enable_sensor, (senderAlert, alertArgs) =>
{
InitFingerprintUnlock();