mirror of
https://github.com/AdrianKuta/KahootQuiz.git
synced 2025-09-14 17:24:21 +02:00
This commit enhances the `QuizScreen` to be interactive, allowing users to select choices and view revealed answers. It also introduces HTML parsing for question text and adds new design elements like icons and colors. Key changes: - **UI Layer (`ui:quiz` module):** - `QuizScreen`: - Now takes an `onSelect` callback to handle choice selection. - `Choices` composable updated to display choices in a `LazyVerticalGrid` and handles click events. - Introduced `ChoiceItem` which branches into `ChoiceItemDefault` (for selectable choices) and `ChoiceItemRevealed` (for displaying correct/incorrect answers). - `ChoiceItemDefault` displays choices with background colors and icons based on their index. - `ChoiceItemRevealed` displays choices with background colors indicating correctness (green for correct, red for incorrect selected, pink for incorrect unselected) and appropriate icons (tick for correct, cross for wrong). - `QuestionContent` now parses HTML in the question text using `HtmlCompat` and a new `toAnnotatedString` extension. - Image loading in `QuestionContent` uses `ContentScale.FillWidth` and `heightIn(min = 200.dp)`. - Added a new preview `QuizScreenRevealedAnswerPreview` to showcase the revealed answer state. - `QuizScreenViewModel`: - Now manages `_selectedChoiceIndex` to track the user's answer. - `uiState` is now a combination of the fetched quiz and the `_selectedChoiceIndex`, producing `QuizUiState` which includes an `AnswerUiState`. - `AnswerUiState` holds the `selectedChoiceIndex`. - Implemented `onChoiceSelected(index: Int)` to update the selected choice. - **Design System (`core:designsystem` module):** - Added `TextUtils.kt` with a `Spanned.toAnnotatedString()` extension function to convert HTML formatted text (from `HtmlCompat`) into Jetpack Compose `AnnotatedString`. - Added new color definitions: `Pink`, `Red`, `Red2`, `Blue2`, `Yellow3`, `Green`, `Green2`. - Added a `contrastiveTo(color: Color)` utility function to determine a contrasting text color (black or white) for a given background color. - Added new vector drawables for choice shapes and correctness indicators: - `ic_circle.xml` - `ic_correct.xml` - `ic_diamond.xml` - `ic_square.xml` - `ic_triangle.xml` - `ic_wrong.xml` - Added Detekt configuration file (`config/detekt/detekt.yml`) for the design system module. - **Domain Layer (`domain` module):** - `Question.image` is now nullable (`String?`). - `Choice.correct` is now non-nullable (`Boolean`). - **Network Layer (`core:network` module):** - `ChoiceDto.correct` is now non-nullable (`Boolean`) to align with the domain model. - **Project Configuration:** - Added `.editorconfig` with Kotlin specific trailing comma settings. - Minor reordering of dependencies in `gradle/libs.versions.toml`.
164 lines
11 KiB
TOML
164 lines
11 KiB
TOML
[versions]
|
|
targetSdk = "36"
|
|
compileSdk = "36"
|
|
minSdk = "23"
|
|
|
|
activityKtx = "1.10.1"
|
|
androidDesugarJdkLibs = "2.1.5"
|
|
androidGradlePlugin = "8.13.0-rc02"
|
|
androidTools = "31.12.2"
|
|
androidxActivity = "1.10.1"
|
|
androidxComposeBom = "2025.08.01"
|
|
androidxCore = "1.17.0"
|
|
androidxCoreSplashscreen = "1.0.1"
|
|
androidxJunit = "1.3.0"
|
|
androidxLifecycle = "2.9.3"
|
|
androidxNavigation = "2.9.3"
|
|
androidxTracing = "1.3.0"
|
|
androidxWork = "2.10.3"
|
|
animation = "1.9.0"
|
|
appUpdateKtx = "2.1.0"
|
|
appcompat = "1.7.1"
|
|
billing = "8.0.0"
|
|
coilCompose = "3.3.0"
|
|
coilNetworkOkhttp = "3.3.0"
|
|
coreTest = "1.7.0" # https://developer.android.com/jetpack/androidx/releases/test
|
|
datastorePreferences = "1.1.7" # https://developer.android.com/topic/libraries/architecture/datastore#preferences-datastore-dependencies
|
|
datetime = "0.7.1" # https://github.com/Kotlin/kotlinx-datetime/releases
|
|
detekt = "1.23.8" # https://detekt.dev/changelog
|
|
detektCompose = "0.4.27" # https://github.com/mrmans0n/compose-rules/releases
|
|
dotlottieAndroid = "0.11.0"
|
|
espressoCore = "3.7.0"
|
|
firebaseBom = "34.2.0"
|
|
firebaseCrashlyticsGradlePlugin = "3.0.6"
|
|
firebaseCrashlyticsPlugin = "3.0.6"
|
|
googleServices = "4.4.3"
|
|
gson = "2.13.1"
|
|
hilt = "2.57.1"
|
|
hiltExt = "1.2.0"
|
|
hiltNavigationCompose = "1.2.0"
|
|
immutableCollections = "0.4.0"
|
|
junit4 = "4.13.2"
|
|
kotlin = "2.2.10"
|
|
kotlinxCoroutinesAndroid = "1.10.2"
|
|
kotlinxSerializationJson = "1.9.0"
|
|
ksp = "2.2.10-2.0.2" # https://github.com/google/ksp/releases
|
|
material = "1.12.0"
|
|
materialIconsExtended = "1.7.8"
|
|
mockk = "1.14.5" # https://github.com/mockk/mockk/releases
|
|
playServicesAds = "24.5.0"
|
|
retrofit = "3.0.0"
|
|
reviewKtx = "2.0.2"
|
|
room = "2.7.2"
|
|
secrets = "2.0.1"
|
|
testRules = "1.7.0" # https://developer.android.com/jetpack/androidx/releases/test
|
|
testRunner = "1.7.0" # https://developer.android.com/jetpack/androidx/releases/test
|
|
timber = "5.0.1"
|
|
truth = "1.4.4"
|
|
turbine = "1.2.1"
|
|
uiAutomator = "2.3.0"
|
|
uiTextGoogleFonts = "1.9.0"
|
|
|
|
[libraries]
|
|
android-desugarJdkLibs = { group = "com.android.tools", name = "desugar_jdk_libs", version.ref = "androidDesugarJdkLibs" }
|
|
androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "androidxActivity" }
|
|
androidx-activity-ktx = { module = "androidx.activity:activity-ktx", version.ref = "activityKtx" }
|
|
androidx-compose-animation = { module = "androidx.compose.animation:animation", version.ref = "animation" }
|
|
androidx-compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "androidxComposeBom" }
|
|
androidx-compose-material3 = { group = "androidx.compose.material3", name = "material3" }
|
|
androidx-compose-ui = { group = "androidx.compose.ui", name = "ui" }
|
|
androidx-compose-ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" }
|
|
androidx-compose-ui-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" }
|
|
androidx-compose-ui-test-junit = { group = "androidx.compose.ui", name = "ui-test-junit4" }
|
|
androidx-compose-ui-test-manifest = { group = "androidx.compose.ui", name = "ui-test-manifest" }
|
|
androidx-compose-ui-tooling = { group = "androidx.compose.ui", name = "ui-tooling" }
|
|
androidx-compose-ui-tooling-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" }
|
|
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "androidxCore" }
|
|
androidx-core-splashscreen = { group = "androidx.core", name = "core-splashscreen", version.ref = "androidxCoreSplashscreen" }
|
|
androidx-datastore-preferences = { module = "androidx.datastore:datastore-preferences", version.ref = "datastorePreferences" }
|
|
androidx-espresso-core = { group = "androidx.test.espresso", name = "espresso-core", version.ref = "espressoCore" }
|
|
androidx-hilt-navigation-compose = { group = "androidx.hilt", name = "hilt-navigation-compose", version.ref = "hiltNavigationCompose" }
|
|
androidx-lifecycle-runtime-compose = { group = "androidx.lifecycle", name = "lifecycle-runtime-compose", version.ref = "androidxLifecycle" }
|
|
androidx-lifecycle-runtime-testing = { group = "androidx.lifecycle", name = "lifecycle-runtime-testing", version.ref = "androidxLifecycle" }
|
|
androidx-lifecycle-viewModelCompose = { group = "androidx.lifecycle", name = "lifecycle-viewmodel-compose", version.ref = "androidxLifecycle" }
|
|
androidx-material-icons-extended = { module = "androidx.compose.material:material-icons-extended", version.ref = "materialIconsExtended" }
|
|
androidx-navigation-compose = { group = "androidx.navigation", name = "navigation-compose", version.ref = "androidxNavigation" }
|
|
androidx-navigation-testing = { group = "androidx.navigation", name = "navigation-testing", version.ref = "androidxNavigation" }
|
|
androidx-test-core = { module = "androidx.test:core", version.ref = "coreTest" }
|
|
androidx-test-ext = { group = "androidx.test.ext", name = "junit", version.ref = "androidxJunit" }
|
|
androidx-test-rules = { module = "androidx.test:rules", version.ref = "testRules" }
|
|
androidx-test-runner = { module = "androidx.test:runner", version.ref = "testRunner" }
|
|
androidx-test-uiautomator = { module = "androidx.test.uiautomator:uiautomator", version.ref = "uiAutomator" }
|
|
androidx-tracing-ktx = { group = "androidx.tracing", name = "tracing-ktx", version.ref = "androidxTracing" }
|
|
androidx-ui-text-google-fonts = { module = "androidx.compose.ui:ui-text-google-fonts", version.ref = "uiTextGoogleFonts" }
|
|
androidx-work-ktx = { group = "androidx.work", name = "work-runtime-ktx", version.ref = "androidxWork" }
|
|
androidx-work-testing = { group = "androidx.work", name = "work-testing", version.ref = "androidxWork" }
|
|
app-update-ktx = { module = "com.google.android.play:app-update-ktx", version.ref = "appUpdateKtx" }
|
|
appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
|
|
billing-ktx = { group = "com.android.billingclient", name = "billing-ktx", version.ref = "billing" }
|
|
coil-compose = { module = "io.coil-kt.coil3:coil-compose", version.ref = "coilCompose" }
|
|
coil-network-okhttp = { module = "io.coil-kt.coil3:coil-network-okhttp", version.ref = "coilNetworkOkhttp" }
|
|
detekt-compose = { module = "io.nlopez.compose.rules:detekt", version.ref = "detektCompose" }
|
|
detekt-ktlint = { module = "io.gitlab.arturbosch.detekt:detekt-formatting", version.ref = "detekt" }
|
|
dotlottie-android = { module = "com.github.LottieFiles:dotlottie-android", version.ref = "dotlottieAndroid" }
|
|
firebase-analytics = { module = "com.google.firebase:firebase-analytics" }
|
|
firebase-bom = { module = "com.google.firebase:firebase-bom", version.ref = "firebaseBom" }
|
|
firebase-crashlytics = { group = "com.google.firebase", name = "firebase-crashlytics" }
|
|
gson = { group = "com.google.code.gson", name = "gson", version.ref = "gson" }
|
|
hilt-android = { group = "com.google.dagger", name = "hilt-android", version.ref = "hilt" }
|
|
hilt-compiler = { group = "com.google.dagger", name = "hilt-android-compiler", version.ref = "hilt" }
|
|
hilt-ext-compiler = { group = "androidx.hilt", name = "hilt-compiler", version.ref = "hiltExt" }
|
|
hilt-ext-work = { group = "androidx.hilt", name = "hilt-work", version.ref = "hiltExt" }
|
|
hilt-testing = { module = "com.google.dagger:hilt-android-testing", version.ref = "hilt" }
|
|
junit4 = { group = "junit", name = "junit", version.ref = "junit4" }
|
|
kotlin-test = { group = "org.jetbrains.kotlin", name = "kotlin-test", version.ref = "kotlin" }
|
|
kotlinx-collections-immutable = { module = "org.jetbrains.kotlinx:kotlinx-collections-immutable", version.ref = "immutableCollections" }
|
|
kotlinx-coroutines-android = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-android", version.ref = "kotlinxCoroutinesAndroid" }
|
|
kotlinx-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kotlinxCoroutinesAndroid" }
|
|
kotlinx-datetime = { module = "org.jetbrains.kotlinx:kotlinx-datetime", version.ref = "datetime" }
|
|
kotlinx-serialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "kotlinxSerializationJson" }
|
|
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
|
|
mockk-android = { module = "io.mockk:mockk-android", version.ref = "mockk" }
|
|
play-services-ads = { module = "com.google.android.gms:play-services-ads", version.ref = "playServicesAds" }
|
|
retrofit = { group = "com.squareup.retrofit2", name = "retrofit", version.ref = "retrofit" }
|
|
retrofit-converter-gson = { group = "com.squareup.retrofit2", name = "converter-gson", version.ref = "retrofit" }
|
|
review-ktx = { module = "com.google.android.play:review-ktx", version.ref = "reviewKtx" }
|
|
room-compiler = { group = "androidx.room", name = "room-compiler", version.ref = "room" }
|
|
room-ktx = { group = "androidx.room", name = "room-ktx", version.ref = "room" }
|
|
room-runtime = { group = "androidx.room", name = "room-runtime", version.ref = "room" }
|
|
timber = { group = "com.jakewharton.timber", name = "timber", version.ref = "timber" }
|
|
truth = { module = "com.google.truth:truth", version.ref = "truth" }
|
|
turbine = { group = "app.cash.turbine", name = "turbine", version.ref = "turbine" }
|
|
|
|
# Dependencies of the included build-logic
|
|
android-gradlePlugin = { group = "com.android.tools.build", name = "gradle", version.ref = "androidGradlePlugin" }
|
|
android-tools-common = { group = "com.android.tools", name = "common", version.ref = "androidTools" }
|
|
compose-gradlePlugin = { module = "org.jetbrains.kotlin:compose-compiler-gradle-plugin", version.ref = "kotlin" }
|
|
detekt-gradlePlugin = { module = "io.gitlab.arturbosch.detekt:detekt-gradle-plugin", version.ref = "detekt" }
|
|
firebase-crashlytics-gradlePlugin = { group = "com.google.firebase", name = "firebase-crashlytics-gradle", version.ref = "firebaseCrashlyticsPlugin" }
|
|
kotlin-gradlePlugin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin" }
|
|
ksp-gradlePlugin = { group = "com.google.devtools.ksp", name = "com.google.devtools.ksp.gradle.plugin", version.ref = "ksp" }
|
|
|
|
|
|
[plugins]
|
|
android-test = { id = "com.android.test", version.ref = "androidGradlePlugin" }
|
|
com-android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" }
|
|
com-android-library = { id = "com.android.library", version.ref = "androidGradlePlugin" }
|
|
compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
|
|
detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" }
|
|
firebase-crashlytics = { id = "com.google.firebase.crashlytics", version.ref = "firebaseCrashlyticsGradlePlugin" }
|
|
google-services = { id = "com.google.gms.google-services", version.ref = "googleServices" }
|
|
hilt = { id = "com.google.dagger.hilt.android", version.ref = "hilt" }
|
|
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
|
|
kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
|
|
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
|
|
secrets = { id = "com.google.android.libraries.mapsplatform.secrets-gradle-plugin", version.ref = "secrets" }
|
|
|
|
kahootquiz-android-application = { id = "kahootquiz.android.application" }
|
|
kahootquiz-android-application-compose = { id = "kahootquiz.android.application.compose" }
|
|
kahootquiz-android-application-firebase = { id = "kahootquiz.android.application.firebase" }
|
|
kahootquiz-android-application-hilt = { id = "kahootquiz.android.application.hilt" }
|
|
kahootquiz-android-library = { id = "kahootquiz.android.library" }
|
|
kahootquiz-android-library-compose = { id = "kahootquiz.android.library.compose" }
|
|
kahootquiz-android-library-hilt = { id = "kahootquiz.android.library.hilt" }
|