├── .idea ├── .name ├── .gitignore ├── compiler.xml ├── vcs.xml ├── deploymentTargetDropDown.xml ├── gradle.xml └── misc.xml ├── app ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── raw │ │ │ │ ├── w.mp3 │ │ │ │ └── right.wav │ │ │ ├── values │ │ │ │ ├── dimens.xml │ │ │ │ ├── colors.xml │ │ │ │ ├── strings.xml │ │ │ │ └── themes.xml │ │ │ ├── values-land │ │ │ │ └── dimens.xml │ │ │ ├── drawable │ │ │ │ ├── bg.png │ │ │ │ ├── t.png │ │ │ │ ├── anime.png │ │ │ │ ├── art.png │ │ │ │ ├── brain.png │ │ │ │ ├── film.png │ │ │ │ ├── quiz.png │ │ │ │ ├── cricket.png │ │ │ │ ├── history.png │ │ │ │ ├── science.png │ │ │ │ ├── spotify.png │ │ │ │ ├── trophy.png │ │ │ │ ├── australia.png │ │ │ │ ├── book_stack.png │ │ │ │ ├── ic_trophy.png │ │ │ │ ├── login_bg.png │ │ │ │ ├── mythology.png │ │ │ │ ├── politics.png │ │ │ │ ├── topic_display.jpg │ │ │ │ ├── questions_display.jpg │ │ │ │ ├── bg2.xml │ │ │ │ ├── bg3.xml │ │ │ │ ├── bg4.xml │ │ │ │ ├── bg1.xml │ │ │ │ ├── indicator_selector.xml │ │ │ │ ├── wrong_option_clicked_bg.xml │ │ │ │ ├── correct_option_clicked_bg.xml │ │ │ │ ├── question_options_bg.xml │ │ │ │ ├── selected.xml │ │ │ │ ├── selected_option_clicked_bg.xml │ │ │ │ ├── unselected.xml │ │ │ │ └── ic_launcher_background.xml │ │ │ ├── values-w1240dp │ │ │ │ └── dimens.xml │ │ │ ├── values-w600dp │ │ │ │ └── dimens.xml │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.webp │ │ │ │ └── ic_launcher_round.webp │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.webp │ │ │ │ └── ic_launcher_round.webp │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── ic_launcher.webp │ │ │ │ └── ic_launcher_round.webp │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── ic_launcher.webp │ │ │ │ └── ic_launcher_round.webp │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.webp │ │ │ │ └── ic_launcher_round.webp │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ ├── ic_launcher.xml │ │ │ │ └── ic_launcher_round.xml │ │ │ ├── drawable-v24 │ │ │ │ ├── other_options_not_clicked.xml │ │ │ │ └── ic_launcher_foreground.xml │ │ │ ├── xml │ │ │ │ ├── backup_rules.xml │ │ │ │ └── data_extraction_rules.xml │ │ │ ├── values-night │ │ │ │ └── themes.xml │ │ │ ├── layout │ │ │ │ ├── activity_quiz_categories.xml │ │ │ │ ├── activity_splash_screen.xml │ │ │ │ ├── content_questions.xml │ │ │ │ ├── fragment_second.xml │ │ │ │ ├── fragment_first.xml │ │ │ │ ├── activity_questions.xml │ │ │ │ ├── onboarding_screen_layout.xml │ │ │ │ ├── each_category_view.xml │ │ │ │ ├── activity_on_boarding_screen.xml │ │ │ │ ├── activity_result.xml │ │ │ │ ├── activity_main.xml │ │ │ │ ├── activity_questions2.xml │ │ │ │ └── category_dialog.xml │ │ │ └── navigation │ │ │ │ └── nav_graph.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── pratyakshkhurana │ │ │ │ └── quizapp │ │ │ │ ├── OnBoardIngItems.kt │ │ │ │ ├── Questions.kt │ │ │ │ ├── CategoryView.kt │ │ │ │ ├── ResultActivity.kt │ │ │ │ ├── Splash_Screen.kt │ │ │ │ ├── MainActivity.kt │ │ │ │ ├── AdapterViewPager.kt │ │ │ │ ├── CategoriesAdapter.kt │ │ │ │ ├── OnBoardingScreen.kt │ │ │ │ ├── GetAllQuestions.kt │ │ │ │ ├── QuizCategories.kt │ │ │ │ └── QuestionsActivity.kt │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── pratyakshkhurana │ │ │ └── quizapp │ │ │ └── ExampleUnitTest.kt │ └── androidTest │ │ └── java │ │ └── com │ │ └── pratyakshkhurana │ │ └── quizapp │ │ └── ExampleInstrumentedTest.kt ├── proguard-rules.pro └── build.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── settings.gradle ├── gradle.properties ├── gradlew.bat ├── README.md └── gradlew /.idea/.name: -------------------------------------------------------------------------------- 1 | QuizApp -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | -------------------------------------------------------------------------------- /app/src/main/res/raw/w.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pratyaksh1610/Quiz_App/HEAD/app/src/main/res/raw/w.mp3 -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 16dp 3 | -------------------------------------------------------------------------------- /app/src/main/res/raw/right.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pratyaksh1610/Quiz_App/HEAD/app/src/main/res/raw/right.wav -------------------------------------------------------------------------------- /app/src/main/res/values-land/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 48dp 3 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pratyaksh1610/Quiz_App/HEAD/app/src/main/res/drawable/bg.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/t.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pratyaksh1610/Quiz_App/HEAD/app/src/main/res/drawable/t.png -------------------------------------------------------------------------------- /app/src/main/res/values-w1240dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 200dp 3 | -------------------------------------------------------------------------------- /app/src/main/res/values-w600dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 48dp 3 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/anime.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pratyaksh1610/Quiz_App/HEAD/app/src/main/res/drawable/anime.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/art.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pratyaksh1610/Quiz_App/HEAD/app/src/main/res/drawable/art.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/brain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pratyaksh1610/Quiz_App/HEAD/app/src/main/res/drawable/brain.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/film.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pratyaksh1610/Quiz_App/HEAD/app/src/main/res/drawable/film.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/quiz.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pratyaksh1610/Quiz_App/HEAD/app/src/main/res/drawable/quiz.png -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pratyaksh1610/Quiz_App/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/res/drawable/cricket.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pratyaksh1610/Quiz_App/HEAD/app/src/main/res/drawable/cricket.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/history.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pratyaksh1610/Quiz_App/HEAD/app/src/main/res/drawable/history.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/science.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pratyaksh1610/Quiz_App/HEAD/app/src/main/res/drawable/science.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/spotify.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pratyaksh1610/Quiz_App/HEAD/app/src/main/res/drawable/spotify.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/trophy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pratyaksh1610/Quiz_App/HEAD/app/src/main/res/drawable/trophy.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/australia.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pratyaksh1610/Quiz_App/HEAD/app/src/main/res/drawable/australia.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/book_stack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pratyaksh1610/Quiz_App/HEAD/app/src/main/res/drawable/book_stack.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_trophy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pratyaksh1610/Quiz_App/HEAD/app/src/main/res/drawable/ic_trophy.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/login_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pratyaksh1610/Quiz_App/HEAD/app/src/main/res/drawable/login_bg.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/mythology.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pratyaksh1610/Quiz_App/HEAD/app/src/main/res/drawable/mythology.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/politics.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pratyaksh1610/Quiz_App/HEAD/app/src/main/res/drawable/politics.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/topic_display.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pratyaksh1610/Quiz_App/HEAD/app/src/main/res/drawable/topic_display.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pratyaksh1610/Quiz_App/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pratyaksh1610/Quiz_App/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/drawable/questions_display.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pratyaksh1610/Quiz_App/HEAD/app/src/main/res/drawable/questions_display.jpg -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pratyaksh1610/Quiz_App/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pratyaksh1610/Quiz_App/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pratyaksh1610/Quiz_App/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pratyaksh1610/Quiz_App/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pratyaksh1610/Quiz_App/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pratyaksh1610/Quiz_App/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pratyaksh1610/Quiz_App/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pratyaksh1610/Quiz_App/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/bg2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/bg3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/bg4.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/bg1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/java/com/pratyakshkhurana/quizapp/OnBoardIngItems.kt: -------------------------------------------------------------------------------- 1 | package com.pratyakshkhurana.quizapp 2 | 3 | import android.widget.ImageView 4 | import android.widget.TextView 5 | 6 | data class OnBoardIngItems( 7 | var Image:Int, 8 | var text:String 9 | ) 10 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Thu Aug 04 20:59:23 IST 2022 2 | distributionBase=GRADLE_USER_HOME 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip 4 | distributionPath=wrapper/dists 5 | zipStorePath=wrapper/dists 6 | zipStoreBase=GRADLE_USER_HOME 7 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/indicator_selector.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /.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 | local.properties 16 | .idea/gradle.xml 17 | .idea/misc.xml 18 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/other_options_not_clicked.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/wrong_option_clicked_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/correct_option_clicked_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | gradlePluginPortal() 4 | google() 5 | mavenCentral() 6 | } 7 | } 8 | dependencyResolutionManagement { 9 | repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) 10 | repositories { 11 | google() 12 | mavenCentral() 13 | } 14 | } 15 | rootProject.name = "QuizApp" 16 | include ':app' 17 | -------------------------------------------------------------------------------- /app/src/main/java/com/pratyakshkhurana/quizapp/Questions.kt: -------------------------------------------------------------------------------- 1 | package com.pratyakshkhurana.quizapp 2 | 3 | 4 | //model of question, basically a class of data we defined, user defined type 5 | data class Questions( 6 | val id:Int, 7 | val question: String, 8 | val option1:String, 9 | val option2:String, 10 | val option3:String, 11 | val option4:String, 12 | val correct:Int 13 | ) 14 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/question_options_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/selected.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFBB86FC 4 | #FF6200EE 5 | #FF3700B3 6 | #FF03DAC5 7 | #FF018786 8 | #FF000000 9 | #FFFFFFFF 10 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/selected_option_clicked_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/unselected.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/test/java/com/pratyakshkhurana/quizapp/ExampleUnitTest.kt: -------------------------------------------------------------------------------- 1 | package com.pratyakshkhurana.quizapp 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 | } -------------------------------------------------------------------------------- /app/src/main/java/com/pratyakshkhurana/quizapp/CategoryView.kt: -------------------------------------------------------------------------------- 1 | package com.pratyakshkhurana.quizapp 2 | 3 | import android.graphics.Bitmap 4 | import android.graphics.drawable.Drawable 5 | import android.media.Image 6 | import android.widget.ImageView 7 | import androidx.cardview.widget.CardView 8 | 9 | //second screen of recycler view 10 | data class CategoryView( 11 | val image: Int, 12 | val category: String, 13 | val cardImage: Drawable, 14 | val icon: Drawable 15 | ) 16 | -------------------------------------------------------------------------------- /app/src/main/res/xml/backup_rules.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 13 | -------------------------------------------------------------------------------- /.idea/deploymentTargetDropDown.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /app/src/main/res/xml/data_extraction_rules.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 12 | 13 | 19 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 18 | 19 | -------------------------------------------------------------------------------- /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/pratyakshkhurana/quizapp/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package com.pratyakshkhurana.quizapp 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.pratyakshkhurana.quizapp", appContext.packageName) 23 | } 24 | } -------------------------------------------------------------------------------- /app/src/main/res/values-night/themes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_quiz_categories.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 11 | 19 | 20 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_splash_screen.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/res/layout/content_questions.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 20 | -------------------------------------------------------------------------------- /app/src/main/java/com/pratyakshkhurana/quizapp/ResultActivity.kt: -------------------------------------------------------------------------------- 1 | package com.pratyakshkhurana.quizapp 2 | 3 | import android.annotation.SuppressLint 4 | import android.content.Intent 5 | import android.os.Bundle 6 | import androidx.appcompat.app.AppCompatActivity 7 | import kotlinx.android.synthetic.main.activity_result.* 8 | 9 | 10 | class ResultActivity : AppCompatActivity() { 11 | @SuppressLint("SetTextI18n") 12 | override fun onCreate(savedInstanceState: Bundle?) { 13 | super.onCreate(savedInstanceState) 14 | setContentView(R.layout.activity_result) 15 | 16 | name.text = intent.getStringExtra("user") 17 | val correct = intent.getIntExtra("correct", 0) 18 | totalScore.text = "You scored $correct out of 10" 19 | 20 | btnFinish.setOnClickListener { 21 | val intent = Intent(this, MainActivity::class.java) 22 | startActivity(intent) 23 | } 24 | } 25 | override fun onBackPressed() { 26 | super.onBackPressed() 27 | finish() 28 | } 29 | } -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | QuizApp 3 | QuestionsActivity 4 | 5 | First Fragment 6 | Second Fragment 7 | Next 8 | Previous 9 | 10 | Hello first fragment 11 | Hello second fragment. Arg: %1$s 12 | Quiz App 13 | Welcome 14 | Please enter your name. 15 | The Quiz will contain 10 random questions. 16 | Every correct answer scores you 1 point. 17 | Every wrong answer deducts 1 point. 18 | Results are available at the end of the quiz. 19 | -------------------------------------------------------------------------------- /app/src/main/res/navigation/nav_graph.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 13 | 14 | 17 | 18 | 23 | 24 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/java/com/pratyakshkhurana/quizapp/Splash_Screen.kt: -------------------------------------------------------------------------------- 1 | package com.pratyakshkhurana.quizapp 2 | 3 | import android.content.Context 4 | import android.content.Intent 5 | import android.content.SharedPreferences 6 | import androidx.appcompat.app.AppCompatActivity 7 | import android.os.Bundle 8 | import android.os.Handler 9 | 10 | class Splash_Screen : AppCompatActivity() { 11 | var sharedPreferences: SharedPreferences?=null 12 | override fun onCreate(savedInstanceState: Bundle?) { 13 | super.onCreate(savedInstanceState) 14 | setContentView(R.layout.activity_splash_screen) 15 | sharedPreferences=applicationContext.getSharedPreferences("pref", Context.MODE_PRIVATE) 16 | Handler().postDelayed( 17 | { 18 | if(sharedPreferences!!.getBoolean("isFirstTimeRun",false)) 19 | { 20 | startActivity(Intent(applicationContext,MainActivity::class.java)) 21 | finish() 22 | } 23 | else 24 | { 25 | startActivity(Intent(applicationContext,OnBoardingScreen::class.java)) 26 | finish() 27 | } 28 | },1000 29 | ) 30 | 31 | } 32 | } -------------------------------------------------------------------------------- /app/src/main/java/com/pratyakshkhurana/quizapp/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.pratyakshkhurana.quizapp 2 | 3 | import android.content.Intent 4 | import android.os.Bundle 5 | import android.widget.Toast 6 | import androidx.appcompat.app.AppCompatActivity 7 | import kotlinx.android.synthetic.main.activity_main.* 8 | 9 | class MainActivity : AppCompatActivity() { 10 | override fun onCreate(savedInstanceState: Bundle?) { 11 | super.onCreate(savedInstanceState) 12 | setContentView(R.layout.activity_main) 13 | 14 | buttonStart.setOnClickListener { 15 | if (enterNameEditText.text.toString().isEmpty()) { 16 | Toast.makeText(this, "Please enter your name !", Toast.LENGTH_SHORT).show() 17 | } else { 18 | val intent = Intent(this, QuizCategories::class.java) 19 | //start intent by passing intent 20 | //passing data to next activity 21 | //passed key value pair for recognition 22 | intent.putExtra("user", enterNameEditText.text.toString()) 23 | startActivity(intent) 24 | } 25 | } 26 | } 27 | 28 | override fun onBackPressed() { 29 | moveTaskToBack(true); 30 | } 31 | 32 | } 33 | 34 | -------------------------------------------------------------------------------- /app/src/main/java/com/pratyakshkhurana/quizapp/AdapterViewPager.kt: -------------------------------------------------------------------------------- 1 | package com.pratyakshkhurana.quizapp 2 | 3 | import android.content.Context 4 | import android.text.Layout 5 | import android.view.LayoutInflater 6 | import android.view.View 7 | import android.view.ViewGroup 8 | import android.widget.ImageView 9 | import android.widget.TextView 10 | import androidx.viewpager.widget.PagerAdapter 11 | import androidx.viewpager2.widget.ViewPager2 12 | import org.w3c.dom.Text 13 | 14 | class AdapterViewPager(var context:Context,var item:ArrayList): PagerAdapter() { 15 | override fun getCount(): Int { 16 | return item.size 17 | } 18 | 19 | override fun isViewFromObject(view: View, `object`: Any): Boolean { 20 | return view==`object` 21 | } 22 | 23 | override fun instantiateItem(container: ViewGroup, position: Int): Any { 24 | var view:View=LayoutInflater.from(context).inflate(R.layout.onboarding_screen_layout,null); 25 | var image=view.findViewById(R.id.imageView) 26 | var text = view.findViewById(R.id.textView) 27 | 28 | 29 | image.setImageResource(item[position].Image) 30 | text.text=item[position].text 31 | container.addView(view) 32 | return view 33 | } 34 | } -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_second.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 19 | 20 |