Skip to content

Commit

Permalink
Don't let the user add an empty opening hours description (fixes #721)
Browse files Browse the repository at this point in the history
  • Loading branch information
westnordost committed Jan 3, 2018
1 parent 8dec9bc commit 76425e4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,21 @@ private void showInputCommentDialog()
View view = LayoutInflater.from(getActivity()).inflate(R.layout.quest_opening_hours_comment, null);
final EditText editText = view.findViewById(R.id.commentInput);

new AlertDialogBuilder(getActivity())
new AlertDialogBuilder(getContext())
.setTitle(R.string.quest_openingHours_comment_title)
.setView(view)
.setPositiveButton(android.R.string.ok, (dialog, which) ->
{
String txt = editText.getText().toString().replaceAll("\"","");
String txt = editText.getText().toString().replaceAll("\"","").trim();
if(txt.isEmpty())
{
new AlertDialogBuilder(getContext())
.setMessage(R.string.quest_openingHours_emptyAnswer)
.setPositiveButton(R.string.ok, null)
.show();
return;
}

Bundle answer = new Bundle();
answer.putString(OPENING_HOURS, "\""+txt+"\"");
applyImmediateAnswer(answer);
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -440,4 +440,5 @@ Otherwise, you can download another keyboard in the app store. Popular keyboards
<string name="quest_housenumber_conscription_number_required">A conscription number must be specified</string>
<string name="quest_cycleway_answer_contraflow_cycleway">Also cycleway on other side</string>
<string name="need_specify_both_sides">You need to specify both sides</string>
<string name="quest_openingHours_emptyAnswer">You need to describe what is on the sign. If there is no sign, you should ask for the opening hours inside.</string>
</resources>

0 comments on commit 76425e4

Please sign in to comment.