education: document public API for detekt
- Commit
c8c284e6df0007fd0be220e3310b165687e27c66- Author
- Vayun Mathur <[email protected]>
- When
- 2026-11-17 14:42 UTC (19 days ago)
- Parents
70f9d77
Add concise KDoc to every public class, object, interface and enum (including nested types) that detekt's UndocumentedPublicClass rule flagged in this module. Docs only: no behaviour, visibility or config changes. Verified: ./gradlew :education:detekt reports 0 UndocumentedPublicClass findings (pre-existing error-severity findings in other rules, where present, are untouched), and the module unit tests pass.
Diff
education/src/main/java/com/vayunmathur/education/MainActivity.kt
diff --git a/education/src/main/java/com/vayunmathur/education/MainActivity.kt b/education/src/main/java/com/vayunmathur/education/MainActivity.ktindex 7c470cb48a..6844811092 100644--- a/education/src/main/java/com/vayunmathur/education/MainActivity.kt+++ b/education/src/main/java/com/vayunmathur/education/MainActivity.kt@@ -19,6 +19,10 @@ import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch import kotlinx.coroutines.withContext +/**+ * Entry activity for Education: loads content and repositories off the main thread, seeds the single learner,+ * then hosts navigation with the narrator provided.+ */ class MainActivity : MaActivity() { private lateinit var content: ContentRepository private lateinit var repository: EducationRepository
education/src/main/java/com/vayunmathur/education/Route.kt
diff --git a/education/src/main/java/com/vayunmathur/education/Route.kt b/education/src/main/java/com/vayunmathur/education/Route.ktindex e1f09b3bdb..5455f396d8 100644--- a/education/src/main/java/com/vayunmathur/education/Route.kt+++ b/education/src/main/java/com/vayunmathur/education/Route.kt@@ -3,32 +3,49 @@ package com.vayunmathur.education import com.vayunmathur.library.util.NavKey import kotlinx.serialization.Serializable +/**+ * Navigation destinations for the Education app, from the catalog home through lessons, quizzes, results, and+ * parent screens.+ */ @Serializable sealed interface Route : NavKey {+ /** Catalog home destination showing courses, streak, stars, and deadlines. */ @Serializable data object Home : Route+ /** Course detail destination for the course identified by [courseId]. */ @Serializable data class Course(val courseId: String) : Route+ /** Unit detail destination for the unit identified by [unitId]. */ @Serializable data class UnitScreen(val unitId: String) : Route+ /** Scholar lesson destination for the lesson identified by [lessonId]. */ @Serializable data class LessonScreen(val lessonId: String) : Route+ /** Scholar quiz destination for the exercise identified by [exerciseId]. */ @Serializable data class Quiz(val exerciseId: String) : Route+ /** Streaming video lesson destination for [videoUrl], titled [title]. */ @Serializable data class VideoPlayer(val videoUrl: String, val title: String) : Route+ /** K-2 lesson destination for the lesson identified by [lessonId]. */ @Serializable data class K2Lesson(val lessonId: String) : Route+ /** K-2 quiz destination for the exercise identified by [exerciseId]. */ @Serializable data class K2Quiz(val exerciseId: String) : Route+ /** K-2 reward destination celebrating [stars] earned stars. */ @Serializable data class K2Reward(val stars: Int) : Route+ /** Quiz results destination summarising [correct] of [total] answers and [stars] earned. */ @Serializable data class Results(val total: Int, val correct: Int, val stars: Int) : Route+ /** PIN gate destination guarding entry to the parent area. */ @Serializable data object ParentGate : Route+ /** Parent area destination for learner settings, deadlines, and progress controls. */ @Serializable data object Parent : Route+ /** Badge gallery destination showing earned and locked achievements. */ @Serializable data object Badges : Route }
education/src/main/java/com/vayunmathur/education/data/ContentRepository.kt
diff --git a/education/src/main/java/com/vayunmathur/education/data/ContentRepository.kt b/education/src/main/java/com/vayunmathur/education/data/ContentRepository.ktindex 1e38126916..2a7028b0ce 100644--- a/education/src/main/java/com/vayunmathur/education/data/ContentRepository.kt+++ b/education/src/main/java/com/vayunmathur/education/data/ContentRepository.kt@@ -94,6 +94,10 @@ class ContentRepository(val packs: List<ContentPack>) { ModuleType.LESSON -> lesson(id)?.title } + /**+ * Factory for [ContentRepository]: loads and parses bundled content packs from assets, skipping malformed+ * packs.+ */ companion object { private const val TAG = "ContentRepository" private const val ASSET_DIR = "content"
education/src/main/java/com/vayunmathur/education/data/EducationDatabase.kt
diff --git a/education/src/main/java/com/vayunmathur/education/data/EducationDatabase.kt b/education/src/main/java/com/vayunmathur/education/data/EducationDatabase.ktindex 95e846fc87..27a88a518c 100644--- a/education/src/main/java/com/vayunmathur/education/data/EducationDatabase.kt+++ b/education/src/main/java/com/vayunmathur/education/data/EducationDatabase.kt@@ -12,6 +12,7 @@ import kotlinx.coroutines.flow.Flow const val DB_NAME = "education-db" @Dao+/** Data-access object for the single [Learner] row. */ interface LearnerDao { @Query("SELECT * FROM Learner WHERE id = ${Learner.SINGLE_ID}") fun getFlow(): Flow<Learner?>@@ -24,6 +25,7 @@ interface LearnerDao { } @Dao+/** Data-access object for per-skill progress rows. */ interface SkillProgressDao { @Query("SELECT * FROM SkillProgress") fun getAllFlow(): Flow<List<SkillProgress>>@@ -39,6 +41,7 @@ interface SkillProgressDao { } @Dao+/** Data-access object for parent-set module deadlines, ordered by due day. */ interface DeadlineDao { @Query("SELECT * FROM Deadline ORDER BY dueEpochDay ASC") fun getAllFlow(): Flow<List<Deadline>>@@ -58,11 +61,13 @@ interface DeadlineDao { version = 1, exportSchema = false, )+/** Room database holding the learner, skill-progress, and deadline tables. */ abstract class EducationDatabase : RoomDatabase() { abstract fun learnerDao(): LearnerDao abstract fun skillProgressDao(): SkillProgressDao abstract fun deadlineDao(): DeadlineDao + /** Migration registry for [EducationDatabase]; no migrations yet at version 1. */ companion object : DatabaseMigrations { override val migrations = emptyList<androidx.room3.migration.Migration>() }
education/src/main/java/com/vayunmathur/education/data/EducationRepository.kt
diff --git a/education/src/main/java/com/vayunmathur/education/data/EducationRepository.kt b/education/src/main/java/com/vayunmathur/education/data/EducationRepository.ktindex d5ed2c22de..8dd9d06b5d 100644--- a/education/src/main/java/com/vayunmathur/education/data/EducationRepository.kt+++ b/education/src/main/java/com/vayunmathur/education/data/EducationRepository.kt@@ -4,6 +4,7 @@ import android.content.Context import com.vayunmathur.library.room.RoomRepository import kotlinx.coroutines.flow.Flow +/** Repository facade over [EducationDatabase] for learner, skill-progress, and deadline data. */ class EducationRepository private constructor(context: Context) : RoomRepository<EducationDatabase>(context, EducationDatabase::class, DB_NAME) { @@ -29,6 +30,7 @@ class EducationRepository private constructor(context: Context) : suspend fun upsertDeadline(value: Deadline) = deadlineDao.upsert(value) suspend fun deleteDeadline(value: Deadline) = deadlineDao.delete(value) + /** Singleton accessor for the shared [EducationRepository] instance. */ companion object { @Volatile private var instance: EducationRepository? = null fun get(context: Context): EducationRepository =
education/src/main/java/com/vayunmathur/education/data/Learner.kt
diff --git a/education/src/main/java/com/vayunmathur/education/data/Learner.kt b/education/src/main/java/com/vayunmathur/education/data/Learner.ktindex 49aeb12c8a..dc2772add0 100644--- a/education/src/main/java/com/vayunmathur/education/data/Learner.kt+++ b/education/src/main/java/com/vayunmathur/education/data/Learner.kt@@ -32,6 +32,7 @@ data class Learner( val totalStars: Int = 0, val onboarded: Boolean = false, ) {+ /** Constants for the single-learner table, including its pinned row id. */ companion object { const val SINGLE_ID = 1L }
education/src/main/java/com/vayunmathur/education/domain/Question.kt
diff --git a/education/src/main/java/com/vayunmathur/education/domain/Question.kt b/education/src/main/java/com/vayunmathur/education/domain/Question.ktindex 1bd169e9d3..4252542254 100644--- a/education/src/main/java/com/vayunmathur/education/domain/Question.kt+++ b/education/src/main/java/com/vayunmathur/education/domain/Question.kt@@ -43,6 +43,7 @@ sealed interface Question { val difficulty: Int } +/** Single-answer multiple-choice question: the learner picks one of [choices], correct at [correctIndex]. */ @Serializable @SerialName("multiple_choice") data class MultipleChoiceQuestion(@@ -57,6 +58,7 @@ data class MultipleChoiceQuestion( override val difficulty: Int = 1, ) : Question +/** Multiple-select question: the learner must pick exactly the [correctIndices] set from [choices]. */ @Serializable @SerialName("multiple_select") data class MultipleSelectQuestion(@@ -71,6 +73,7 @@ data class MultipleSelectQuestion( override val difficulty: Int = 2, ) : Question +/** Numeric-answer question accepted within [tolerance] of [answer], optionally with a [unit]. */ @Serializable @SerialName("numeric") data class NumericQuestion(@@ -87,6 +90,7 @@ data class NumericQuestion( override val difficulty: Int = 2, ) : Question +/** Short free-text question accepted when the response matches one of [acceptedAnswers]. */ @Serializable @SerialName("short_text") data class ShortTextQuestion(@@ -156,9 +160,13 @@ data class TracingQuestion( /** A learner's answer to a [Question], produced by the quiz UI. */ sealed interface Answer +/** Answer selecting the single choice at [index]. */ data class ChoiceAnswer(val index: Int) : Answer+/** Answer selecting the set of choices at [indices]. */ data class MultiChoiceAnswer(val indices: Set<Int>) : Answer+/** Answer supplying the numeric [value]. */ data class NumericAnswer(val value: Double) : Answer+/** Answer supplying the free-text [text]. */ data class TextAnswer(val text: String) : Answer /** [order] holds the original item indices in the sequence the learner placed them. */
education/src/main/java/com/vayunmathur/education/platform/EducationAchievements.kt
diff --git a/education/src/main/java/com/vayunmathur/education/platform/EducationAchievements.kt b/education/src/main/java/com/vayunmathur/education/platform/EducationAchievements.ktindex 83c0ac0fa3..cbb2979c26 100644--- a/education/src/main/java/com/vayunmathur/education/platform/EducationAchievements.kt+++ b/education/src/main/java/com/vayunmathur/education/platform/EducationAchievements.kt@@ -16,6 +16,7 @@ class EducationAchievements(context: Context) : AchievementsManager(context, BAD // backfill here. } + /** Stable badge identifiers awarded by the ViewModel and shown in the gallery. */ object Ids { const val FIRST_STAR = "first_star" const val PERFECT = "perfect_quiz"@@ -27,6 +28,7 @@ class EducationAchievements(context: Context) : AchievementsManager(context, BAD const val COURSE_MASTER = "course_master" } + /** Badge sticker artwork and the bundled badge definitions for [EducationAchievements]. */ companion object { /** Emoji sticker per badge id, for the kid-facing gallery. */ val STICKERS: Map<String, String> = mapOf(
education/src/main/java/com/vayunmathur/education/platform/EducationUiContract.kt
diff --git a/education/src/main/java/com/vayunmathur/education/platform/EducationUiContract.kt b/education/src/main/java/com/vayunmathur/education/platform/EducationUiContract.ktindex 5fa66ec0be..11db11f6ee 100644--- a/education/src/main/java/com/vayunmathur/education/platform/EducationUiContract.kt+++ b/education/src/main/java/com/vayunmathur/education/platform/EducationUiContract.kt@@ -58,6 +58,7 @@ interface HomeActions { fun openCourse(courseId: String) {} fun openDeadline(deadline: HomeDeadline) {} + /** Provides the no-op [HomeActions] implementation used by previews. */ companion object { val Noop: HomeActions = object : HomeActions {} }@@ -93,6 +94,7 @@ interface CourseActions { fun openUnit(unitId: String) {} fun openExercise(exerciseId: String) {} + /** Provides the no-op [CourseActions] implementation used by previews. */ companion object { val Noop: CourseActions = object : CourseActions {} }@@ -116,6 +118,7 @@ interface QuizActions { fun navigateUp() {} fun finish(questions: List<Question>, answers: Map<String, Answer?>) {} + /** Provides the no-op [QuizActions] implementation used by previews. */ companion object { val Noop: QuizActions = object : QuizActions {} }
education/src/main/java/com/vayunmathur/education/platform/EducationViewModel.kt
diff --git a/education/src/main/java/com/vayunmathur/education/platform/EducationViewModel.kt b/education/src/main/java/com/vayunmathur/education/platform/EducationViewModel.ktindex 4b0e8646ae..eca81726ed 100644--- a/education/src/main/java/com/vayunmathur/education/platform/EducationViewModel.kt+++ b/education/src/main/java/com/vayunmathur/education/platform/EducationViewModel.kt@@ -209,6 +209,7 @@ class EducationViewModel( if (masteredACourse) achievements.onAchievementUnlocked(EducationAchievements.Ids.COURSE_MASTER) } + /** Star-rating thresholds and pure helpers for streaks, star scoring, and PIN hashing. */ companion object { /** Max stars per exercise (perfect score). */ const val MAX_STARS = 3@@ -256,6 +257,7 @@ data class QuizResult( val perSkillStars: Map<String, Int>, ) +/** Factory that creates [EducationViewModel] with its content and repository dependencies. */ class EducationViewModelFactory( private val application: Application, private val content: ContentRepository,