Skip to content
This repository has been archived by the owner on Jul 18, 2024. It is now read-only.

Commit

Permalink
Merge pull request #201 from ryanwarsaw/config-popup-api
Browse files Browse the repository at this point in the history
Fixes #191: Custom end-of-quiz popup message for introduction quiz
  • Loading branch information
ryanwarsaw authored Oct 5, 2018
2 parents 5289830 + 11870fb commit 59a5c7c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ android {
applicationId "com.ryanwarsaw.coach_erevu"
minSdkVersion 19
targetSdkVersion 28
versionCode 5
versionName "3.1"
versionCode 6
versionName "3.2"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,11 @@ public void advanceToNextQuestion() {
// Build the dialog to inform the user they've finished the quiz, and present it to them.
AlertDialog alertDialog = new AlertDialog.Builder(this).create();
alertDialog.setTitle(getResources().getString(R.string.quiz_end_title));
alertDialog.setMessage(getResources().getString(R.string.quiz_end));

// If topic has "end-of-quiz" property set use that, otherwise pull default from string resource.
alertDialog.setMessage(topic.getEndOfQuiz() != null ?
topic.getEndOfQuiz() : getResources().getString(R.string.quiz_end));

alertDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
public void onDismiss(DialogInterface dialog) {
finish();
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/java/com/ryanwarsaw/coach_erevu/model/Topic.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ public class Topic {
@SerializedName("video")
private String videoName;

@SerializedName("end-of-quiz")
private String endOfQuiz;

@SerializedName("questions")
private List<Question> questions;
}
1 change: 1 addition & 0 deletions app/src/main/res/raw/content.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"title": "Intangamarara",
"color": "#45b39d",
"video": "introduction.mp4",
"end-of-quiz": "Mwakoze gukorera hamwe aka kabazo nk’umurwi!",
"questions": [
{
"question": "Ni ikihe ciyumviro rusangi cawe kijanye n'ugukunda iyi reresi?",
Expand Down

0 comments on commit 59a5c7c

Please sign in to comment.