Skip to content

Commit

Permalink
Added functionality to answering
Browse files Browse the repository at this point in the history
Now, users using an external keyboard can press 'enter' to submit their
answer. Also, delayed clearing the answering textbox until the next
question is displayed.
  • Loading branch information
theblackwidower committed Feb 3, 2017
1 parent 4305ae4 commit d2033de
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/src/main/java/com/noprestige/kanaquiz/MainQuiz.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ protected void onCreate(Bundle savedInstanceState)
{
public boolean onEditorAction(TextView v, int actionId, KeyEvent event)
{
if ((actionId == EditorInfo.IME_ACTION_GO) && btnSubmit.isEnabled())
if (((actionId == EditorInfo.IME_ACTION_GO) || (actionId == EditorInfo.IME_NULL)) && btnSubmit.isEnabled())
{
submitAnswer();
return true;
Expand Down Expand Up @@ -141,7 +141,7 @@ private void checkAnswer()
lblResponse.setTextColor(ContextCompat.getColor(this, R.color.incorrect));
}
totalQuestions++;
txtAnswer.setText("");
txtAnswer.setEnabled(false);
btnSubmit.setEnabled(false);
}

Expand Down

0 comments on commit d2033de

Please sign in to comment.