@@ -56,7 +56,7 @@ public void onClick(View v) {
56
56
// Set progress to max and disable edit of answer
57
57
ProgressBar progressBar = findViewById (R .id .quizTimeProgressBar );
58
58
progressBar .setProgress (progressBar .getMax ());
59
- updateEnablement ( false );
59
+ evaluateAnswer ( );
60
60
}
61
61
62
62
private void registerListeners () {
@@ -100,9 +100,7 @@ public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
100
100
progressBar .setProgress (remainingTime .intValue ());
101
101
102
102
if (remainingTime >= progressBar .getMax ()) {
103
- updateEnablement (false );
104
103
evaluateAnswer ();
105
- checkGameIsOver ();
106
104
}
107
105
}
108
106
@@ -119,6 +117,8 @@ public void onCancelled(@NonNull DatabaseError databaseError) {
119
117
}
120
118
121
119
private void evaluateAnswer () {
120
+ updateEnablement (false );
121
+
122
122
boolean correctAnswer = true ;
123
123
if (!currentQuestion .getAnswers ().get (0 ).getCorrect ().equals (((CheckBox ) findViewById (R .id .quizAnswer1 )).isChecked ())){
124
124
correctAnswer = false ;
@@ -144,9 +144,7 @@ private void evaluateAnswer() {
144
144
}
145
145
database .getReference (Game .class .getSimpleName ().toLowerCase () + "s" ).child (game ).child (scoreOfPlayer ).setValue (score );
146
146
((TextView ) findViewById (R .id .quizScore )).setText (String .valueOf (score ));
147
- ((CheckBox ) findViewById (R .id .quizAnswer1 )).setChecked (false );
148
- ((CheckBox ) findViewById (R .id .quizAnswer2 )).setChecked (false );
149
- ((CheckBox ) findViewById (R .id .quizAnswer2 )).setChecked (false );
147
+ checkGameIsOver ();
150
148
}
151
149
152
150
private void checkGameIsOver () {
@@ -160,9 +158,15 @@ private void checkGameIsOver() {
160
158
private void updateQuestionData (int questionNumber ) {
161
159
((TextView ) findViewById (R .id .quizQuestionCount )).setText ("Frage " + questionNumber + " von " + getIntent ().getIntExtra (LobbyActivity .QUESTION_COUNT_KEY , 0 ));
162
160
((TextView ) findViewById (R .id .quizQuestionText )).setText (currentQuestion .getText ());
161
+
163
162
((TextView ) findViewById (R .id .quizAnswerText1 )).setText (currentQuestion .getAnswers ().get (0 ).getText ());
163
+ ((CheckBox ) findViewById (R .id .quizAnswer1 )).setChecked (false );
164
+
164
165
((TextView ) findViewById (R .id .quizAnswerText2 )).setText (currentQuestion .getAnswers ().get (1 ).getText ());
166
+ ((CheckBox ) findViewById (R .id .quizAnswer2 )).setChecked (false );
167
+
165
168
((TextView ) findViewById (R .id .quizAnswerText3 )).setText (currentQuestion .getAnswers ().get (2 ).getText ());
169
+ ((CheckBox ) findViewById (R .id .quizAnswer2 )).setChecked (false );
166
170
}
167
171
168
172
private void updateEnablement (boolean enable ) {
0 commit comments