Skip to content

NicholasSamaroo/Trivia-App

Repository files navigation

Trivia-App

OVERVIEW

Utilized the jservice API to create a trivia app. Users have the option to either play "blitz" or "main show". In "blitz", they have to answer 5 randomly pulled questions with 30 seconds to answer each question. In the "main show", they play a longer game consisting of 4 categories with 4 clues each; the same 30 second time limit applies here as well.

TECHNICAL OVERVIEW

Data is pulled from the API using Retrofit and RxJava / RxAndroid. The clues for "blitz" can be retrieved with one GET request, but getting the data for "main show" requires working with RxJava / RxAndroid; more specifically, we need to retrieve the categories from the API and then for each category returned we need to use its ID to get the clues for that category. So, RxJava / RxAndroid provides more flexibility in terms of avoiding nested callbacks. The API call to get categories has an option to pass an integer offset if we want to get new categories on every launch of "main show". This integer is stored in Shared preferences and is incremented by 4 (because there are 4 categories on the board) and stored back to shared preferences after every succesful call for categories.

The board for "main show" is generated dynamically in code by using GridLayout. There are 20 cells on that board so hard coding those in the layout XML file would be inefficient and tedious; also knowing which cell they clicked would result in a large chunk of hard coded values in the Java code. So, as mentioned, each view is dynamically created and has a click listener set on it as well as a tag which corresponds to its position in the list where the data is held. This results in the right clue being displayed when the user clicks on a cell. Shape drawables defined in XML are used for styling the cells as well as the views that display the highscores on the main screen and the views that display clue information. CountDownTimer is used to enforce the 30 second time limit.

MAIN SHOW DEMO

MainShowDemo

BLITZ DEMO

BlitzDemo

STATIC APP IMAGES

LaunchScreen

MainShowBoard

MainShowQuestion

BlitzQuestion

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages