Don't show confirmation on empty message/input
This commit is contained in:
parent
38933ac323
commit
bea486d816
1 changed files with 62 additions and 57 deletions
|
@ -278,6 +278,7 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, D
|
|||
if (!initialEventTime.equals(eventTime)) {
|
||||
confirmMessage += "<br/> Time: " + DateUtil.dateAndTimeString(eventTime);
|
||||
}
|
||||
if(confirmMessage.length() > 0) {
|
||||
|
||||
final int finalCarbsAfterConstraints = carbsAfterConstraints;
|
||||
|
||||
|
@ -287,6 +288,7 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, D
|
|||
builder.setTitle(this.getContext().getString(R.string.confirmation));
|
||||
if (confirmMessage.startsWith("<br/>"))
|
||||
confirmMessage = confirmMessage.substring("<br/>".length());
|
||||
|
||||
builder.setMessage(Html.fromHtml(confirmMessage));
|
||||
builder.setPositiveButton(getString(R.string.ok), (dialog, id) -> {
|
||||
synchronized (builder) {
|
||||
|
@ -344,9 +346,12 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, D
|
|||
builder.setNegativeButton(getString(R.string.cancel), null);
|
||||
builder.show();
|
||||
dismiss();
|
||||
} else
|
||||
dismiss();
|
||||
} catch (Exception e) {
|
||||
log.error("Unhandled exception", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue