Fix missing button clicks

This commit is contained in:
serso 2016-02-17 16:23:28 +01:00
parent bf4e7b52fc
commit 9e62536d68

View File

@ -64,22 +64,28 @@ public class FixableErrorFragment extends BaseDialogFragment {
@Override @Override
protected void onPrepareDialog(@NonNull AlertDialog.Builder builder) { protected void onPrepareDialog(@NonNull AlertDialog.Builder builder) {
builder.setMessage(error.message); builder.setMessage(error.message);
builder.setNeutralButton(R.string.cpp_dont_show_again, new DialogInterface.OnClickListener() { builder.setNeutralButton(R.string.cpp_dont_show_again, null);
@Override
public void onClick(DialogInterface dialog, int which) {
preferredPreferences.dontShowWarningDialog();
dismiss();
}
});
builder.setNegativeButton(R.string.close, null); builder.setNegativeButton(R.string.close, null);
if (error.error != null) { if (error.error != null) {
builder.setPositiveButton(R.string.fix, new DialogInterface.OnClickListener() { builder.setPositiveButton(R.string.fix, null);
}
}
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
switch (which) {
case DialogInterface.BUTTON_NEUTRAL:
preferredPreferences.dontShowWarningDialog();
dismiss();
break;
case DialogInterface.BUTTON_POSITIVE:
assert error.error != null;
error.error.fix(preferredPreferences); error.error.fix(preferredPreferences);
dismiss(); dismiss();
} break;
}); default:
super.onClick(dialog, which);
break;
} }
} }