├── app
├── .gitignore
├── src
│ ├── main
│ │ ├── res
│ │ │ ├── drawable
│ │ │ │ ├── bad.png
│ │ │ │ ├── b_play.webp
│ │ │ │ ├── normal.png
│ │ │ │ ├── wrong.webp
│ │ │ │ ├── btn_check.webp
│ │ │ │ ├── btn_next.webp
│ │ │ │ ├── correct.webp
│ │ │ │ ├── firework.webp
│ │ │ │ ├── question.webp
│ │ │ │ ├── right_box.webp
│ │ │ │ ├── wrong_box.webp
│ │ │ │ ├── btn_replay.webp
│ │ │ │ ├── screen_landing.webp
│ │ │ │ ├── screen_quest.webp
│ │ │ │ ├── screen_result.webp
│ │ │ │ ├── screen_do_quest.webp
│ │ │ │ ├── screen_wrong_answer.webp
│ │ │ │ ├── screen_correct_answer.webp
│ │ │ │ └── ic_launcher_background.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
│ │ │ ├── values
│ │ │ │ ├── preloaded_fonts.xml
│ │ │ │ ├── colors.xml
│ │ │ │ ├── themes.xml
│ │ │ │ ├── styles.xml
│ │ │ │ ├── strings.xml
│ │ │ │ └── font_certs.xml
│ │ │ ├── mipmap-anydpi-v26
│ │ │ │ ├── ic_launcher.xml
│ │ │ │ └── ic_launcher_round.xml
│ │ │ ├── font
│ │ │ │ └── ribeye.xml
│ │ │ ├── layout
│ │ │ │ ├── activity_main.xml
│ │ │ │ ├── fragment_start.xml
│ │ │ │ ├── fragment_result.xml
│ │ │ │ ├── fragment_questions.xml
│ │ │ │ ├── question_1.xml
│ │ │ │ ├── fragment_question2.xml
│ │ │ │ ├── fragment_question3.xml
│ │ │ │ ├── fragment_question5.xml
│ │ │ │ ├── fragment_question6.xml
│ │ │ │ ├── fragment_question7.xml
│ │ │ │ ├── fragment_question8.xml
│ │ │ │ ├── fragment_question9.xml
│ │ │ │ ├── fragment_question10.xml
│ │ │ │ └── fragment_question4.xml
│ │ │ ├── values-night
│ │ │ │ └── themes.xml
│ │ │ └── drawable-v24
│ │ │ │ └── ic_launcher_foreground.xml
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── example
│ │ │ │ └── appforresume
│ │ │ │ ├── DataModel.kt
│ │ │ │ ├── MainActivity.kt
│ │ │ │ ├── StartFragment.kt
│ │ │ │ ├── ResultFragment.kt
│ │ │ │ ├── questions
│ │ │ │ ├── Question4.kt
│ │ │ │ ├── Question5.kt
│ │ │ │ ├── Question6.kt
│ │ │ │ ├── Question7.kt
│ │ │ │ ├── Question8.kt
│ │ │ │ ├── Question9.kt
│ │ │ │ ├── Question10.kt
│ │ │ │ ├── Question2.kt
│ │ │ │ ├── Question3.kt
│ │ │ │ └── Question1.kt
│ │ │ │ └── QuestionsFragment.kt
│ │ └── AndroidManifest.xml
│ ├── test
│ │ └── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── appforresume
│ │ │ └── ExampleUnitTest.kt
│ └── androidTest
│ │ └── java
│ │ └── com
│ │ └── example
│ │ └── appforresume
│ │ └── ExampleInstrumentedTest.kt
├── proguard-rules.pro
└── build.gradle
├── .idea
├── .gitignore
├── compiler.xml
├── vcs.xml
├── gradle.xml
└── misc.xml
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── .gitignore
├── settings.gradle
├── gradle.properties
├── README.md
├── gradlew.bat
└── gradlew
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bad.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Landfathich/mathQuizForKids/HEAD/app/src/main/res/drawable/bad.png
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Landfathich/mathQuizForKids/HEAD/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/app/src/main/res/drawable/b_play.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Landfathich/mathQuizForKids/HEAD/app/src/main/res/drawable/b_play.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable/normal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Landfathich/mathQuizForKids/HEAD/app/src/main/res/drawable/normal.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable/wrong.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Landfathich/mathQuizForKids/HEAD/app/src/main/res/drawable/wrong.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable/btn_check.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Landfathich/mathQuizForKids/HEAD/app/src/main/res/drawable/btn_check.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable/btn_next.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Landfathich/mathQuizForKids/HEAD/app/src/main/res/drawable/btn_next.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable/correct.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Landfathich/mathQuizForKids/HEAD/app/src/main/res/drawable/correct.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable/firework.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Landfathich/mathQuizForKids/HEAD/app/src/main/res/drawable/firework.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable/question.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Landfathich/mathQuizForKids/HEAD/app/src/main/res/drawable/question.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable/right_box.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Landfathich/mathQuizForKids/HEAD/app/src/main/res/drawable/right_box.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable/wrong_box.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Landfathich/mathQuizForKids/HEAD/app/src/main/res/drawable/wrong_box.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable/btn_replay.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Landfathich/mathQuizForKids/HEAD/app/src/main/res/drawable/btn_replay.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable/screen_landing.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Landfathich/mathQuizForKids/HEAD/app/src/main/res/drawable/screen_landing.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable/screen_quest.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Landfathich/mathQuizForKids/HEAD/app/src/main/res/drawable/screen_quest.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable/screen_result.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Landfathich/mathQuizForKids/HEAD/app/src/main/res/drawable/screen_result.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Landfathich/mathQuizForKids/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Landfathich/mathQuizForKids/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable/screen_do_quest.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Landfathich/mathQuizForKids/HEAD/app/src/main/res/drawable/screen_do_quest.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Landfathich/mathQuizForKids/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Landfathich/mathQuizForKids/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable/screen_wrong_answer.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Landfathich/mathQuizForKids/HEAD/app/src/main/res/drawable/screen_wrong_answer.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Landfathich/mathQuizForKids/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/res/drawable/screen_correct_answer.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Landfathich/mathQuizForKids/HEAD/app/src/main/res/drawable/screen_correct_answer.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Landfathich/mathQuizForKids/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/Landfathich/mathQuizForKids/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/Landfathich/mathQuizForKids/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/Landfathich/mathQuizForKids/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/Landfathich/mathQuizForKids/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/values/preloaded_fonts.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | - @font/ribeye
5 |
6 |
7 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Thu Jan 13 13:20:50 MSK 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 |
--------------------------------------------------------------------------------
/.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 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | dependencyResolutionManagement {
2 | repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
3 | repositories {
4 | google()
5 | mavenCentral()
6 | jcenter() // Warning: this repository is going to shut down soon
7 | }
8 | }
9 | rootProject.name = "appForResume"
10 | include ':app'
11 |
--------------------------------------------------------------------------------
/app/src/main/res/font/ribeye.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
--------------------------------------------------------------------------------
/app/src/test/java/com/example/appforresume/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package com.example.appforresume
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/example/appforresume/DataModel.kt:
--------------------------------------------------------------------------------
1 | package com.example.appforresume
2 |
3 | import androidx.lifecycle.MutableLiveData
4 | import androidx.lifecycle.ViewModel
5 |
6 | open class DataModel : ViewModel() {
7 | val messageToQuestFrag1: MutableLiveData by lazy {
8 | MutableLiveData()
9 | }
10 | val turnOnClickable: MutableLiveData by lazy {
11 | MutableLiveData()
12 | }
13 | val scoreToResult: MutableLiveData by lazy {
14 | MutableLiveData()
15 | }
16 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/example/appforresume/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.example.appforresume
2 |
3 | import android.os.Bundle
4 | import androidx.appcompat.app.AppCompatActivity
5 |
6 | class MainActivity : AppCompatActivity() {
7 | override fun onCreate(savedInstanceState: Bundle?) {
8 | super.onCreate(savedInstanceState)
9 | setContentView(R.layout.activity_main)
10 | supportFragmentManager
11 | .beginTransaction()
12 | .replace(R.id.main, StartFragment.newInstance())
13 | .commit()
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FFBB86FC
4 | #FF6200EE
5 | #FF3700B3
6 | #FF03DAC5
7 | #FF018786
8 | #FF000000
9 | #FFFFFFFF
10 | #EFDECA
11 | #F8C78D
12 |
13 | #B8D86B
14 | #DFA07F
15 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
18 |
19 |
--------------------------------------------------------------------------------
/app/src/androidTest/java/com/example/appforresume/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package com.example.appforresume
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.example.appforresume", appContext.packageName)
23 | }
24 | }
--------------------------------------------------------------------------------
/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/main/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
18 |
19 |
--------------------------------------------------------------------------------
/app/src/main/res/values-night/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
16 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
13 |
14 |
21 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/appforresume/StartFragment.kt:
--------------------------------------------------------------------------------
1 | package com.example.appforresume
2 |
3 | import android.os.Bundle
4 | import android.view.LayoutInflater
5 | import android.view.View
6 | import android.view.ViewGroup
7 | import androidx.fragment.app.Fragment
8 | import com.example.appforresume.databinding.FragmentStartBinding
9 |
10 | class StartFragment : Fragment() {
11 |
12 | private lateinit var b: FragmentStartBinding
13 |
14 | override fun onCreateView(
15 | inflater: LayoutInflater, container: ViewGroup?,
16 | savedInstanceState: Bundle?,
17 | ): View {
18 | b = FragmentStartBinding.inflate(inflater)
19 | return b.root
20 | }
21 |
22 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
23 | b.bPlay.setOnClickListener {
24 | activity?.supportFragmentManager?.beginTransaction()
25 | ?.replace(R.id.main, QuestionsFragment())
26 | ?.commit()
27 | }
28 | }
29 |
30 | companion object {
31 | @JvmStatic
32 | fun newInstance() = StartFragment()
33 | }
34 | }
--------------------------------------------------------------------------------
/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 -Dfile.encoding=UTF-8
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
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.android.application'
3 | id 'kotlin-android'
4 | }
5 |
6 | android {
7 | compileSdk 31
8 |
9 | defaultConfig {
10 | applicationId "com.example.appforresume"
11 | minSdk 21
12 | targetSdk 31
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 | compileOptions {
26 | sourceCompatibility JavaVersion.VERSION_1_8
27 | targetCompatibility JavaVersion.VERSION_1_8
28 | }
29 | kotlinOptions {
30 | jvmTarget = '1.8'
31 | }
32 | buildFeatures{
33 | viewBinding = true
34 | }
35 | }
36 |
37 | dependencies {
38 |
39 | implementation 'androidx.core:core-ktx:1.7.0'
40 | implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1'
41 | implementation 'androidx.fragment:fragment-ktx:1.3.6'
42 | implementation 'androidx.appcompat:appcompat:1.4.0'
43 | implementation 'com.google.android.material:material:1.4.0'
44 | implementation 'androidx.constraintlayout:constraintlayout:2.1.2'
45 | }
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_start.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
14 |
15 |
22 |
23 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # MathQuizForKids
2 |
3 | [](https://kotlinlang.org)
4 | [](https://www.android.com/)
5 |
6 | Интерактивное приложение-викторина с системой оценки результатов и навигацией через Fragment.
7 |
8 | ## О проекте
9 |
10 | Приложение представляет собой викторину из 10 вопросов с системой подсчета очков и отображением результатов. Демонстрирует работу с Fragment, ViewModel и LiveData для передачи данных между экранами.
11 |
12 | **Основной функционал:**
13 | - 10 вопросов с различными типами заданий
14 | - Система подсчета баллов
15 | - Визуальная обратная связь по ответам
16 | - Экран результатов с оценкой
17 | - Навигация между Fragment
18 |
19 | ## Технологии
20 |
21 | * Kotlin
22 | * Fragment
23 | * ViewModel
24 | * LiveData
25 | * ViewBinding
26 | * DataModel для передачи данных
27 |
28 |
29 |
30 |
31 |
32 |
--------------------------------------------------------------------------------
/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/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | appForResume
3 | Brain competition
4 | Play!
5 | Hello blank fragment
6 | Let\'s decide!
7 | question
8 | What is 2 + 2?
9 | What is 3 + 9?
10 | What is 7 * 7?
11 | What is 20 – 9?
12 | What is 23 + 15?
13 | What is 25 + 25?
14 | What is 37 – 20?
15 | What is 12 – 9?
16 | What is 37 * 0?
17 | What is 6 / 2?
18 | Enter your solution here
19 | Question 1
20 | Question 2
21 | Question 3
22 | Question 4
23 | Question 5
24 | Question 6
25 | Question 7
26 | Question 8
27 | Question 9
28 | Question 10
29 | check out
30 | To next
31 | Congratulations!
32 | You are good!
33 | Try to repeat!)
34 | "Don't forget to enter the answer)"
35 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/appforresume/ResultFragment.kt:
--------------------------------------------------------------------------------
1 | package com.example.appforresume
2 |
3 | import android.os.Bundle
4 | import android.view.LayoutInflater
5 | import android.view.View
6 | import android.view.ViewGroup
7 | import androidx.fragment.app.Fragment
8 | import androidx.fragment.app.activityViewModels
9 | import androidx.lifecycle.LifecycleOwner
10 | import com.example.appforresume.databinding.FragmentResultBinding
11 |
12 | class ResultFragment : Fragment() {
13 |
14 | private lateinit var b: FragmentResultBinding
15 | private val dataModel: DataModel by activityViewModels()
16 |
17 | override fun onCreateView(
18 | inflater: LayoutInflater, container: ViewGroup?,
19 | savedInstanceState: Bundle?,
20 | ): View {
21 | b = FragmentResultBinding.inflate(inflater)
22 | return b.root
23 | }
24 |
25 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
26 | dataModel.scoreToResult.observe(activity as LifecycleOwner) {
27 | val result = "You scored $it/10 points!"
28 | b.result.text = result
29 | when {
30 | it < 5 -> {
31 | b.congratulation.text = getString(R.string.bad)
32 | b.congratulationImage.setImageResource(R.drawable.bad)
33 | }
34 |
35 | it in 5..7 -> {
36 | b.congratulation.text = getString(R.string.normal)
37 | b.congratulationImage.setImageResource(R.drawable.normal)
38 | }
39 |
40 | else -> {
41 | b.congratulation.text = getString(R.string.congratulations)
42 | b.congratulationImage.setImageResource(R.drawable.firework)
43 | }
44 | }
45 | }
46 | b.toNext.setOnClickListener {
47 | activity?.supportFragmentManager?.beginTransaction()
48 | ?.replace(R.id.main, StartFragment.newInstance())?.commit()
49 | }
50 | }
51 |
52 | companion object {
53 | @JvmStatic
54 | fun newInstance() = ResultFragment()
55 | }
56 | }
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_result.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
14 |
15 |
23 |
24 |
29 |
30 |
38 |
39 |
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/appforresume/questions/Question4.kt:
--------------------------------------------------------------------------------
1 | package com.example.appforresume.questions
2 |
3 | import android.os.Build
4 | import android.os.Bundle
5 | import android.view.LayoutInflater
6 | import android.view.View
7 | import android.view.ViewGroup
8 | import androidx.annotation.RequiresApi
9 | import androidx.fragment.app.Fragment
10 | import androidx.fragment.app.activityViewModels
11 | import com.example.appforresume.DataModel
12 | import com.example.appforresume.R
13 | import com.example.appforresume.databinding.FragmentQuestion4Binding
14 |
15 | class Question4 : Fragment() {
16 | private val dataModel: DataModel by activityViewModels()
17 | private lateinit var b: FragmentQuestion4Binding
18 |
19 | override fun onCreateView(
20 | inflater: LayoutInflater, container: ViewGroup?,
21 | savedInstanceState: Bundle?,
22 | ): View {
23 | b = FragmentQuestion4Binding.inflate(inflater)
24 | return b.root
25 | }
26 |
27 | @RequiresApi(Build.VERSION_CODES.M)
28 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) = with(b) {
29 | var result = false
30 | checkOut.setOnClickListener {
31 | if (!isFieldEmpty()) {
32 | result = if (answer.text.toString() == "11") {
33 | backgroundQuest.setBackgroundColor(resources.getColor(R.color.right, null))
34 | imQuest.setImageResource(R.drawable.correct)
35 | true
36 | } else {
37 | backgroundQuest.setBackgroundColor(resources.getColor(R.color.wrong, null))
38 | imQuest.setImageResource(R.drawable.wrong)
39 | false
40 | }
41 | checkOut.isClickable = false
42 | answer.isFocusable = false
43 | toNext.visibility = View.VISIBLE
44 | }
45 | dataModel.messageToQuestFrag1.value = result
46 | }
47 | toNext.setOnClickListener {
48 | activity?.supportFragmentManager?.beginTransaction()?.remove(this@Question4)?.commit()
49 | dataModel.turnOnClickable.value = true
50 | }
51 | }
52 |
53 | companion object {
54 | @JvmStatic
55 | fun newInstance() = Question4()
56 | }
57 |
58 | private fun isFieldEmpty(): Boolean {
59 | b.apply {
60 | if (answer.text.isNullOrEmpty()) answer.error = getString(R.string.forgot_text)
61 | return answer.text.isNullOrEmpty()
62 | }
63 | }
64 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/example/appforresume/questions/Question5.kt:
--------------------------------------------------------------------------------
1 | package com.example.appforresume.questions
2 |
3 | import android.os.Build
4 | import android.os.Bundle
5 | import android.view.LayoutInflater
6 | import android.view.View
7 | import android.view.ViewGroup
8 | import androidx.annotation.RequiresApi
9 | import androidx.fragment.app.Fragment
10 | import androidx.fragment.app.activityViewModels
11 | import com.example.appforresume.DataModel
12 | import com.example.appforresume.R
13 | import com.example.appforresume.databinding.FragmentQuestion5Binding
14 |
15 | class Question5 : Fragment() {
16 | private val dataModel: DataModel by activityViewModels()
17 | private lateinit var b: FragmentQuestion5Binding
18 |
19 | override fun onCreateView(
20 | inflater: LayoutInflater, container: ViewGroup?,
21 | savedInstanceState: Bundle?,
22 | ): View {
23 | b = FragmentQuestion5Binding.inflate(inflater)
24 | return b.root
25 | }
26 |
27 | @RequiresApi(Build.VERSION_CODES.M)
28 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) = with(b) {
29 | var result = false
30 | checkOut.setOnClickListener {
31 | if (!isFieldEmpty()) {
32 | result = if (answer.text.toString() == "38") {
33 | backgroundQuest.setBackgroundColor(resources.getColor(R.color.right, null))
34 | imQuest.setImageResource(R.drawable.correct)
35 | true
36 | } else {
37 | backgroundQuest.setBackgroundColor(resources.getColor(R.color.wrong, null))
38 | imQuest.setImageResource(R.drawable.wrong)
39 | false
40 | }
41 | checkOut.isClickable = false
42 | answer.isFocusable = false
43 | toNext.visibility = View.VISIBLE
44 | }
45 | dataModel.messageToQuestFrag1.value = result
46 | }
47 | toNext.setOnClickListener {
48 | activity?.supportFragmentManager?.beginTransaction()?.remove(this@Question5)?.commit()
49 | dataModel.turnOnClickable.value = true
50 | }
51 | }
52 |
53 | companion object {
54 | @JvmStatic
55 | fun newInstance() = Question5()
56 | }
57 |
58 | private fun isFieldEmpty(): Boolean {
59 | b.apply {
60 | if (answer.text.isNullOrEmpty()) answer.error = getString(R.string.forgot_text)
61 | return answer.text.isNullOrEmpty()
62 | }
63 | }
64 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/example/appforresume/questions/Question6.kt:
--------------------------------------------------------------------------------
1 | package com.example.appforresume.questions
2 |
3 | import android.os.Build
4 | import android.os.Bundle
5 | import android.view.LayoutInflater
6 | import android.view.View
7 | import android.view.ViewGroup
8 | import androidx.annotation.RequiresApi
9 | import androidx.fragment.app.Fragment
10 | import androidx.fragment.app.activityViewModels
11 | import com.example.appforresume.DataModel
12 | import com.example.appforresume.R
13 | import com.example.appforresume.databinding.FragmentQuestion6Binding
14 |
15 | class Question6 : Fragment() {
16 | private val dataModel: DataModel by activityViewModels()
17 | private lateinit var b: FragmentQuestion6Binding
18 |
19 | override fun onCreateView(
20 | inflater: LayoutInflater, container: ViewGroup?,
21 | savedInstanceState: Bundle?,
22 | ): View {
23 | b = FragmentQuestion6Binding.inflate(inflater)
24 | return b.root
25 | }
26 |
27 | @RequiresApi(Build.VERSION_CODES.M)
28 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) = with(b) {
29 | var result = false
30 | checkOut.setOnClickListener {
31 | if (!isFieldEmpty()) {
32 | result = if (answer.text.toString() == "50") {
33 | backgroundQuest.setBackgroundColor(resources.getColor(R.color.right, null))
34 | imQuest.setImageResource(R.drawable.correct)
35 | true
36 | } else {
37 | backgroundQuest.setBackgroundColor(resources.getColor(R.color.wrong, null))
38 | imQuest.setImageResource(R.drawable.wrong)
39 | false
40 | }
41 | checkOut.isClickable = false
42 | answer.isFocusable = false
43 | toNext.visibility = View.VISIBLE
44 | }
45 | dataModel.messageToQuestFrag1.value = result
46 | }
47 | toNext.setOnClickListener {
48 | activity?.supportFragmentManager?.beginTransaction()?.remove(this@Question6)?.commit()
49 | dataModel.turnOnClickable.value = true
50 | }
51 | }
52 |
53 | companion object {
54 | @JvmStatic
55 | fun newInstance() = Question6()
56 | }
57 |
58 | private fun isFieldEmpty(): Boolean {
59 | b.apply {
60 | if (answer.text.isNullOrEmpty()) answer.error = getString(R.string.forgot_text)
61 | return answer.text.isNullOrEmpty()
62 | }
63 | }
64 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/example/appforresume/questions/Question7.kt:
--------------------------------------------------------------------------------
1 | package com.example.appforresume.questions
2 |
3 | import android.os.Build
4 | import android.os.Bundle
5 | import android.view.LayoutInflater
6 | import android.view.View
7 | import android.view.ViewGroup
8 | import androidx.annotation.RequiresApi
9 | import androidx.fragment.app.Fragment
10 | import androidx.fragment.app.activityViewModels
11 | import com.example.appforresume.DataModel
12 | import com.example.appforresume.R
13 | import com.example.appforresume.databinding.FragmentQuestion7Binding
14 |
15 | class Question7 : Fragment() {
16 | private val dataModel: DataModel by activityViewModels()
17 | private lateinit var b: FragmentQuestion7Binding
18 |
19 | override fun onCreateView(
20 | inflater: LayoutInflater, container: ViewGroup?,
21 | savedInstanceState: Bundle?,
22 | ): View {
23 | b = FragmentQuestion7Binding.inflate(inflater)
24 | return b.root
25 | }
26 |
27 | @RequiresApi(Build.VERSION_CODES.M)
28 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) = with(b) {
29 | var result = false
30 | checkOut.setOnClickListener {
31 | if (!isFieldEmpty()) {
32 | result = if (answer.text.toString() == "17") {
33 | backgroundQuest.setBackgroundColor(resources.getColor(R.color.right, null))
34 | imQuest.setImageResource(R.drawable.correct)
35 | true
36 | } else {
37 | backgroundQuest.setBackgroundColor(resources.getColor(R.color.wrong, null))
38 | imQuest.setImageResource(R.drawable.wrong)
39 | false
40 | }
41 | checkOut.isClickable = false
42 | answer.isFocusable = false
43 | toNext.visibility = View.VISIBLE
44 | }
45 | dataModel.messageToQuestFrag1.value = result
46 | }
47 | toNext.setOnClickListener {
48 | activity?.supportFragmentManager?.beginTransaction()?.remove(this@Question7)?.commit()
49 | dataModel.turnOnClickable.value = true
50 | }
51 | }
52 |
53 | companion object {
54 | @JvmStatic
55 | fun newInstance() = Question7()
56 | }
57 |
58 | private fun isFieldEmpty(): Boolean {
59 | b.apply {
60 | if (answer.text.isNullOrEmpty()) answer.error = getString(R.string.forgot_text)
61 | return answer.text.isNullOrEmpty()
62 | }
63 | }
64 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/example/appforresume/questions/Question8.kt:
--------------------------------------------------------------------------------
1 | package com.example.appforresume.questions
2 |
3 | import android.os.Build
4 | import android.os.Bundle
5 | import android.view.LayoutInflater
6 | import android.view.View
7 | import android.view.ViewGroup
8 | import androidx.annotation.RequiresApi
9 | import androidx.fragment.app.Fragment
10 | import androidx.fragment.app.activityViewModels
11 | import com.example.appforresume.DataModel
12 | import com.example.appforresume.R
13 | import com.example.appforresume.databinding.FragmentQuestion8Binding
14 |
15 | class Question8 : Fragment() {
16 | private val dataModel: DataModel by activityViewModels()
17 | private lateinit var b: FragmentQuestion8Binding
18 |
19 | override fun onCreateView(
20 | inflater: LayoutInflater, container: ViewGroup?,
21 | savedInstanceState: Bundle?,
22 | ): View {
23 | b = FragmentQuestion8Binding.inflate(inflater)
24 | return b.root
25 | }
26 |
27 | @RequiresApi(Build.VERSION_CODES.M)
28 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) = with(b) {
29 | var result = false
30 | checkOut.setOnClickListener {
31 | if (!isFieldEmpty()) {
32 | result = if (answer.text.toString() == "3") {
33 | backgroundQuest.setBackgroundColor(resources.getColor(R.color.right, null))
34 | imQuest.setImageResource(R.drawable.correct)
35 | true
36 | } else {
37 | backgroundQuest.setBackgroundColor(resources.getColor(R.color.wrong, null))
38 | imQuest.setImageResource(R.drawable.wrong)
39 | false
40 | }
41 | checkOut.isClickable = false
42 | answer.isFocusable = false
43 | toNext.visibility = View.VISIBLE
44 | }
45 | dataModel.messageToQuestFrag1.value = result
46 | }
47 | toNext.setOnClickListener {
48 | activity?.supportFragmentManager?.beginTransaction()?.remove(this@Question8)?.commit()
49 | dataModel.turnOnClickable.value = true
50 | }
51 | }
52 |
53 | companion object {
54 | @JvmStatic
55 | fun newInstance() = Question8()
56 | }
57 |
58 | private fun isFieldEmpty(): Boolean {
59 | b.apply {
60 | if (answer.text.isNullOrEmpty()) answer.error = getString(R.string.forgot_text)
61 | return answer.text.isNullOrEmpty()
62 | }
63 | }
64 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/example/appforresume/questions/Question9.kt:
--------------------------------------------------------------------------------
1 | package com.example.appforresume.questions
2 |
3 | import android.os.Build
4 | import android.os.Bundle
5 | import android.view.LayoutInflater
6 | import android.view.View
7 | import android.view.ViewGroup
8 | import androidx.annotation.RequiresApi
9 | import androidx.fragment.app.Fragment
10 | import androidx.fragment.app.activityViewModels
11 | import com.example.appforresume.DataModel
12 | import com.example.appforresume.R
13 | import com.example.appforresume.databinding.FragmentQuestion9Binding
14 |
15 | class Question9 : Fragment() {
16 | private val dataModel: DataModel by activityViewModels()
17 | private lateinit var b: FragmentQuestion9Binding
18 |
19 | override fun onCreateView(
20 | inflater: LayoutInflater, container: ViewGroup?,
21 | savedInstanceState: Bundle?,
22 | ): View {
23 | b = FragmentQuestion9Binding.inflate(inflater)
24 | return b.root
25 | }
26 |
27 | @RequiresApi(Build.VERSION_CODES.M)
28 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) = with(b) {
29 | var result = false
30 | checkOut.setOnClickListener {
31 | if (!isFieldEmpty()) {
32 | result = if (answer.text.toString() == "0") {
33 | backgroundQuest.setBackgroundColor(resources.getColor(R.color.right, null))
34 | imQuest.setImageResource(R.drawable.correct)
35 | true
36 | } else {
37 | backgroundQuest.setBackgroundColor(resources.getColor(R.color.wrong, null))
38 | imQuest.setImageResource(R.drawable.wrong)
39 | false
40 | }
41 | checkOut.isClickable = false
42 | answer.isFocusable = false
43 | toNext.visibility = View.VISIBLE
44 | }
45 | dataModel.messageToQuestFrag1.value = result
46 | }
47 | toNext.setOnClickListener {
48 | activity?.supportFragmentManager?.beginTransaction()?.remove(this@Question9)?.commit()
49 | dataModel.turnOnClickable.value = true
50 | }
51 | }
52 |
53 | companion object {
54 | @JvmStatic
55 | fun newInstance() = Question9()
56 | }
57 |
58 | private fun isFieldEmpty(): Boolean {
59 | b.apply {
60 | if (answer.text.isNullOrEmpty()) answer.error = getString(R.string.forgot_text)
61 | return answer.text.isNullOrEmpty()
62 | }
63 | }
64 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/example/appforresume/questions/Question10.kt:
--------------------------------------------------------------------------------
1 | package com.example.appforresume.questions
2 |
3 | import android.os.Build
4 | import android.os.Bundle
5 | import android.view.LayoutInflater
6 | import android.view.View
7 | import android.view.ViewGroup
8 | import androidx.annotation.RequiresApi
9 | import androidx.fragment.app.Fragment
10 | import androidx.fragment.app.activityViewModels
11 | import com.example.appforresume.DataModel
12 | import com.example.appforresume.R
13 | import com.example.appforresume.databinding.FragmentQuestion10Binding
14 |
15 | class Question10 : Fragment() {
16 | private val dataModel: DataModel by activityViewModels()
17 | private lateinit var b: FragmentQuestion10Binding
18 |
19 | override fun onCreateView(
20 | inflater: LayoutInflater, container: ViewGroup?,
21 | savedInstanceState: Bundle?,
22 | ): View {
23 | b = FragmentQuestion10Binding.inflate(inflater)
24 | return b.root
25 | }
26 |
27 | @RequiresApi(Build.VERSION_CODES.M)
28 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) = with(b) {
29 | var result = false
30 | checkOut.setOnClickListener {
31 | if (!isFieldEmpty()) {
32 | result = if (answer.text.toString() == "3") {
33 | backgroundQuest.setBackgroundColor(resources.getColor(R.color.right, null))
34 | imQuest.setImageResource(R.drawable.correct)
35 | true
36 | } else {
37 | backgroundQuest.setBackgroundColor(resources.getColor(R.color.wrong, null))
38 | imQuest.setImageResource(R.drawable.wrong)
39 | false
40 | }
41 | checkOut.isClickable = false
42 | answer.isFocusable = false
43 | toNext.visibility = View.VISIBLE
44 | }
45 | dataModel.messageToQuestFrag1.value = result
46 | }
47 | toNext.setOnClickListener {
48 | activity?.supportFragmentManager?.beginTransaction()?.remove(this@Question10)?.commit()
49 | dataModel.turnOnClickable.value = true
50 | }
51 | }
52 |
53 | companion object {
54 | @JvmStatic
55 | fun newInstance() = Question10()
56 | }
57 |
58 | private fun isFieldEmpty(): Boolean {
59 | b.apply {
60 | if (answer.text.isNullOrEmpty()) answer.error = getString(R.string.forgot_text)
61 | return answer.text.isNullOrEmpty()
62 | }
63 | }
64 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/example/appforresume/questions/Question2.kt:
--------------------------------------------------------------------------------
1 | package com.example.appforresume.questions
2 |
3 | import android.os.Build
4 | import android.os.Bundle
5 | import android.view.LayoutInflater
6 | import android.view.View
7 | import android.view.ViewGroup
8 | import androidx.annotation.RequiresApi
9 | import androidx.fragment.app.Fragment
10 | import androidx.fragment.app.activityViewModels
11 | import com.example.appforresume.DataModel
12 | import com.example.appforresume.R
13 | import com.example.appforresume.databinding.FragmentQuestion2Binding
14 |
15 | class Question2 : Fragment() {
16 |
17 | private val dataModel: DataModel by activityViewModels()
18 | private lateinit var b: FragmentQuestion2Binding
19 |
20 | override fun onCreateView(
21 | inflater: LayoutInflater, container: ViewGroup?,
22 | savedInstanceState: Bundle?,
23 | ): View {
24 | b = FragmentQuestion2Binding.inflate(inflater)
25 | return b.root
26 | }
27 |
28 | @RequiresApi(Build.VERSION_CODES.M)
29 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) = with(b) {
30 | var result = false
31 | checkOut.setOnClickListener {
32 | if (!isFieldEmpty()) {
33 | result = if (answer.text.toString() == "12") {
34 | backgroundQuest.setBackgroundColor(resources.getColor(R.color.right, null))
35 | imQuest.setImageResource(R.drawable.correct)
36 | true
37 | } else {
38 | backgroundQuest.setBackgroundColor(resources.getColor(R.color.wrong, null))
39 | imQuest.setImageResource(R.drawable.wrong)
40 | false
41 | }
42 | checkOut.isClickable = false
43 | answer.isFocusable = false
44 | toNext.visibility = View.VISIBLE
45 | }
46 | dataModel.messageToQuestFrag1.value = result
47 | }
48 | toNext.setOnClickListener {
49 | activity?.supportFragmentManager?.beginTransaction()?.remove(this@Question2)?.commit()
50 | dataModel.turnOnClickable.value = true
51 | }
52 | }
53 |
54 | companion object {
55 | @JvmStatic
56 | fun newInstance() = Question2()
57 | }
58 |
59 | private fun isFieldEmpty(): Boolean {
60 | b.apply {
61 | if (answer.text.isNullOrEmpty()) answer.error = getString(R.string.forgot_text)
62 | return answer.text.isNullOrEmpty()
63 | }
64 | }
65 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/example/appforresume/questions/Question3.kt:
--------------------------------------------------------------------------------
1 | package com.example.appforresume.questions
2 |
3 | import android.os.Build
4 | import android.os.Bundle
5 | import android.view.LayoutInflater
6 | import android.view.View
7 | import android.view.View.VISIBLE
8 | import android.view.ViewGroup
9 | import androidx.annotation.RequiresApi
10 | import androidx.fragment.app.Fragment
11 | import androidx.fragment.app.activityViewModels
12 | import com.example.appforresume.DataModel
13 | import com.example.appforresume.R
14 | import com.example.appforresume.databinding.FragmentQuestion3Binding
15 |
16 | class Question3 : Fragment() {
17 | private val dataModel: DataModel by activityViewModels()
18 | private lateinit var b: FragmentQuestion3Binding
19 |
20 | override fun onCreateView(
21 | inflater: LayoutInflater, container: ViewGroup?,
22 | savedInstanceState: Bundle?
23 | ): View {
24 | b = FragmentQuestion3Binding.inflate(inflater)
25 | return b.root
26 | }
27 |
28 | @RequiresApi(Build.VERSION_CODES.M)
29 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) = with(b){
30 | var result = false
31 | checkOut.setOnClickListener{
32 | if (!isFieldEmpty()) {
33 | result = if (answer.text.toString() == "49") {
34 | backgroundQuest.setBackgroundColor(resources.getColor(R.color.right, null))
35 | imQuest.setImageResource(R.drawable.correct)
36 | true
37 | } else {
38 | backgroundQuest.setBackgroundColor(resources.getColor(R.color.wrong, null))
39 | imQuest.setImageResource(R.drawable.wrong)
40 | false
41 | }
42 | checkOut.isClickable = false
43 | answer.isFocusable = false
44 | toNext.visibility = VISIBLE
45 | }
46 | dataModel.messageToQuestFrag1.value = result
47 | }
48 | toNext.setOnClickListener{
49 | activity?.supportFragmentManager?.beginTransaction()?.remove(this@Question3)?.commit()
50 | dataModel.turnOnClickable.value = true
51 | }
52 | }
53 |
54 | companion object {
55 | @JvmStatic
56 | fun newInstance() = Question3()
57 | }
58 |
59 | private fun isFieldEmpty(): Boolean {
60 | b.apply {
61 | if(answer.text.isNullOrEmpty()) answer.error = getString(R.string.forgot_text)
62 | return answer.text.isNullOrEmpty()
63 | }
64 | }
65 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/example/appforresume/questions/Question1.kt:
--------------------------------------------------------------------------------
1 | package com.example.appforresume.questions
2 |
3 | import android.os.Build
4 | import android.os.Bundle
5 | import android.view.LayoutInflater
6 | import android.view.View
7 | import android.view.View.VISIBLE
8 | import android.view.ViewGroup
9 | import androidx.annotation.RequiresApi
10 | import androidx.fragment.app.Fragment
11 | import androidx.fragment.app.activityViewModels
12 | import com.example.appforresume.DataModel
13 | import com.example.appforresume.QuestionsFragment
14 | import com.example.appforresume.R
15 | import com.example.appforresume.databinding.Question1Binding
16 |
17 | class Question1 : Fragment() {
18 |
19 | private val dataModel: DataModel by activityViewModels()
20 | private lateinit var b: Question1Binding
21 |
22 | override fun onCreateView(
23 | inflater: LayoutInflater, container: ViewGroup?,
24 | savedInstanceState: Bundle?,
25 | ): View {
26 | b = Question1Binding.inflate(inflater)
27 | return b.root
28 | }
29 |
30 | @RequiresApi(Build.VERSION_CODES.M)
31 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) = with(b) {
32 | var result = false
33 | checkOut.setOnClickListener {
34 | if (!isFieldEmpty()) {
35 | result = if (answer.text.toString() == "4") {
36 | backgroundQuest.setBackgroundColor(resources.getColor(R.color.right, null))
37 | imQuest.setImageResource(R.drawable.correct)
38 | true
39 | } else {
40 | backgroundQuest.setBackgroundColor(resources.getColor(R.color.wrong, null))
41 | imQuest.setImageResource(R.drawable.wrong)
42 | false
43 | }
44 | checkOut.isClickable = false
45 | answer.isFocusable = false
46 | toNext.visibility = VISIBLE
47 | }
48 | dataModel.messageToQuestFrag1.value = result
49 | }
50 | toNext.setOnClickListener {
51 | activity?.supportFragmentManager?.beginTransaction()?.remove(this@Question1)?.commit()
52 | dataModel.turnOnClickable.value = true
53 | }
54 | }
55 |
56 | companion object {
57 | @JvmStatic
58 | fun newInstance() = QuestionsFragment()
59 | }
60 |
61 | private fun isFieldEmpty(): Boolean {
62 | b.apply {
63 | if (answer.text.isNullOrEmpty()) answer.error = getString(R.string.forgot_text)
64 | return answer.text.isNullOrEmpty()
65 | }
66 | }
67 | }
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto execute
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto execute
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :execute
68 | @rem Setup the command line
69 |
70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71 |
72 |
73 | @rem Execute Gradle
74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75 |
76 | :end
77 | @rem End local scope for the variables with windows NT shell
78 | if "%ERRORLEVEL%"=="0" goto mainEnd
79 |
80 | :fail
81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82 | rem the _cmd.exe /c_ return code!
83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84 | exit /b 1
85 |
86 | :mainEnd
87 | if "%OS%"=="Windows_NT" endlocal
88 |
89 | :omega
90 |
--------------------------------------------------------------------------------
/app/src/main/res/values/font_certs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | - @array/com_google_android_gms_fonts_certs_dev
5 | - @array/com_google_android_gms_fonts_certs_prod
6 |
7 |
8 | -
9 | MIIEqDCCA5CgAwIBAgIJANWFuGx90071MA0GCSqGSIb3DQEBBAUAMIGUMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTAeFw0wODA0MTUyMzM2NTZaFw0zNTA5MDEyMzM2NTZaMIGUMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbTCCASAwDQYJKoZIhvcNAQEBBQADggENADCCAQgCggEBANbOLggKv+IxTdGNs8/TGFy0PTP6DHThvbbR24kT9ixcOd9W+EaBPWW+wPPKQmsHxajtWjmQwWfna8mZuSeJS48LIgAZlKkpFeVyxW0qMBujb8X8ETrWy550NaFtI6t9+u7hZeTfHwqNvacKhp1RbE6dBRGWynwMVX8XW8N1+UjFaq6GCJukT4qmpN2afb8sCjUigq0GuMwYXrFVee74bQgLHWGJwPmvmLHC69EH6kWr22ijx4OKXlSIx2xT1AsSHee70w5iDBiK4aph27yH3TxkXy9V89TDdexAcKk/cVHYNnDBapcavl7y0RiQ4biu8ymM8Ga/nmzhRKya6G0cGw8CAQOjgfwwgfkwHQYDVR0OBBYEFI0cxb6VTEM8YYY6FbBMvAPyT+CyMIHJBgNVHSMEgcEwgb6AFI0cxb6VTEM8YYY6FbBMvAPyT+CyoYGapIGXMIGUMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEQMA4GA1UEChMHQW5kcm9pZDEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDEiMCAGCSqGSIb3DQEJARYTYW5kcm9pZEBhbmRyb2lkLmNvbYIJANWFuGx90071MAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEEBQADggEBABnTDPEF+3iSP0wNfdIjIz1AlnrPzgAIHVvXxunW7SBrDhEglQZBbKJEk5kT0mtKoOD1JMrSu1xuTKEBahWRbqHsXclaXjoBADb0kkjVEJu/Lh5hgYZnOjvlba8Ld7HCKePCVePoTJBdI4fvugnL8TsgK05aIskyY0hKI9L8KfqfGTl1lzOv2KoWD0KWwtAWPoGChZxmQ+nBli+gwYMzM1vAkP+aayLe0a1EQimlOalO762r0GXO0ks+UeXde2Z4e+8S/pf7pITEI/tP+MxJTALw9QUWEv9lKTk+jkbqxbsh8nfBUapfKqYn0eidpwq2AzVp3juYl7//fKnaPhJD9gs=
10 |
11 |
12 |
13 | -
14 | MIIEQzCCAyugAwIBAgIJAMLgh0ZkSjCNMA0GCSqGSIb3DQEBBAUAMHQxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtHb29nbGUgSW5jLjEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDAeFw0wODA4MjEyMzEzMzRaFw0zNjAxMDcyMzEzMzRaMHQxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtHb29nbGUgSW5jLjEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDCCASAwDQYJKoZIhvcNAQEBBQADggENADCCAQgCggEBAKtWLgDYO6IIrgqWbxJOKdoR8qtW0I9Y4sypEwPpt1TTcvZApxsdyxMJZ2JORland2qSGT2y5b+3JKkedxiLDmpHpDsz2WCbdxgxRczfey5YZnTJ4VZbH0xqWVW/8lGmPav5xVwnIiJS6HXk+BVKZF+JcWjAsb/GEuq/eFdpuzSqeYTcfi6idkyugwfYwXFU1+5fZKUaRKYCwkkFQVfcAs1fXA5V+++FGfvjJ/CxURaSxaBvGdGDhfXE28LWuT9ozCl5xw4Yq5OGazvV24mZVSoOO0yZ31j7kYvtwYK6NeADwbSxDdJEqO4k//0zOHKrUiGYXtqw/A0LFFtqoZKFjnkCAQOjgdkwgdYwHQYDVR0OBBYEFMd9jMIhF1Ylmn/Tgt9r45jk14alMIGmBgNVHSMEgZ4wgZuAFMd9jMIhF1Ylmn/Tgt9r45jk14aloXikdjB0MQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLR29vZ2xlIEluYy4xEDAOBgNVBAsTB0FuZHJvaWQxEDAOBgNVBAMTB0FuZHJvaWSCCQDC4IdGZEowjTAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBAUAA4IBAQBt0lLO74UwLDYKqs6Tm8/yzKkEu116FmH4rkaymUIE0P9KaMftGlMexFlaYjzmB2OxZyl6euNXEsQH8gjwyxCUKRJNexBiGcCEyj6z+a1fuHHvkiaai+KL8W1EyNmgjmyy8AW7P+LLlkR+ho5zEHatRbM/YAnqGcFh5iZBqpknHf1SKMXFh4dd239FJ1jWYfbMDMy3NS5CTMQ2XFI1MvcyUTdZPErjQfTbQe3aDQsQcafEQPD+nqActifKZ0Np0IS9L9kR/wbNvyz6ENwPiTrjV2KRkEjH78ZMcUQXg0L3BYHJ3lc69Vs5Ddf9uUGGMYldX3WfMBEmh/9iFBDAaTCK
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_questions.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
13 |
14 |
22 |
23 |
38 |
39 |
44 |
45 |
46 |
54 |
55 |
59 |
63 |
67 |
71 |
75 |
79 |
83 |
87 |
91 |
95 |
96 |
97 |
98 |
99 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/question_1.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
20 |
21 |
35 |
36 |
41 |
42 |
50 |
51 |
63 |
64 |
73 |
74 |
79 |
80 |
88 |
89 |
90 |
101 |
102 |
103 |
104 |
105 |
116 |
117 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_question2.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
20 |
21 |
35 |
36 |
41 |
42 |
50 |
51 |
63 |
64 |
73 |
74 |
79 |
80 |
88 |
89 |
90 |
101 |
102 |
103 |
104 |
105 |
116 |
117 |
118 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_question3.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
20 |
21 |
35 |
36 |
41 |
42 |
50 |
51 |
63 |
64 |
73 |
74 |
79 |
80 |
88 |
89 |
90 |
101 |
102 |
103 |
104 |
105 |
116 |
117 |
118 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_question5.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
20 |
21 |
35 |
36 |
41 |
42 |
50 |
51 |
63 |
64 |
73 |
74 |
79 |
80 |
88 |
89 |
90 |
101 |
102 |
103 |
104 |
105 |
116 |
117 |
118 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_question6.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
20 |
21 |
35 |
36 |
41 |
42 |
50 |
51 |
63 |
64 |
73 |
74 |
79 |
80 |
88 |
89 |
90 |
101 |
102 |
103 |
104 |
105 |
116 |
117 |
118 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_question7.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
20 |
21 |
35 |
36 |
41 |
42 |
50 |
51 |
63 |
64 |
73 |
74 |
79 |
80 |
88 |
89 |
90 |
101 |
102 |
103 |
104 |
105 |
116 |
117 |
118 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_question8.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
20 |
21 |
35 |
36 |
41 |
42 |
50 |
51 |
63 |
64 |
73 |
74 |
79 |
80 |
88 |
89 |
90 |
101 |
102 |
103 |
104 |
105 |
116 |
117 |
118 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_question9.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
20 |
21 |
35 |
36 |
41 |
42 |
50 |
51 |
63 |
64 |
73 |
74 |
79 |
80 |
88 |
89 |
90 |
101 |
102 |
103 |
104 |
105 |
116 |
117 |
118 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_question10.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
20 |
21 |
35 |
36 |
41 |
42 |
50 |
51 |
63 |
64 |
73 |
74 |
79 |
80 |
88 |
89 |
90 |
101 |
102 |
103 |
104 |
105 |
116 |
117 |
118 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_question4.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
14 |
15 |
20 |
21 |
35 |
36 |
41 |
42 |
50 |
51 |
63 |
64 |
73 |
74 |
79 |
80 |
88 |
89 |
90 |
101 |
102 |
103 |
104 |
105 |
116 |
117 |
118 |
119 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | #
4 | # Copyright 2015 the original author or authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | ##
21 | ## Gradle start up script for UN*X
22 | ##
23 | ##############################################################################
24 |
25 | # Attempt to set APP_HOME
26 | # Resolve links: $0 may be a link
27 | PRG="$0"
28 | # Need this for relative symlinks.
29 | while [ -h "$PRG" ] ; do
30 | ls=`ls -ld "$PRG"`
31 | link=`expr "$ls" : '.*-> \(.*\)$'`
32 | if expr "$link" : '/.*' > /dev/null; then
33 | PRG="$link"
34 | else
35 | PRG=`dirname "$PRG"`"/$link"
36 | fi
37 | done
38 | SAVED="`pwd`"
39 | cd "`dirname \"$PRG\"`/" >/dev/null
40 | APP_HOME="`pwd -P`"
41 | cd "$SAVED" >/dev/null
42 |
43 | APP_NAME="Gradle"
44 | APP_BASE_NAME=`basename "$0"`
45 |
46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
48 |
49 | # Use the maximum available, or set MAX_FD != -1 to use that value.
50 | MAX_FD="maximum"
51 |
52 | warn () {
53 | echo "$*"
54 | }
55 |
56 | die () {
57 | echo
58 | echo "$*"
59 | echo
60 | exit 1
61 | }
62 |
63 | # OS specific support (must be 'true' or 'false').
64 | cygwin=false
65 | msys=false
66 | darwin=false
67 | nonstop=false
68 | case "`uname`" in
69 | CYGWIN* )
70 | cygwin=true
71 | ;;
72 | Darwin* )
73 | darwin=true
74 | ;;
75 | MINGW* )
76 | msys=true
77 | ;;
78 | NONSTOP* )
79 | nonstop=true
80 | ;;
81 | esac
82 |
83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84 |
85 |
86 | # Determine the Java command to use to start the JVM.
87 | if [ -n "$JAVA_HOME" ] ; then
88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
89 | # IBM's JDK on AIX uses strange locations for the executables
90 | JAVACMD="$JAVA_HOME/jre/sh/java"
91 | else
92 | JAVACMD="$JAVA_HOME/bin/java"
93 | fi
94 | if [ ! -x "$JAVACMD" ] ; then
95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
96 |
97 | Please set the JAVA_HOME variable in your environment to match the
98 | location of your Java installation."
99 | fi
100 | else
101 | JAVACMD="java"
102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
103 |
104 | Please set the JAVA_HOME variable in your environment to match the
105 | location of your Java installation."
106 | fi
107 |
108 | # Increase the maximum file descriptors if we can.
109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
110 | MAX_FD_LIMIT=`ulimit -H -n`
111 | if [ $? -eq 0 ] ; then
112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
113 | MAX_FD="$MAX_FD_LIMIT"
114 | fi
115 | ulimit -n $MAX_FD
116 | if [ $? -ne 0 ] ; then
117 | warn "Could not set maximum file descriptor limit: $MAX_FD"
118 | fi
119 | else
120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
121 | fi
122 | fi
123 |
124 | # For Darwin, add options to specify how the application appears in the dock
125 | if $darwin; then
126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
127 | fi
128 |
129 | # For Cygwin or MSYS, switch paths to Windows format before running java
130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133 |
134 | JAVACMD=`cygpath --unix "$JAVACMD"`
135 |
136 | # We build the pattern for arguments to be converted via cygpath
137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
138 | SEP=""
139 | for dir in $ROOTDIRSRAW ; do
140 | ROOTDIRS="$ROOTDIRS$SEP$dir"
141 | SEP="|"
142 | done
143 | OURCYGPATTERN="(^($ROOTDIRS))"
144 | # Add a user-defined pattern to the cygpath arguments
145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
147 | fi
148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
149 | i=0
150 | for arg in "$@" ; do
151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
153 |
154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
156 | else
157 | eval `echo args$i`="\"$arg\""
158 | fi
159 | i=`expr $i + 1`
160 | done
161 | case $i in
162 | 0) set -- ;;
163 | 1) set -- "$args0" ;;
164 | 2) set -- "$args0" "$args1" ;;
165 | 3) set -- "$args0" "$args1" "$args2" ;;
166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
172 | esac
173 | fi
174 |
175 | # Escape application args
176 | save () {
177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
178 | echo " "
179 | }
180 | APP_ARGS=`save "$@"`
181 |
182 | # Collect all arguments for the java command, following the shell quoting and substitution rules
183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
184 |
185 | exec "$JAVACMD" "$@"
186 |
--------------------------------------------------------------------------------
/app/src/main/java/com/example/appforresume/QuestionsFragment.kt:
--------------------------------------------------------------------------------
1 | package com.example.appforresume
2 |
3 | import android.os.Bundle
4 | import android.view.LayoutInflater
5 | import android.view.View
6 | import android.view.View.GONE
7 | import android.view.ViewGroup
8 | import androidx.fragment.app.Fragment
9 | import androidx.fragment.app.activityViewModels
10 | import androidx.lifecycle.LifecycleOwner
11 | import com.example.appforresume.databinding.FragmentQuestionsBinding
12 | import com.example.appforresume.questions.Question1
13 | import com.example.appforresume.questions.Question10
14 | import com.example.appforresume.questions.Question2
15 | import com.example.appforresume.questions.Question3
16 | import com.example.appforresume.questions.Question4
17 | import com.example.appforresume.questions.Question5
18 | import com.example.appforresume.questions.Question6
19 | import com.example.appforresume.questions.Question7
20 | import com.example.appforresume.questions.Question8
21 | import com.example.appforresume.questions.Question9
22 |
23 | class QuestionsFragment : Fragment() {
24 |
25 | private val dataModel: DataModel by activityViewModels()
26 | private lateinit var b: FragmentQuestionsBinding
27 | private var counter = 1
28 | private var score = 0
29 |
30 | override fun onCreateView(
31 | inflater: LayoutInflater, container: ViewGroup?,
32 | savedInstanceState: Bundle?,
33 | ): View {
34 | b = FragmentQuestionsBinding.inflate(inflater)
35 | return b.root
36 | }
37 |
38 | override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
39 | val ok = R.drawable.right_box
40 | val wrong = R.drawable.wrong_box
41 | dataModel.messageToQuestFrag1.observe(activity as LifecycleOwner) {
42 | if (it) {
43 | when (counter) {
44 | 2 -> b.quest1.setImageResource(ok)
45 | 3 -> b.quest2.setImageResource(ok)
46 | 4 -> b.quest3.setImageResource(ok)
47 | 5 -> b.quest4.setImageResource(ok)
48 | 6 -> b.quest5.setImageResource(ok)
49 | 7 -> b.quest6.setImageResource(ok)
50 | 8 -> b.quest7.setImageResource(ok)
51 | 9 -> b.quest8.setImageResource(ok)
52 | 10 -> b.quest9.setImageResource(ok)
53 | 11 -> b.quest10.setImageResource(ok)
54 | }
55 | score++
56 | } else {
57 | when (counter) {
58 | 2 -> b.quest1.setImageResource(wrong)
59 | 3 -> b.quest2.setImageResource(wrong)
60 | 4 -> b.quest3.setImageResource(wrong)
61 | 5 -> b.quest4.setImageResource(wrong)
62 | 6 -> b.quest5.setImageResource(wrong)
63 | 7 -> b.quest6.setImageResource(wrong)
64 | 8 -> b.quest7.setImageResource(wrong)
65 | 9 -> b.quest8.setImageResource(wrong)
66 | 10 -> b.quest9.setImageResource(wrong)
67 | 11 -> b.quest10.setImageResource(wrong)
68 | }
69 | }
70 | }
71 | dataModel.turnOnClickable.observe(activity as LifecycleOwner) {
72 | b.btnStartQuestions.isClickable = it
73 | }
74 | b.btnStartQuestions.setOnClickListener {
75 | b.btnStartQuestions.isClickable = false
76 | when (counter) {
77 | 1 -> {
78 | activity?.supportFragmentManager?.beginTransaction()
79 | ?.replace(R.id.btnStartQuestions, Question1())
80 | ?.commit()
81 | }
82 |
83 | 2 -> {
84 | activity?.supportFragmentManager?.beginTransaction()
85 | ?.replace(R.id.btnStartQuestions, Question2())
86 | ?.commit()
87 | }
88 |
89 | 3 -> {
90 | activity?.supportFragmentManager?.beginTransaction()
91 | ?.replace(R.id.btnStartQuestions, Question3())
92 | ?.commit()
93 | }
94 |
95 | 4 -> {
96 | activity?.supportFragmentManager?.beginTransaction()
97 | ?.replace(R.id.btnStartQuestions, Question4())
98 | ?.commit()
99 | }
100 |
101 | 5 -> {
102 | activity?.supportFragmentManager?.beginTransaction()
103 | ?.replace(R.id.btnStartQuestions, Question5())
104 | ?.commit()
105 | }
106 |
107 | 6 -> {
108 | activity?.supportFragmentManager?.beginTransaction()
109 | ?.replace(R.id.btnStartQuestions, Question6())
110 | ?.commit()
111 | }
112 |
113 | 7 -> {
114 | activity?.supportFragmentManager?.beginTransaction()
115 | ?.replace(R.id.btnStartQuestions, Question7())
116 | ?.commit()
117 | }
118 |
119 | 8 -> {
120 | activity?.supportFragmentManager?.beginTransaction()
121 | ?.replace(R.id.btnStartQuestions, Question8())
122 | ?.commit()
123 | }
124 |
125 | 9 -> {
126 | activity?.supportFragmentManager?.beginTransaction()
127 | ?.replace(R.id.btnStartQuestions, Question9())
128 | ?.commit()
129 | }
130 |
131 | 10 -> {
132 | activity?.supportFragmentManager?.beginTransaction()
133 | ?.replace(R.id.btnStartQuestions, Question10())
134 | ?.commit()
135 | }
136 |
137 | 11 -> {
138 | activity?.supportFragmentManager?.beginTransaction()
139 | ?.replace(R.id.btnStartQuestions, ResultFragment())
140 | ?.commit()
141 | dataModel.scoreToResult.value = score
142 | }
143 | }
144 | counter++
145 | }
146 | dataModel.scoreToResult.observe(activity as LifecycleOwner) {
147 | b.brainCompetition.visibility = GONE
148 | }
149 | }
150 |
151 | companion object {
152 | @JvmStatic
153 | fun newInstance() = QuestionsFragment()
154 | }
155 | }
--------------------------------------------------------------------------------