├── .gitignore
├── .idea
├── codeStyles
│ ├── Project.xml
│ └── codeStyleConfig.xml
├── gradle.xml
├── jarRepositories.xml
├── misc.xml
└── runConfigurations.xml
├── app
├── .gitignore
├── build.gradle
├── google-services.json
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── com
│ │ └── cheezycode
│ │ └── quizzed
│ │ └── ExampleInstrumentedTest.kt
│ ├── main
│ ├── AndroidManifest.xml
│ ├── java
│ │ └── com
│ │ │ └── cheezycode
│ │ │ └── quizzed
│ │ │ ├── activities
│ │ │ ├── LoginActivity.kt
│ │ │ ├── LoginIntro.kt
│ │ │ ├── MainActivity.kt
│ │ │ ├── ProfileActivity.kt
│ │ │ ├── QuestionActivity.kt
│ │ │ ├── ResultActivity.kt
│ │ │ └── SignupActivity.kt
│ │ │ ├── adapters
│ │ │ ├── OptionAdapter.kt
│ │ │ └── QuizAdapter.kt
│ │ │ ├── models
│ │ │ ├── Question.kt
│ │ │ └── Quiz.kt
│ │ │ └── utils
│ │ │ ├── ColorPicker.kt
│ │ │ └── IconPicker.kt
│ └── res
│ │ ├── drawable-v24
│ │ └── ic_launcher_foreground.xml
│ │ ├── drawable
│ │ ├── btn_primary.xml
│ │ ├── edit_text_background.xml
│ │ ├── ic_date.xml
│ │ ├── ic_hamburger.xml
│ │ ├── ic_icon.png
│ │ ├── ic_icon_1.xml
│ │ ├── ic_icon_2.xml
│ │ ├── ic_icon_3.xml
│ │ ├── ic_icon_4.xml
│ │ ├── ic_icon_5.xml
│ │ ├── ic_icon_6.xml
│ │ ├── ic_icon_7.xml
│ │ ├── ic_icon_8.xml
│ │ ├── ic_icon_trophy.xml
│ │ ├── ic_launcher_background.xml
│ │ ├── ic_quiz_login_hero_image.xml
│ │ ├── ic_wave.xml
│ │ ├── option_item_bg.xml
│ │ └── option_item_selected_bg.xml
│ │ ├── layout
│ │ ├── activity_login.xml
│ │ ├── activity_login_intro.xml
│ │ ├── activity_main.xml
│ │ ├── activity_profile.xml
│ │ ├── activity_question.xml
│ │ ├── activity_result.xml
│ │ ├── activity_signup.xml
│ │ ├── drawer_header.xml
│ │ ├── option_item.xml
│ │ └── quiz_item.xml
│ │ ├── menu
│ │ └── drawer_menu.xml
│ │ ├── mipmap-anydpi-v26
│ │ ├── ic_launcher.xml
│ │ └── ic_launcher_round.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ └── values
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── test
│ └── java
│ └── com
│ └── cheezycode
│ └── quizzed
│ └── ExampleUnitTest.kt
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | /.idea/navEditor.xml
9 | /.idea/assetWizardSettings.xml
10 | .DS_Store
11 | /build
12 | /captures
13 | .externalNativeBuild
14 | .cxx
15 |
--------------------------------------------------------------------------------
/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
11 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | xmlns:android
33 |
34 | ^$
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 | xmlns:.*
44 |
45 | ^$
46 |
47 |
48 | BY_NAME
49 |
50 |
51 |
52 |
53 |
54 |
55 | .*:id
56 |
57 | http://schemas.android.com/apk/res/android
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 | .*:name
67 |
68 | http://schemas.android.com/apk/res/android
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 | name
78 |
79 | ^$
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 | style
89 |
90 | ^$
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 | .*
100 |
101 | ^$
102 |
103 |
104 | BY_NAME
105 |
106 |
107 |
108 |
109 |
110 |
111 | .*
112 |
113 | http://schemas.android.com/apk/res/android
114 |
115 |
116 | ANDROID_ATTRIBUTE_ORDER
117 |
118 |
119 |
120 |
121 |
122 |
123 | .*
124 |
125 | .*
126 |
127 |
128 | BY_NAME
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
--------------------------------------------------------------------------------
/.idea/codeStyles/codeStyleConfig.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
20 |
21 |
--------------------------------------------------------------------------------
/.idea/jarRepositories.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/.idea/runConfigurations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'kotlin-android'
3 | apply plugin: 'kotlin-android-extensions'
4 | apply plugin: 'com.google.gms.google-services'
5 |
6 | android {
7 | compileSdkVersion 29
8 |
9 | defaultConfig {
10 | applicationId "com.cheezycode.quizzed"
11 | minSdkVersion 21
12 | targetSdkVersion 29
13 | versionCode 1
14 | versionName "1.0"
15 |
16 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
17 | }
18 |
19 | buildTypes {
20 | release {
21 | minifyEnabled false
22 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
23 | }
24 | }
25 | }
26 |
27 | dependencies {
28 | implementation fileTree(dir: "libs", include: ["*.jar"])
29 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
30 | implementation 'androidx.core:core-ktx:1.3.2'
31 | implementation 'androidx.appcompat:appcompat:1.2.0'
32 | implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
33 | implementation 'com.google.firebase:firebase-auth:19.3.2'
34 | implementation 'com.google.firebase:firebase-firestore:22.0.0'
35 | testImplementation 'junit:junit:4.12'
36 | androidTestImplementation 'androidx.test.ext:junit:1.1.2'
37 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
38 | implementation 'com.google.android.material:material:1.1.0'
39 | implementation 'com.google.code.gson:gson:2.8.6'
40 | }
41 |
--------------------------------------------------------------------------------
/app/google-services.json:
--------------------------------------------------------------------------------
1 | {
2 | "project_info": {
3 | "project_number": "1094127200925",
4 | "firebase_url": "https://quizzed-7ef7e.firebaseio.com",
5 | "project_id": "quizzed-7ef7e",
6 | "storage_bucket": "quizzed-7ef7e.appspot.com"
7 | },
8 | "client": [
9 | {
10 | "client_info": {
11 | "mobilesdk_app_id": "1:1094127200925:android:0b60d33b1955db55904274",
12 | "android_client_info": {
13 | "package_name": "com.cheezycode.quizzed"
14 | }
15 | },
16 | "oauth_client": [
17 | {
18 | "client_id": "1094127200925-6qaal2hf85mk1a3jbaf5v6geb1feept3.apps.googleusercontent.com",
19 | "client_type": 3
20 | }
21 | ],
22 | "api_key": [
23 | {
24 | "current_key": "AIzaSyDECeQy5p3BX8WiQVBVWgyPzHVynIwiWWM"
25 | }
26 | ],
27 | "services": {
28 | "appinvite_service": {
29 | "other_platform_oauth_client": [
30 | {
31 | "client_id": "1094127200925-6qaal2hf85mk1a3jbaf5v6geb1feept3.apps.googleusercontent.com",
32 | "client_type": 3
33 | }
34 | ]
35 | }
36 | }
37 | }
38 | ],
39 | "configuration_version": "1"
40 | }
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/cheezycode/quizzed/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package com.cheezycode.quizzed
2 |
3 | import androidx.test.platform.app.InstrumentationRegistry
4 | import androidx.test.ext.junit.runners.AndroidJUnit4
5 |
6 | import org.junit.Test
7 | import org.junit.runner.RunWith
8 |
9 | import org.junit.Assert.*
10 |
11 | /**
12 | * Instrumented test, which will execute on an Android device.
13 | *
14 | * See [testing documentation](http://d.android.com/tools/testing).
15 | */
16 | @RunWith(AndroidJUnit4::class)
17 | class ExampleInstrumentedTest {
18 | @Test
19 | fun useAppContext() {
20 | // Context of the app under test.
21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22 | assertEquals("com.cheezycode.quizzed", appContext.packageName)
23 | }
24 | }
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
14 |
15 |
16 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/app/src/main/java/com/cheezycode/quizzed/activities/LoginActivity.kt:
--------------------------------------------------------------------------------
1 | package com.cheezycode.quizzed.activities
2 |
3 | import android.content.Intent
4 | import androidx.appcompat.app.AppCompatActivity
5 | import android.os.Bundle
6 | import android.widget.Toast
7 | import com.cheezycode.quizzed.R
8 | import com.google.firebase.auth.FirebaseAuth
9 | import kotlinx.android.synthetic.main.activity_login.*
10 |
11 | class LoginActivity : AppCompatActivity() {
12 |
13 | lateinit var firebaseAuth: FirebaseAuth
14 |
15 | override fun onCreate(savedInstanceState: Bundle?) {
16 | super.onCreate(savedInstanceState)
17 | setContentView(R.layout.activity_login)
18 | firebaseAuth = FirebaseAuth.getInstance()
19 |
20 | btnLogin.setOnClickListener {
21 | login()
22 | }
23 |
24 | btnSignUp.setOnClickListener {
25 | val intent = Intent(this, SignupActivity::class.java)
26 | startActivity(intent)
27 | finish()
28 | }
29 |
30 | }
31 |
32 | private fun login(){
33 | val email = etEmailAddress.text.toString()
34 | val password = etPassword.text.toString()
35 |
36 |
37 | if (email.isBlank() || password.isBlank()) {
38 | Toast.makeText(this, "Email/password cannot be empty", Toast.LENGTH_SHORT).show()
39 | return
40 | }
41 |
42 | firebaseAuth.signInWithEmailAndPassword(email, password).addOnCompleteListener(this){
43 | if(it.isSuccessful){
44 | Toast.makeText(this, "Success", Toast.LENGTH_SHORT).show()
45 | val intent = Intent(this, MainActivity::class.java)
46 | startActivity(intent)
47 | finish()
48 | }
49 | else{
50 | Toast.makeText(this, "Authentication Failed", Toast.LENGTH_SHORT).show()
51 | }
52 | }
53 | }
54 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/cheezycode/quizzed/activities/LoginIntro.kt:
--------------------------------------------------------------------------------
1 | package com.cheezycode.quizzed.activities
2 |
3 | import android.content.Intent
4 | import androidx.appcompat.app.AppCompatActivity
5 | import android.os.Bundle
6 | import android.widget.Toast
7 | import com.cheezycode.quizzed.R
8 | import com.google.firebase.auth.FirebaseAuth
9 | import kotlinx.android.synthetic.main.activity_login_intro.*
10 | import java.lang.Exception
11 |
12 | class LoginIntro : AppCompatActivity() {
13 | override fun onCreate(savedInstanceState: Bundle?) {
14 | super.onCreate(savedInstanceState)
15 | setContentView(R.layout.activity_login_intro)
16 | val auth = FirebaseAuth.getInstance()
17 | if(auth.currentUser != null){
18 | Toast.makeText(this, "User is already logged in!", Toast.LENGTH_SHORT).show()
19 | redirect("MAIN")
20 | }
21 |
22 | btnGetStarted.setOnClickListener {
23 | redirect("LOGIN")
24 | }
25 | }
26 |
27 | private fun redirect(name:String){
28 | val intent = when(name){
29 | "LOGIN" -> Intent(this, LoginActivity::class.java)
30 | "MAIN" -> Intent(this, MainActivity::class.java)
31 | else -> throw Exception("no path exists")
32 | }
33 | startActivity(intent)
34 | finish()
35 | }
36 |
37 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/cheezycode/quizzed/activities/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.cheezycode.quizzed.activities
2 |
3 | import android.content.Intent
4 | import androidx.appcompat.app.AppCompatActivity
5 | import android.os.Bundle
6 | import android.util.Log
7 | import android.view.MenuItem
8 | import android.widget.Toast
9 | import androidx.appcompat.app.ActionBarDrawerToggle
10 | import androidx.recyclerview.widget.GridLayoutManager
11 | import com.cheezycode.quizzed.R
12 | import com.cheezycode.quizzed.adapters.QuizAdapter
13 | import com.cheezycode.quizzed.models.Quiz
14 | import com.google.android.material.datepicker.MaterialDatePicker
15 | import com.google.firebase.firestore.FirebaseFirestore
16 | import kotlinx.android.synthetic.main.activity_main.*
17 | import java.text.SimpleDateFormat
18 | import java.util.*
19 |
20 | class MainActivity : AppCompatActivity() {
21 |
22 | lateinit var actionBarDrawerToggle: ActionBarDrawerToggle
23 | lateinit var adapter: QuizAdapter
24 | private var quizList = mutableListOf()
25 | lateinit var firestore: FirebaseFirestore
26 |
27 | override fun onCreate(savedInstanceState: Bundle?) {
28 | super.onCreate(savedInstanceState)
29 | setContentView(R.layout.activity_main)
30 | setUpViews()
31 | }
32 |
33 | fun setUpViews() {
34 | setUpFireStore()
35 | setUpDrawerLayout()
36 | setUpRecyclerView()
37 | setUpDatePicker()
38 | }
39 |
40 | private fun setUpDatePicker() {
41 | btnDatePicker.setOnClickListener {
42 | val datePicker = MaterialDatePicker.Builder.datePicker().build()
43 | datePicker.show(supportFragmentManager, "DatePicker")
44 | datePicker.addOnPositiveButtonClickListener {
45 | Log.d("DATEPICKER", datePicker.headerText)
46 | val dateFormatter = SimpleDateFormat("dd-mm-yyyy")
47 | val date = dateFormatter.format(Date(it))
48 | val intent = Intent(this, QuestionActivity::class.java)
49 | intent.putExtra("DATE", date)
50 | startActivity(intent)
51 | }
52 | datePicker.addOnNegativeButtonClickListener {
53 | Log.d("DATEPICKER", datePicker.headerText)
54 |
55 | }
56 | datePicker.addOnCancelListener {
57 | Log.d("DATEPICKER", "Date Picker Cancelled")
58 | }
59 | }
60 | }
61 |
62 | private fun setUpFireStore() {
63 | firestore = FirebaseFirestore.getInstance()
64 | val collectionReference = firestore.collection("quizzes")
65 | collectionReference.addSnapshotListener { value, error ->
66 | if(value == null || error != null){
67 | Toast.makeText(this, "Error fetching data", Toast.LENGTH_SHORT).show()
68 | return@addSnapshotListener
69 | }
70 | Log.d("DATA", value.toObjects(Quiz::class.java).toString())
71 | quizList.clear()
72 | quizList.addAll(value.toObjects(Quiz::class.java))
73 | adapter.notifyDataSetChanged()
74 | }
75 | }
76 |
77 | private fun setUpRecyclerView() {
78 | adapter = QuizAdapter(this, quizList)
79 | quizRecyclerView.layoutManager = GridLayoutManager(this, 2)
80 | quizRecyclerView.adapter = adapter
81 | }
82 |
83 | fun setUpDrawerLayout() {
84 | setSupportActionBar(appBar)
85 | actionBarDrawerToggle =
86 | ActionBarDrawerToggle(this, mainDrawer, R.string.app_name, R.string.app_name)
87 | actionBarDrawerToggle.syncState()
88 | navigationView.setNavigationItemSelectedListener {
89 | val intent = Intent(this, ProfileActivity::class.java)
90 | startActivity(intent)
91 | mainDrawer.closeDrawers()
92 | true
93 | }
94 | }
95 |
96 | override fun onOptionsItemSelected(item: MenuItem): Boolean {
97 | if (actionBarDrawerToggle.onOptionsItemSelected(item)) {
98 | return true
99 | }
100 | return super.onOptionsItemSelected(item)
101 | }
102 |
103 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/cheezycode/quizzed/activities/ProfileActivity.kt:
--------------------------------------------------------------------------------
1 | package com.cheezycode.quizzed.activities
2 |
3 | import android.content.Intent
4 | import androidx.appcompat.app.AppCompatActivity
5 | import android.os.Bundle
6 | import com.cheezycode.quizzed.R
7 | import com.google.firebase.auth.FirebaseAuth
8 | import kotlinx.android.synthetic.main.activity_profile.*
9 |
10 | class ProfileActivity : AppCompatActivity() {
11 | lateinit var firebaseAuth: FirebaseAuth
12 |
13 | override fun onCreate(savedInstanceState: Bundle?) {
14 | super.onCreate(savedInstanceState)
15 | setContentView(R.layout.activity_profile)
16 | firebaseAuth = FirebaseAuth.getInstance()
17 | txtEmail.text = firebaseAuth.currentUser?.email
18 |
19 | btnLogout.setOnClickListener {
20 | FirebaseAuth.getInstance().signOut()
21 | val intent = Intent(this, LoginActivity::class.java)
22 | startActivity(intent)
23 |
24 | }
25 | }
26 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/cheezycode/quizzed/activities/QuestionActivity.kt:
--------------------------------------------------------------------------------
1 | package com.cheezycode.quizzed.activities
2 |
3 | import android.content.Intent
4 | import androidx.appcompat.app.AppCompatActivity
5 | import android.os.Bundle
6 | import android.util.Log
7 | import android.view.View
8 | import androidx.recyclerview.widget.LinearLayoutManager
9 | import com.cheezycode.quizzed.R
10 | import com.cheezycode.quizzed.adapters.OptionAdapter
11 | import com.cheezycode.quizzed.models.Question
12 | import com.cheezycode.quizzed.models.Quiz
13 | import com.google.firebase.firestore.FirebaseFirestore
14 | import com.google.gson.Gson
15 | import kotlinx.android.synthetic.main.activity_question.*
16 |
17 | class QuestionActivity : AppCompatActivity() {
18 |
19 | var quizzes : MutableList? = null
20 | var questions: MutableMap? = null
21 | var index = 1
22 |
23 | override fun onCreate(savedInstanceState: Bundle?) {
24 | super.onCreate(savedInstanceState)
25 | setContentView(R.layout.activity_question)
26 | setUpFirestore()
27 | setUpEventListener()
28 | }
29 |
30 | private fun setUpEventListener() {
31 | btnPrevious.setOnClickListener {
32 | index--
33 | bindViews()
34 | }
35 |
36 | btnNext.setOnClickListener {
37 | index++
38 | bindViews()
39 | }
40 |
41 | btnSubmit.setOnClickListener {
42 | Log.d("FINALQUIZ", questions.toString())
43 |
44 | val intent = Intent(this, ResultActivity::class.java)
45 | val json = Gson().toJson(quizzes!![0])
46 | intent.putExtra("QUIZ", json)
47 | startActivity(intent)
48 | }
49 | }
50 |
51 | private fun setUpFirestore() {
52 | val firestore = FirebaseFirestore.getInstance()
53 | var date = intent.getStringExtra("DATE")
54 | if (date != null) {
55 | firestore.collection("quizzes").whereEqualTo("title", date)
56 | .get()
57 | .addOnSuccessListener {
58 | if(it != null && !it.isEmpty){
59 | quizzes = it.toObjects(Quiz::class.java)
60 | questions = quizzes!![0].questions
61 | bindViews()
62 | }
63 | }
64 | }
65 | }
66 |
67 | private fun bindViews() {
68 | btnPrevious.visibility = View.GONE
69 | btnSubmit.visibility = View.GONE
70 | btnNext.visibility = View.GONE
71 |
72 | if(index == 1){ //first question
73 | btnNext.visibility = View.VISIBLE
74 | }
75 | else if(index == questions!!.size) { // last question
76 | btnSubmit.visibility = View.VISIBLE
77 | btnPrevious.visibility = View.VISIBLE
78 | }
79 | else{ // Middle
80 | btnPrevious.visibility = View.VISIBLE
81 | btnNext.visibility = View.VISIBLE
82 | }
83 |
84 | val question = questions!!["question$index"]
85 | question?.let {
86 | description.text = it.description
87 | val optionAdapter = OptionAdapter(this, it)
88 | optionList.layoutManager = LinearLayoutManager(this)
89 | optionList.adapter = optionAdapter
90 | optionList.setHasFixedSize(true)
91 | }
92 | }
93 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/cheezycode/quizzed/activities/ResultActivity.kt:
--------------------------------------------------------------------------------
1 | package com.cheezycode.quizzed.activities
2 |
3 | import android.os.Build
4 | import androidx.appcompat.app.AppCompatActivity
5 | import android.os.Bundle
6 | import android.text.Html
7 | import com.cheezycode.quizzed.R
8 | import com.cheezycode.quizzed.models.Quiz
9 | import com.google.gson.Gson
10 | import kotlinx.android.synthetic.main.activity_result.*
11 |
12 | class ResultActivity : AppCompatActivity() {
13 | lateinit var quiz: Quiz
14 | override fun onCreate(savedInstanceState: Bundle?) {
15 | super.onCreate(savedInstanceState)
16 | setContentView(R.layout.activity_result)
17 | setUpViews()
18 | }
19 |
20 | private fun setUpViews() {
21 | val quizData = intent.getStringExtra("QUIZ")
22 | quiz = Gson().fromJson(quizData, Quiz::class.java)
23 | calculateScore()
24 | setAnswerView()
25 | }
26 |
27 | private fun setAnswerView() {
28 | val builder = StringBuilder("")
29 | for (entry in quiz.questions.entries) {
30 | val question = entry.value
31 | builder.append("Question: ${question.description}
")
32 | builder.append("Answer: ${question.answer}
")
33 | }
34 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
35 | txtAnswer.text = Html.fromHtml(builder.toString(), Html.FROM_HTML_MODE_COMPACT);
36 | } else {
37 | txtAnswer.text = Html.fromHtml(builder.toString());
38 | }
39 | }
40 |
41 | private fun calculateScore() {
42 | var score = 0
43 | for (entry in quiz.questions.entries) {
44 | val question = entry.value
45 | if (question.answer == question.userAnswer) {
46 | score += 10
47 | }
48 | }
49 | txtScore.text = "Your Score : $score"
50 | }
51 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/cheezycode/quizzed/activities/SignupActivity.kt:
--------------------------------------------------------------------------------
1 | package com.cheezycode.quizzed.activities
2 |
3 | import android.content.Intent
4 | import androidx.appcompat.app.AppCompatActivity
5 | import android.os.Bundle
6 | import android.widget.Toast
7 | import com.cheezycode.quizzed.R
8 | import com.google.firebase.auth.FirebaseAuth
9 | import kotlinx.android.synthetic.main.activity_signup.*
10 | import kotlinx.android.synthetic.main.activity_signup.btnSignUp
11 | import kotlinx.android.synthetic.main.activity_signup.etEmailAddress
12 | import kotlinx.android.synthetic.main.activity_signup.etPassword
13 |
14 | class SignupActivity : AppCompatActivity() {
15 |
16 | lateinit var firebaseAuth: FirebaseAuth
17 |
18 | override fun onCreate(savedInstanceState: Bundle?) {
19 | super.onCreate(savedInstanceState)
20 | setContentView(R.layout.activity_signup)
21 | firebaseAuth = FirebaseAuth.getInstance()
22 |
23 | btnSignUp.setOnClickListener {
24 | signUpUser()
25 | }
26 |
27 | btnLogin.setOnClickListener {
28 | val intent = Intent(this, LoginActivity::class.java)
29 | startActivity(intent)
30 | finish()
31 | }
32 | }
33 |
34 | private fun signUpUser(){
35 | val email = etEmailAddress.text.toString()
36 | val password = etPassword.text.toString()
37 | val confirmPassword = etConfirmPassword.text.toString()
38 |
39 | if (email.isBlank() || password.isBlank() || confirmPassword.isBlank()) {
40 | Toast.makeText(this, "Email and Password can't be blank", Toast.LENGTH_SHORT).show()
41 | return
42 | }
43 |
44 | if (password != confirmPassword) {
45 | Toast.makeText(this, "Password and Confirm Password do not match", Toast.LENGTH_SHORT)
46 | .show()
47 | return
48 | }
49 |
50 | firebaseAuth.createUserWithEmailAndPassword(email, password)
51 | .addOnCompleteListener(this) {
52 | if(it.isSuccessful){
53 | Toast.makeText(this,"Login Successful", Toast.LENGTH_SHORT).show()
54 | val intent = Intent(this, MainActivity::class.java)
55 | startActivity(intent)
56 | finish()
57 | }
58 | else{
59 | Toast.makeText(this, "Error creating user.", Toast.LENGTH_SHORT).show()
60 | }
61 | }
62 | }
63 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/cheezycode/quizzed/adapters/OptionAdapter.kt:
--------------------------------------------------------------------------------
1 | package com.cheezycode.quizzed.adapters
2 |
3 | import android.content.Context
4 | import android.view.LayoutInflater
5 | import android.view.View
6 | import android.view.ViewGroup
7 | import android.widget.TextView
8 | import android.widget.Toast
9 | import androidx.recyclerview.widget.RecyclerView
10 | import com.cheezycode.quizzed.R
11 | import com.cheezycode.quizzed.models.Question
12 |
13 | class OptionAdapter(val context: Context, val question: Question) :
14 | RecyclerView.Adapter() {
15 |
16 | private var options: List = listOf(question.option1, question.option2, question.option3, question.option4)
17 |
18 | inner class OptionViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView){
19 | var optionView = itemView.findViewById(R.id.quiz_option)
20 | }
21 |
22 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): OptionViewHolder {
23 | val view = LayoutInflater.from(context).inflate(R.layout.option_item, parent, false)
24 | return OptionViewHolder(view)
25 | }
26 |
27 | override fun onBindViewHolder(holder: OptionViewHolder, position: Int) {
28 | holder.optionView.text = options[position]
29 | holder.itemView.setOnClickListener {
30 | question.userAnswer = options[position]
31 | notifyDataSetChanged()
32 | }
33 | if(question.userAnswer == options[position]){
34 | holder.itemView.setBackgroundResource(R.drawable.option_item_selected_bg)
35 | }
36 | else{
37 | holder.itemView.setBackgroundResource(R.drawable.option_item_bg)
38 | }
39 |
40 | }
41 |
42 | override fun getItemCount(): Int {
43 | return options.size
44 | }
45 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/cheezycode/quizzed/adapters/QuizAdapter.kt:
--------------------------------------------------------------------------------
1 | package com.cheezycode.quizzed.adapters
2 |
3 | import android.content.Context
4 | import android.content.Intent
5 | import android.graphics.Color
6 | import android.text.Layout
7 | import android.view.LayoutInflater
8 | import android.view.View
9 | import android.view.ViewGroup
10 | import android.widget.ImageView
11 | import android.widget.TextView
12 | import android.widget.Toast
13 | import androidx.cardview.widget.CardView
14 | import androidx.recyclerview.widget.RecyclerView
15 | import com.cheezycode.quizzed.R
16 | import com.cheezycode.quizzed.activities.QuestionActivity
17 | import com.cheezycode.quizzed.models.Quiz
18 | import com.cheezycode.quizzed.utils.ColorPicker
19 | import com.cheezycode.quizzed.utils.IconPicker
20 |
21 | class QuizAdapter(val context: Context, val quizzes: List) :
22 | RecyclerView.Adapter() {
23 |
24 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): QuizViewHolder {
25 | val view = LayoutInflater.from(context).inflate(R.layout.quiz_item, parent, false)
26 | return QuizViewHolder(view)
27 | }
28 |
29 | override fun onBindViewHolder(holder: QuizViewHolder, position: Int) {
30 | holder.textViewTitle.text = quizzes[position].title
31 | holder.cardContainer.setCardBackgroundColor(Color.parseColor(ColorPicker.getColor()))
32 | holder.iconView.setImageResource(IconPicker.getIcon())
33 | holder.itemView.setOnClickListener {
34 | Toast.makeText(context, quizzes[position].title, Toast.LENGTH_SHORT).show()
35 | val intent = Intent(context, QuestionActivity::class.java)
36 | intent.putExtra("DATE", quizzes[position].title)
37 | context.startActivity(intent)
38 | }
39 | }
40 |
41 | override fun getItemCount(): Int {
42 | return quizzes.size
43 | }
44 |
45 | inner class QuizViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
46 | var textViewTitle: TextView = itemView.findViewById(R.id.quizTitle)
47 | var iconView: ImageView = itemView.findViewById(R.id.quizIcon)
48 | var cardContainer: CardView = itemView.findViewById(R.id.cardContainer)
49 | }
50 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/cheezycode/quizzed/models/Question.kt:
--------------------------------------------------------------------------------
1 | package com.cheezycode.quizzed.models
2 |
3 | data class Question(
4 | var description: String = "",
5 | var option1: String = "",
6 | var option2: String = "",
7 | var option3: String = "",
8 | var option4: String = "",
9 | var answer: String = "",
10 | var userAnswer: String = ""
11 | )
--------------------------------------------------------------------------------
/app/src/main/java/com/cheezycode/quizzed/models/Quiz.kt:
--------------------------------------------------------------------------------
1 | package com.cheezycode.quizzed.models
2 |
3 | data class Quiz (
4 | var id : String = "",
5 | var title: String = "",
6 | var questions: MutableMap = mutableMapOf()
7 | )
--------------------------------------------------------------------------------
/app/src/main/java/com/cheezycode/quizzed/utils/ColorPicker.kt:
--------------------------------------------------------------------------------
1 | package com.cheezycode.quizzed.utils
2 |
3 | object ColorPicker {
4 | val colors = arrayOf(
5 | "#3EB9DF",
6 | "#3685BC",
7 | "#D36280",
8 | "#E44F55",
9 | "#FA8056",
10 | "#818BCA",
11 | "#7D659F",
12 | "#51BAB3",
13 | "#4FB66C",
14 | "#E3AD17",
15 | "#627991",
16 | "#EF8EAD",
17 | "#B5BFC6"
18 | )
19 | var currentColorIndex = 0
20 |
21 | fun getColor(): String {
22 | currentColorIndex = (currentColorIndex + 1) % colors.size
23 | return colors[currentColorIndex]
24 | }
25 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/cheezycode/quizzed/utils/IconPicker.kt:
--------------------------------------------------------------------------------
1 | package com.cheezycode.quizzed.utils
2 |
3 | import com.cheezycode.quizzed.R
4 |
5 | object IconPicker {
6 | val icons = arrayOf(
7 | R.drawable.ic_icon_1,
8 | R.drawable.ic_icon_2,
9 | R.drawable.ic_icon_3,
10 | R.drawable.ic_icon_4,
11 | R.drawable.ic_icon_5,
12 | R.drawable.ic_icon_6,
13 | R.drawable.ic_icon_7,
14 | R.drawable.ic_icon_8
15 | )
16 | var currentIcon = 0
17 |
18 | fun getIcon(): Int {
19 | currentIcon = (currentIcon + 1) % icons.size
20 | return icons[currentIcon]
21 | }
22 | }
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
15 |
18 |
21 |
22 |
23 |
24 |
30 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/btn_primary.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/edit_text_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_date.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_hamburger.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CheezyCode/Quizzed/cef1d1beccffd038e598f24656479228cf102830/app/src/main/res/drawable/ic_icon.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_icon_1.xml:
--------------------------------------------------------------------------------
1 |
6 |
13 |
20 |
27 |
34 |
41 |
48 |
55 |
62 |
69 |
76 |
83 |
90 |
97 |
104 |
111 |
118 |
121 |
124 |
131 |
138 |
139 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_icon_2.xml:
--------------------------------------------------------------------------------
1 |
6 |
13 |
20 |
27 |
34 |
41 |
48 |
55 |
62 |
69 |
76 |
83 |
90 |
95 |
100 |
105 |
110 |
111 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_icon_3.xml:
--------------------------------------------------------------------------------
1 |
6 |
13 |
20 |
27 |
34 |
41 |
48 |
55 |
62 |
69 |
76 |
83 |
90 |
97 |
104 |
111 |
118 |
125 |
132 |
133 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_icon_4.xml:
--------------------------------------------------------------------------------
1 |
6 |
13 |
20 |
27 |
34 |
41 |
48 |
55 |
62 |
69 |
76 |
83 |
90 |
97 |
104 |
111 |
118 |
119 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_icon_5.xml:
--------------------------------------------------------------------------------
1 |
6 |
13 |
20 |
27 |
34 |
41 |
48 |
55 |
62 |
69 |
76 |
83 |
90 |
97 |
104 |
111 |
118 |
125 |
132 |
139 |
146 |
153 |
160 |
167 |
168 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_icon_6.xml:
--------------------------------------------------------------------------------
1 |
6 |
13 |
20 |
27 |
34 |
41 |
48 |
55 |
62 |
69 |
76 |
77 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_icon_7.xml:
--------------------------------------------------------------------------------
1 |
6 |
13 |
20 |
27 |
34 |
41 |
48 |
55 |
62 |
69 |
76 |
83 |
90 |
97 |
104 |
111 |
118 |
125 |
132 |
139 |
146 |
153 |
160 |
167 |
174 |
175 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_icon_8.xml:
--------------------------------------------------------------------------------
1 |
6 |
13 |
20 |
27 |
34 |
41 |
48 |
55 |
62 |
69 |
76 |
79 |
80 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_icon_trophy.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
12 |
15 |
18 |
21 |
24 |
27 |
30 |
33 |
36 |
39 |
42 |
45 |
48 |
49 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
171 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_quiz_login_hero_image.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
12 |
15 |
18 |
21 |
24 |
27 |
30 |
33 |
36 |
39 |
42 |
45 |
48 |
51 |
54 |
57 |
60 |
63 |
66 |
71 |
74 |
77 |
80 |
83 |
86 |
89 |
92 |
95 |
98 |
101 |
104 |
107 |
110 |
113 |
116 |
119 |
122 |
125 |
128 |
131 |
134 |
137 |
140 |
143 |
146 |
149 |
152 |
155 |
156 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_wave.xml:
--------------------------------------------------------------------------------
1 |
6 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/option_item_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
9 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/option_item_selected_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_login.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
20 |
21 |
27 |
28 |
35 |
36 |
46 |
47 |
57 |
58 |
66 |
67 |
75 |
76 |
77 |
86 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_login_intro.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
20 |
21 |
31 |
32 |
42 |
43 |
54 |
55 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
13 |
14 |
21 |
22 |
29 |
30 |
31 |
32 |
40 |
41 |
49 |
50 |
51 |
52 |
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_profile.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
18 |
19 |
24 |
25 |
33 |
34 |
35 |
36 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_question.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
20 |
21 |
32 |
33 |
39 |
40 |
51 |
52 |
58 |
59 |
68 |
69 |
79 |
80 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_result.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
12 |
13 |
23 |
24 |
30 |
31 |
40 |
41 |
42 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_signup.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
20 |
21 |
27 |
28 |
36 |
37 |
47 |
48 |
58 |
59 |
69 |
70 |
80 |
81 |
89 |
90 |
91 |
92 |
93 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/drawer_header.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
15 |
16 |
23 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/option_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
15 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/quiz_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
17 |
18 |
24 |
25 |
33 |
34 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/drawer_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CheezyCode/Quizzed/cef1d1beccffd038e598f24656479228cf102830/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CheezyCode/Quizzed/cef1d1beccffd038e598f24656479228cf102830/app/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CheezyCode/Quizzed/cef1d1beccffd038e598f24656479228cf102830/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CheezyCode/Quizzed/cef1d1beccffd038e598f24656479228cf102830/app/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CheezyCode/Quizzed/cef1d1beccffd038e598f24656479228cf102830/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CheezyCode/Quizzed/cef1d1beccffd038e598f24656479228cf102830/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CheezyCode/Quizzed/cef1d1beccffd038e598f24656479228cf102830/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CheezyCode/Quizzed/cef1d1beccffd038e598f24656479228cf102830/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CheezyCode/Quizzed/cef1d1beccffd038e598f24656479228cf102830/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CheezyCode/Quizzed/cef1d1beccffd038e598f24656479228cf102830/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #18206F
4 | #11164E
5 | #E91E63
6 | #18206F
7 | #18206F
8 | #FFFFFF
9 | #f2f5fa
10 | #E9EBEF
11 | #18206F
12 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Quizzed
3 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
16 |
17 |
--------------------------------------------------------------------------------
/app/src/test/java/com/cheezycode/quizzed/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package com.cheezycode.quizzed
2 |
3 | import org.junit.Test
4 |
5 | import org.junit.Assert.*
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * See [testing documentation](http://d.android.com/tools/testing).
11 | */
12 | class ExampleUnitTest {
13 | @Test
14 | fun addition_isCorrect() {
15 | assertEquals(4, 2 + 2)
16 | }
17 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | // Top-level build file where you can add configuration options common to all sub-projects/modules.
2 | buildscript {
3 | ext.kotlin_version = "1.3.72"
4 | repositories {
5 | google()
6 | jcenter()
7 | }
8 | dependencies {
9 | classpath "com.android.tools.build:gradle:4.0.1"
10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11 | classpath 'com.google.gms:google-services:4.3.4'
12 |
13 | // NOTE: Do not place your application dependencies here; they belong
14 | // in the individual module build.gradle files
15 | }
16 | }
17 |
18 | allprojects {
19 | repositories {
20 | google()
21 | jcenter()
22 | }
23 | }
24 |
25 | task clean(type: Delete) {
26 | delete rootProject.buildDir
27 | }
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx2048m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app"s APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
18 | # Automatically convert third-party libraries to use AndroidX
19 | android.enableJetifier=true
20 | # Kotlin code style for this project: "official" or "obsolete":
21 | kotlin.code.style=official
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CheezyCode/Quizzed/cef1d1beccffd038e598f24656479228cf102830/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Sat Oct 31 22:26:16 IST 2020
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn () {
37 | echo "$*"
38 | }
39 |
40 | die () {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Escape application args
158 | save () {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 | rootProject.name = "Quizzed"
--------------------------------------------------------------------------------