A simple app to do the following:
- Allow user to log in
- Download questionnaires(will be used interchangeably with surveys) from server
- Select a questionnaire and fill
- Syncs the responses every 15 minutes when network is available.
Here's how to run:
- Clone the repo from your editor(Android Studio/ IntelliJ)
File
->New
->Project From Version Control
- Input
git@github.com:keronei/survey-app.git
if you have set upSSH
orhttps://github.com/keronei/survey-app.git
if you prefer https(not recommended).
- Once complete, it will ask if to trust project, Go ahead and Trust its execution.
- No special keys/dependencies, let it sync, then connect a device and run.
- Use a phone number with +254xxxxxxxxx and password 1234GYD%$
Let's assume laziness got you unexpectedly, you can try this debug apk(might not be up-to-date).
The approach of this app is as follows;
- Downloads the
json
file containing question definitions. - Parses the questionnaires into
QuestionnaireDef
and questions toQuestionDef
- The widgets for various input types are predefined already e.g.
FloatWidget
, you can find this in app/com.keronei.survey/presentation/ui/views/widgets, which inherits from an abstract Class calledQuestionWidget
which defines most of the common functions likesaveAnswer
,createAnswerView
,getAnswerView
,setupQuestionLabel
e.t.c. - When a user selects a questionnaire to fill, a singleton class
QuestionnaireController
is given the questionnaire to process and provide easy access to questions by offering functions such asgetNextQuestion
,getPreviousQuestion
,getCurrentEvent
which returns events likeEVENT_BEGGINING_QUESTIONNAIRE
,EVENT_QUESTION
,EVENT_END_QUESTIONNAIRE
which is useful in determining how to guide the user in providing responses. - When the controller returns a question, a
WidgetFactory
class accepts aQuestionDef
and returns a widget representing the question, which can be added to the view. - This approach enables re-usability of widgets and robustness in handling questionnaires.
Here are some screens to expect.
The data is from the https://run.mocky.io.
Feel free to contribute to this project, and remember to follow the prerequisites as you work on the code.
Before every commit, make sure you run the following command:
./codeAnalysis
To check for dependency updates, run the following command:
./gradlew dependencyUpdate
Refer to this issue, if you get any issues running the lint commands on the terminal 🚀
- Gradle
- Gradle Kotlin DSL - For reference purposes, here's an article explaining the migration.
- Plugins
- Ktlint - creates convenient tasks in your Gradle project that run ktlint checks or do code auto format.
- Detekt - a static code analysis tool for the Kotlin programming language.
- Spotless - format java, groovy, markdown and license headers using gradle.
- Dokka - a documentation engine for Kotlin, performing the same function as javadoc for Java.
- jacoco - a Code Coverage Library.
- Gradle Versions - provides a task to determine which dependencies have updates. Additionally, the plugin checks for updates to Gradle itself.
For reference, here's a detailed explanation of the approach of the plugin configuration in this project - A Day with an Elephant in the Room: Configuring Gradle Plugins.