Finished filter support
The game now limits trivia file questions based on the question amount picked by the player on `MainActivity`.
This commit is contained in:
parent
c3c820715b
commit
8e84fe2ff5
|
@ -128,7 +128,11 @@ public class ApiUtil {
|
||||||
|
|
||||||
ArrayList<TriviaQuestion> questions = new ArrayList<>();
|
ArrayList<TriviaQuestion> questions = new ArrayList<>();
|
||||||
|
|
||||||
|
int elements = 0;
|
||||||
|
|
||||||
for (JsonElement element : jsonArray) {
|
for (JsonElement element : jsonArray) {
|
||||||
|
if (elements++ == filters.getAmount())
|
||||||
|
break;
|
||||||
JsonObject object = element.getAsJsonObject();
|
JsonObject object = element.getAsJsonObject();
|
||||||
TriviaType type = TriviaType.get(object.get("type").getAsString());
|
TriviaType type = TriviaType.get(object.get("type").getAsString());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue