Modern Apps git

← Modern-Apps.git

todo: document public API for detekt

Commit
70f9d77247af2b067d10d528a682b91007209db0
Author
Vayun Mathur <[email protected]>
When
2026-11-17 14:42 UTC (19 days ago)
Parents
3e7c8cc
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 :todo:detekt reports 0
UndocumentedPublicClass findings (pre-existing error-severity
findings in other rules, where present, are untouched), and the
module unit tests pass.

Diff

todo/src/main/java/com/vayunmathur/todo/MainActivity.kt
diff --git a/todo/src/main/java/com/vayunmathur/todo/MainActivity.kt b/todo/src/main/java/com/vayunmathur/todo/MainActivity.ktindex f872a3f200..e27fdef891 100644--- a/todo/src/main/java/com/vayunmathur/todo/MainActivity.kt+++ b/todo/src/main/java/com/vayunmathur/todo/MainActivity.kt@@ -9,6 +9,10 @@ import com.vayunmathur.todo.data.TodoSettings import com.vayunmathur.todo.platform.IntentRouter import com.vayunmathur.todo.platform.TodoViewModel +/**+ * Entry activity: builds the repository and view model, forwards intents to IntentRouter, and hosts the+ * navigation graph.+ */ class MainActivity : MaActivity() {     private lateinit var todoRepository: TodoRepository     private val todoViewModel: TodoViewModel by viewModels {
todo/src/main/java/com/vayunmathur/todo/Route.kt
diff --git a/todo/src/main/java/com/vayunmathur/todo/Route.kt b/todo/src/main/java/com/vayunmathur/todo/Route.ktindex abdb0b178f..0b27e83d0c 100644--- a/todo/src/main/java/com/vayunmathur/todo/Route.kt+++ b/todo/src/main/java/com/vayunmathur/todo/Route.kt@@ -3,6 +3,7 @@ package com.vayunmathur.todo import com.vayunmathur.library.util.NavKey import kotlinx.serialization.Serializable +/** Navigation destinations for the todo app; the back stack is the source of truth for the selected view. */ @Serializable sealed interface Route : NavKey {     /** The task list showing [viewKey] (a `TodoView.key`); the route is the source of truth for the selected view. */@@ -13,6 +14,7 @@ sealed interface Route : NavKey {     @Serializable     data class TodoDetail(val id: Long, val newSyncId: String? = null) : Route +    /** The app settings screen. */     @Serializable     data object Settings : Route }
todo/src/main/java/com/vayunmathur/todo/TodoApplication.kt
diff --git a/todo/src/main/java/com/vayunmathur/todo/TodoApplication.kt b/todo/src/main/java/com/vayunmathur/todo/TodoApplication.ktindex c26daf298b..b273b37b6c 100644--- a/todo/src/main/java/com/vayunmathur/todo/TodoApplication.kt+++ b/todo/src/main/java/com/vayunmathur/todo/TodoApplication.kt@@ -3,6 +3,7 @@ package com.vayunmathur.todo import android.app.Application import com.vayunmathur.todo.platform.TodoBackground +/** Application entry point: starts background work for reminders, widgets and the calendar mirror. */ class TodoApplication : Application() {     override fun onCreate() {         super.onCreate()
todo/src/main/java/com/vayunmathur/todo/data/SyncSnapshot.kt
diff --git a/todo/src/main/java/com/vayunmathur/todo/data/SyncSnapshot.kt b/todo/src/main/java/com/vayunmathur/todo/data/SyncSnapshot.ktindex 262b6a6f2b..0bc2247b9a 100644--- a/todo/src/main/java/com/vayunmathur/todo/data/SyncSnapshot.kt+++ b/todo/src/main/java/com/vayunmathur/todo/data/SyncSnapshot.kt@@ -22,6 +22,7 @@ data class SyncSnapshot(     val remoteModified: Long,     val lastSyncedAt: Long, ) {+    /** Kind constants distinguishing todo rows from list rows in a sync snapshot. */     companion object {         const val KIND_TODO = "todo"         const val KIND_LIST = "todolist"
todo/src/main/java/com/vayunmathur/todo/data/Todo.kt
diff --git a/todo/src/main/java/com/vayunmathur/todo/data/Todo.kt b/todo/src/main/java/com/vayunmathur/todo/data/Todo.ktindex f057db1d78..0a1b634002 100644--- a/todo/src/main/java/com/vayunmathur/todo/data/Todo.kt+++ b/todo/src/main/java/com/vayunmathur/todo/data/Todo.kt@@ -6,6 +6,10 @@ import androidx.room3.PrimaryKey import com.vayunmathur.library.util.ReorderableDatabaseItem import kotlinx.serialization.Serializable +/**+ * A task row: title and notes, due/reminder/repeat state, list, section, tags and priority, plus sync identity+ * and tombstone flag.+ */ @Serializable @Entity(indices = [Index("syncId"), Index("listSyncId"), Index("parentSyncId")]) data class Todo(@@ -49,6 +53,7 @@ data class Todo(      val isSubtask: Boolean get() = parentSyncId != null +    /** Priority constants: PRIORITY_NONE is unprioritised and PRIORITY_MAX is the lowest priority level. */     companion object {         const val PRIORITY_NONE = 0         const val PRIORITY_MAX = 4
todo/src/main/java/com/vayunmathur/todo/data/TodoConverters.kt
diff --git a/todo/src/main/java/com/vayunmathur/todo/data/TodoConverters.kt b/todo/src/main/java/com/vayunmathur/todo/data/TodoConverters.ktindex cdcb271648..9e7b988958 100644--- a/todo/src/main/java/com/vayunmathur/todo/data/TodoConverters.kt+++ b/todo/src/main/java/com/vayunmathur/todo/data/TodoConverters.kt@@ -3,6 +3,7 @@ package com.vayunmathur.todo.data import androidx.room3.ColumnTypeConverter import kotlinx.serialization.json.Json +/** Room type converters that store string lists such as tags and blockers as JSON columns. */ class TodoConverters {     @ColumnTypeConverter     fun fromStringList(value: List<String>): String = Json.encodeToString(value)
todo/src/main/java/com/vayunmathur/todo/data/TodoDatabase.kt
diff --git a/todo/src/main/java/com/vayunmathur/todo/data/TodoDatabase.kt b/todo/src/main/java/com/vayunmathur/todo/data/TodoDatabase.ktindex b8f494cf17..db1f83f262 100644--- a/todo/src/main/java/com/vayunmathur/todo/data/TodoDatabase.kt+++ b/todo/src/main/java/com/vayunmathur/todo/data/TodoDatabase.kt@@ -18,6 +18,7 @@ const val DB_NAME = "todo-db" fun todoDbConfigs(context: Context): List<Pair<String, String>> =     listOf(DB_NAME to DatabaseHelper(context).getPassphrase()) +/** Room DAO for task rows, including subtask, changed-since and tombstone-cleanup queries. */ @Dao abstract class TodoDao {     @Query("SELECT * FROM Todo WHERE deleted = 0 ORDER BY position")@@ -86,6 +87,7 @@ abstract class TodoDao {     abstract suspend fun deleteAll() } +/** Room DAO for task-list rows. */ @Dao abstract class TodoListDao {     @Query("SELECT * FROM TodoList WHERE deleted = 0 ORDER BY position")@@ -121,6 +123,7 @@ abstract class TodoListDao {     abstract suspend fun deleteAll() } +/** Room DAO for last-synced snapshot baselines used to tell deletions from new rows. */ @Dao interface TodoSyncSnapshotDao {     @Query("SELECT * FROM SyncSnapshot WHERE kind = :kind")@@ -143,6 +146,7 @@ interface TodoSyncSnapshotDao {     suspend fun deleteAllExcept(excludedKind: String) } +/** Room database holding tasks, lists and sync snapshots. */ @Database(entities = [Todo::class, TodoList::class, SyncSnapshot::class], version = 3, exportSchema = true) @ColumnTypeConverters(TodoConverters::class) abstract class TodoDatabase : RoomDatabase() {@@ -150,6 +154,7 @@ abstract class TodoDatabase : RoomDatabase() {     abstract fun todoListDao(): TodoListDao     abstract fun syncSnapshotDao(): TodoSyncSnapshotDao +    /** Supplies the database migrations. */     companion object : DatabaseMigrations {         override val migrations: List<Migration> = TodoMigrations.all     }
todo/src/main/java/com/vayunmathur/todo/data/TodoRepository.kt
diff --git a/todo/src/main/java/com/vayunmathur/todo/data/TodoRepository.kt b/todo/src/main/java/com/vayunmathur/todo/data/TodoRepository.ktindex f73a358126..ebe5837c3b 100644--- a/todo/src/main/java/com/vayunmathur/todo/data/TodoRepository.kt+++ b/todo/src/main/java/com/vayunmathur/todo/data/TodoRepository.kt@@ -136,6 +136,7 @@ class TodoRepository private constructor(         }     } +    /** Holds the process-wide TodoRepository singleton. */     companion object {         @Volatile private var instance: TodoRepository? = null         fun get(context: Context): TodoRepository =
todo/src/main/java/com/vayunmathur/todo/data/TodoSettings.kt
diff --git a/todo/src/main/java/com/vayunmathur/todo/data/TodoSettings.kt b/todo/src/main/java/com/vayunmathur/todo/data/TodoSettings.ktindex 77f6b91afa..12c071a407 100644--- a/todo/src/main/java/com/vayunmathur/todo/data/TodoSettings.kt+++ b/todo/src/main/java/com/vayunmathur/todo/data/TodoSettings.kt@@ -41,6 +41,7 @@ class TodoSettings(context: Context) {     suspend fun digestMinutesNow(): Long = digestMinutes.first()     suspend fun calendarMirrorNow(): Boolean = calendarMirror.first() +    /** DataStore keys and defaults for todo preferences. */     companion object {         private const val KEY_DEFAULT_VIEW = "todo_default_view"         private const val KEY_DEFAULT_SORT = "todo_default_sort"
todo/src/main/java/com/vayunmathur/todo/domain/DueBuckets.kt
diff --git a/todo/src/main/java/com/vayunmathur/todo/domain/DueBuckets.kt b/todo/src/main/java/com/vayunmathur/todo/domain/DueBuckets.ktindex 48e0b6bded..021a296e24 100644--- a/todo/src/main/java/com/vayunmathur/todo/domain/DueBuckets.kt+++ b/todo/src/main/java/com/vayunmathur/todo/domain/DueBuckets.kt@@ -6,6 +6,7 @@ import kotlinx.datetime.TimeZone import kotlinx.datetime.daysUntil import kotlinx.datetime.plus +/** Coarse due-date grouping relative to today, used to section the task list. */ enum class DueBucket { OVERDUE, TODAY, TOMORROW, THIS_WEEK, LATER, NO_DATE }  /** Where a due value falls relative to now, in the user's zone. */
todo/src/main/java/com/vayunmathur/todo/domain/QuickAddParser.kt
diff --git a/todo/src/main/java/com/vayunmathur/todo/domain/QuickAddParser.kt b/todo/src/main/java/com/vayunmathur/todo/domain/QuickAddParser.ktindex 0494536d59..6c7fe28cdd 100644--- a/todo/src/main/java/com/vayunmathur/todo/domain/QuickAddParser.kt+++ b/todo/src/main/java/com/vayunmathur/todo/domain/QuickAddParser.kt@@ -17,10 +17,13 @@ import kotlinx.datetime.plus  */ object QuickAddParser { +    /** Category of a recognised quick-add token. */     enum class Kind { DATE, TIME, RECURRENCE, TAG, PRIORITY, LIST } +    /** A recognised fragment of quick-add input, with its source range for highlighting. */     data class Token(val kind: Kind, val range: IntRange, val text: String) +    /** Parsed quick-add result: the cleaned title plus extracted due, recurrence, tags, priority and list. */     data class Result(         val title: String,         val dueAt: Long? = null,
todo/src/main/java/com/vayunmathur/todo/domain/Recurrence.kt
diff --git a/todo/src/main/java/com/vayunmathur/todo/domain/Recurrence.kt b/todo/src/main/java/com/vayunmathur/todo/domain/Recurrence.ktindex 9770365428..bfa33f424d 100644--- a/todo/src/main/java/com/vayunmathur/todo/domain/Recurrence.kt+++ b/todo/src/main/java/com/vayunmathur/todo/domain/Recurrence.kt@@ -17,6 +17,7 @@ import kotlinx.datetime.plus sealed interface Recurrence {     val interval: Int +    /** Repeats every interval days. */     data class Daily(override val interval: Int = 1) : Recurrence      /** [days] empty means "the due date's weekday". */@@ -25,6 +26,7 @@ sealed interface Recurrence {     /** [dayOfMonth] null means "the due date's day", [LAST_DAY] the last day of the month. */     data class Monthly(override val interval: Int = 1, val dayOfMonth: Int? = null) : Recurrence +    /** Repeats every interval years on the due date. */     data class Yearly(override val interval: Int = 1) : Recurrence      /** Due [interval] days after the task is completed, whenever that is. */@@ -81,6 +83,7 @@ sealed interface Recurrence {     /** The plain RRULE for calendars, or null when the schedule depends on completion. */     fun toRRule(): String? = if (this is AfterCompletion) null else serialize() +    /** Parsing, serialisation constants and limits for the RRULE-style recurrence format. */     companion object {         const val LAST_DAY = -1         private const val X_FROM = "X-FROM"
todo/src/main/java/com/vayunmathur/todo/domain/Reminders.kt
diff --git a/todo/src/main/java/com/vayunmathur/todo/domain/Reminders.kt b/todo/src/main/java/com/vayunmathur/todo/domain/Reminders.ktindex e168665b95..81827275fe 100644--- a/todo/src/main/java/com/vayunmathur/todo/domain/Reminders.kt+++ b/todo/src/main/java/com/vayunmathur/todo/domain/Reminders.kt@@ -13,6 +13,7 @@ object Reminders {     private const val DAY_MS = 86_400_000L     private const val MAX_OCCURRENCES = 400 +    /** How long before the due moment a reminder fires. */     enum class Offset(val minutes: Long) {         AT_DUE(0), MINUTES_10(10), HOUR_1(60), DAY_1(24 * 60)     }
todo/src/main/java/com/vayunmathur/todo/domain/TodoQuery.kt
diff --git a/todo/src/main/java/com/vayunmathur/todo/domain/TodoQuery.kt b/todo/src/main/java/com/vayunmathur/todo/domain/TodoQuery.ktindex 1d4c615470..10b69b5d67 100644--- a/todo/src/main/java/com/vayunmathur/todo/domain/TodoQuery.kt+++ b/todo/src/main/java/com/vayunmathur/todo/domain/TodoQuery.kt@@ -14,15 +14,20 @@ data class TodoRow(     val overdue: Boolean = false, ) +/** Key identifying a list section: ungrouped, a due bucket, or a named list section. */ sealed interface GroupKey {+    /** Ungrouped: all rows are shown in a single section. */     data object None : GroupKey+    /** Section containing the tasks in one due bucket. */     data class Bucket(val bucket: DueBucket) : GroupKey     /** [name] null is "no section". */     data class Section(val name: String?) : GroupKey } +/** One rendered section of the task list. */ data class TodoGroup(val key: GroupKey, val rows: List<TodoRow>) +/** The built list for a view: grouped open rows, completed rows, and whether manual reordering is allowed. */ data class TodoListModel(     val groups: List<TodoGroup> = emptyList(),     val completed: List<TodoRow> = emptyList(),@@ -35,6 +40,7 @@ data class TodoListModel( /** Builds what the list shows for a view, search, and sort. */ object TodoQuery { +    /** Inputs for building a list model: tasks, lists, view, search text, sort order and current time and zone. */     data class Input(         val todos: List<Todo>,         val lists: List<TodoList>,
todo/src/main/java/com/vayunmathur/todo/domain/TodoSearch.kt
diff --git a/todo/src/main/java/com/vayunmathur/todo/domain/TodoSearch.kt b/todo/src/main/java/com/vayunmathur/todo/domain/TodoSearch.ktindex 654a2d87eb..376ad4d882 100644--- a/todo/src/main/java/com/vayunmathur/todo/domain/TodoSearch.kt+++ b/todo/src/main/java/com/vayunmathur/todo/domain/TodoSearch.kt@@ -2,6 +2,7 @@ package com.vayunmathur.todo.domain  import com.vayunmathur.todo.data.Todo +/** Case-insensitive substring search over task title, notes and tags, with match ranges for highlighting. */ object TodoSearch {     fun matches(todo: Todo, query: String): Boolean {         val q = query.trim().removePrefix("#")
todo/src/main/java/com/vayunmathur/todo/domain/TodoView.kt
diff --git a/todo/src/main/java/com/vayunmathur/todo/domain/TodoView.kt b/todo/src/main/java/com/vayunmathur/todo/domain/TodoView.ktindex d9f13d2459..eed7f15fc0 100644--- a/todo/src/main/java/com/vayunmathur/todo/domain/TodoView.kt+++ b/todo/src/main/java/com/vayunmathur/todo/domain/TodoView.kt@@ -5,15 +5,24 @@ import kotlinx.serialization.Serializable /** What the main list is showing. */ @Serializable sealed interface TodoView {+    /** Tasks that belong to no list. */     @Serializable data object Inbox : TodoView+    /** Open tasks due today or overdue, plus tasks completed today. */     @Serializable data object Today : TodoView+    /** Tasks with a future due date that are not yet overdue. */     @Serializable data object Upcoming : TodoView+    /** Tasks that have a priority set. */     @Serializable data object Priority : TodoView+    /** Every task, regardless of list or due date. */     @Serializable data object All : TodoView+    /** Tasks that have been completed. */     @Serializable data object Completed : TodoView+    /** Tasks belonging to the list identified by listSyncId. */     @Serializable data class InList(val listSyncId: String) : TodoView+    /** Tasks carrying the given tag. */     @Serializable data class Tagged(val tag: String) : TodoView +    /** The smart views and conversion between views and their stable preference keys. */     companion object {         // A getter, not a stored list: the nested objects may not be initialised yet when the         // companion is, which would leave nulls in the list.@@ -44,4 +53,5 @@ sealed interface TodoView {         } } +/** Orderings available for the task list. */ enum class SortMode { MANUAL, DUE, PRIORITY, CREATED, TITLE }
todo/src/main/java/com/vayunmathur/todo/domain/format/ImportedTask.kt
diff --git a/todo/src/main/java/com/vayunmathur/todo/domain/format/ImportedTask.kt b/todo/src/main/java/com/vayunmathur/todo/domain/format/ImportedTask.ktindex 4887354a8a..d2622126f9 100644--- a/todo/src/main/java/com/vayunmathur/todo/domain/format/ImportedTask.kt+++ b/todo/src/main/java/com/vayunmathur/todo/domain/format/ImportedTask.kt@@ -31,6 +31,7 @@ data class ExportSource(val todos: List<Todo>, val lists: List<TodoList>) {     fun listName(todo: Todo): String? = todo.listSyncId?.let { listNames[it] } } +/** File format for an export, with its file extension and MIME type. */ enum class ExportFormat(val extension: String, val mimeType: String) {     TODO_TXT("txt", "text/plain"),     CSV("csv", "text/csv"),
todo/src/main/java/com/vayunmathur/todo/notifications/ReminderActionReceiver.kt
diff --git a/todo/src/main/java/com/vayunmathur/todo/notifications/ReminderActionReceiver.kt b/todo/src/main/java/com/vayunmathur/todo/notifications/ReminderActionReceiver.ktindex d63431bd7e..ad456c06c2 100644--- a/todo/src/main/java/com/vayunmathur/todo/notifications/ReminderActionReceiver.kt+++ b/todo/src/main/java/com/vayunmathur/todo/notifications/ReminderActionReceiver.kt@@ -43,6 +43,7 @@ class ReminderActionReceiver : BroadcastReceiver() {         else -> now + HOUR_MS     } +    /** Notification action names, extras and snooze options for reminder actions. */     companion object {         const val ACTION_COMPLETE = "com.vayunmathur.todo.action.COMPLETE"         const val ACTION_SNOOZE = "com.vayunmathur.todo.action.SNOOZE"
todo/src/main/java/com/vayunmathur/todo/platform/AppBackupAgent.kt
diff --git a/todo/src/main/java/com/vayunmathur/todo/platform/AppBackupAgent.kt b/todo/src/main/java/com/vayunmathur/todo/platform/AppBackupAgent.ktindex 9d7adace92..4329d76370 100644--- a/todo/src/main/java/com/vayunmathur/todo/platform/AppBackupAgent.kt+++ b/todo/src/main/java/com/vayunmathur/todo/platform/AppBackupAgent.kt@@ -5,6 +5,7 @@ import com.vayunmathur.library.util.BaseBackupAgent import com.vayunmathur.todo.data.todoDbConfigs import java.io.File +/** Android backup agent that backs up the encrypted todo database with the shared database configs. */ class AppBackupAgent : BaseBackupAgent() {     override val dbCodec = SqlCipherDbCodec 
todo/src/main/java/com/vayunmathur/todo/platform/IntentRouter.kt
diff --git a/todo/src/main/java/com/vayunmathur/todo/platform/IntentRouter.kt b/todo/src/main/java/com/vayunmathur/todo/platform/IntentRouter.ktindex f9316b4336..a97e7f55d4 100644--- a/todo/src/main/java/com/vayunmathur/todo/platform/IntentRouter.kt+++ b/todo/src/main/java/com/vayunmathur/todo/platform/IntentRouter.kt@@ -13,8 +13,11 @@ object IntentRouter {     const val EXTRA_VIEW = "com.vayunmathur.todo.extra.VIEW"     const val ACTION_QUICK_ADD = "com.vayunmathur.todo.action.QUICK_ADD" +    /** What an incoming intent asks the UI to do. */     sealed interface Request {+        /** Open the task identified by its sync id. */         data class OpenTask(val syncId: String) : Request+        /** Open the view identified by its stable view key. */         data class OpenView(val viewKey: String) : Request          /** A new task; [text] pre-fills quick add, several lines become several tasks. */
todo/src/main/java/com/vayunmathur/todo/platform/TodoEditor.kt
diff --git a/todo/src/main/java/com/vayunmathur/todo/platform/TodoEditor.kt b/todo/src/main/java/com/vayunmathur/todo/platform/TodoEditor.ktindex 1fbeabdac0..d635798926 100644--- a/todo/src/main/java/com/vayunmathur/todo/platform/TodoEditor.kt+++ b/todo/src/main/java/com/vayunmathur/todo/platform/TodoEditor.kt@@ -154,6 +154,7 @@ class TodoEditor internal constructor(         }     } +    /** Editor timing constants, including the save debounce. */     companion object {         const val SAVE_DEBOUNCE_MS = 300L     }
todo/src/main/java/com/vayunmathur/todo/platform/TodoEditorUiContract.kt
diff --git a/todo/src/main/java/com/vayunmathur/todo/platform/TodoEditorUiContract.kt b/todo/src/main/java/com/vayunmathur/todo/platform/TodoEditorUiContract.ktindex 283d31d397..30a48900c1 100644--- a/todo/src/main/java/com/vayunmathur/todo/platform/TodoEditorUiContract.kt+++ b/todo/src/main/java/com/vayunmathur/todo/platform/TodoEditorUiContract.kt@@ -32,6 +32,7 @@ interface TodoActions {     fun duplicate() {}     fun deleteTodo() {} +    /** Shared no-op TodoActions instance for previews. */     companion object {         val Noop: TodoActions = object : TodoActions {}     }
todo/src/main/java/com/vayunmathur/todo/platform/TodoListUiContract.kt
diff --git a/todo/src/main/java/com/vayunmathur/todo/platform/TodoListUiContract.kt b/todo/src/main/java/com/vayunmathur/todo/platform/TodoListUiContract.ktindex 052492236d..8279b2ad18 100644--- a/todo/src/main/java/com/vayunmathur/todo/platform/TodoListUiContract.kt+++ b/todo/src/main/java/com/vayunmathur/todo/platform/TodoListUiContract.kt@@ -50,6 +50,7 @@ interface TodoListActions {     fun reschedule(todos: List<Todo>, dueAt: Long?) {}     fun setPriority(todos: List<Todo>, priority: Int) {} +    /** Shared no-op TodoListActions instance for previews. */     companion object {         val Noop: TodoListActions = object : TodoListActions {}     }
todo/src/main/java/com/vayunmathur/todo/platform/TodoViewModel.kt
diff --git a/todo/src/main/java/com/vayunmathur/todo/platform/TodoViewModel.kt b/todo/src/main/java/com/vayunmathur/todo/platform/TodoViewModel.ktindex 14410c33b0..a3be20a2f7 100644--- a/todo/src/main/java/com/vayunmathur/todo/platform/TodoViewModel.kt+++ b/todo/src/main/java/com/vayunmathur/todo/platform/TodoViewModel.kt@@ -37,6 +37,7 @@ import kotlinx.coroutines.flow.stateIn import kotlinx.coroutines.launch import kotlinx.datetime.TimeZone +/** View model owning list state, counts, settings and task mutations for the todo screens. */ class TodoViewModel(     application: Application,     private val repository: TodoRepository,@@ -246,6 +247,7 @@ class TodoViewModel(         return TodoEditor(repository, repository.appScope, id, newSyncId, template)     } +    /** Saved-state keys, timing constants and the view-model factory. */     companion object {         private const val KEY_QUERY = "search_query"         private const val KEY_SORT = "sort"
todo/src/main/java/com/vayunmathur/todo/sync/RelayTodoProvider.kt
diff --git a/todo/src/main/java/com/vayunmathur/todo/sync/RelayTodoProvider.kt b/todo/src/main/java/com/vayunmathur/todo/sync/RelayTodoProvider.ktindex c871ced8e4..ec54ab52c6 100644--- a/todo/src/main/java/com/vayunmathur/todo/sync/RelayTodoProvider.kt+++ b/todo/src/main/java/com/vayunmathur/todo/sync/RelayTodoProvider.kt@@ -54,6 +54,7 @@ import kotlinx.coroutines.runBlocking  */ class RelayTodoProvider : ContentProvider() { +    /** Relay provider authority, permission, column names and URI routing for the everysync app. */     companion object {         const val AUTHORITY = "com.vayunmathur.todo.relay"         const val PERMISSION = "com.vayunmathur.todo.permission.RELAY"
todo/src/main/java/com/vayunmathur/todo/ui/SettingsScreen.kt
diff --git a/todo/src/main/java/com/vayunmathur/todo/ui/SettingsScreen.kt b/todo/src/main/java/com/vayunmathur/todo/ui/SettingsScreen.ktindex 56e5d2020a..92da8bbfaf 100644--- a/todo/src/main/java/com/vayunmathur/todo/ui/SettingsScreen.kt+++ b/todo/src/main/java/com/vayunmathur/todo/ui/SettingsScreen.kt@@ -22,6 +22,7 @@ data class SettingsUiState(     val lists: List<TodoList> = emptyList(), ) +/** Callbacks for the settings screen; no-op defaults let previews render without behaviour. */ interface SettingsActions {     fun back() {}     fun setDefaultView(view: TodoView) {}
todo/src/main/java/com/vayunmathur/todo/ui/TodoEmptyState.kt
diff --git a/todo/src/main/java/com/vayunmathur/todo/ui/TodoEmptyState.kt b/todo/src/main/java/com/vayunmathur/todo/ui/TodoEmptyState.ktindex 196bb229d6..a8d49a57df 100644--- a/todo/src/main/java/com/vayunmathur/todo/ui/TodoEmptyState.kt+++ b/todo/src/main/java/com/vayunmathur/todo/ui/TodoEmptyState.kt@@ -18,6 +18,7 @@ import com.vayunmathur.library.ui.MaterialTheme import com.vayunmathur.library.ui.Text import com.vayunmathur.todo.R +/** Which empty state to show: no tasks yet, no search matches, or everything completed. */ enum class EmptyKind { NOTHING, SEARCH, ALL_DONE }  @Composable
todo/src/main/java/com/vayunmathur/todo/ui/ViewDrawerContent.kt
diff --git a/todo/src/main/java/com/vayunmathur/todo/ui/ViewDrawerContent.kt b/todo/src/main/java/com/vayunmathur/todo/ui/ViewDrawerContent.ktindex 8ab3984821..1ebed0520a 100644--- a/todo/src/main/java/com/vayunmathur/todo/ui/ViewDrawerContent.kt+++ b/todo/src/main/java/com/vayunmathur/todo/ui/ViewDrawerContent.kt@@ -42,6 +42,7 @@ data class DrawerUiState(     val syncStatus: String? = null, ) +/** Callbacks for the view drawer; no-op defaults let previews render without behaviour. */ interface DrawerActions {     fun select(view: TodoView) {}     fun newList() {}
todo/src/main/java/com/vayunmathur/todo/widget/QuickAddWidgetReceiver.kt
diff --git a/todo/src/main/java/com/vayunmathur/todo/widget/QuickAddWidgetReceiver.kt b/todo/src/main/java/com/vayunmathur/todo/widget/QuickAddWidgetReceiver.ktindex d06ceae06e..82d015c0b2 100644--- a/todo/src/main/java/com/vayunmathur/todo/widget/QuickAddWidgetReceiver.kt+++ b/todo/src/main/java/com/vayunmathur/todo/widget/QuickAddWidgetReceiver.kt@@ -2,6 +2,7 @@ package com.vayunmathur.todo.widget  import com.vayunmathur.library.widgets.MaWidgetReceiver +/** Glance receiver that hosts the quick-add home-screen widget. */ class QuickAddWidgetReceiver : MaWidgetReceiver<QuickAddWidget>(     widgetClass = QuickAddWidget::class,     receiverClass = QuickAddWidgetReceiver::class,
todo/src/main/java/com/vayunmathur/todo/widget/TodayWidget.kt
diff --git a/todo/src/main/java/com/vayunmathur/todo/widget/TodayWidget.kt b/todo/src/main/java/com/vayunmathur/todo/widget/TodayWidget.ktindex 468ce118c0..6975bd01be 100644--- a/todo/src/main/java/com/vayunmathur/todo/widget/TodayWidget.kt+++ b/todo/src/main/java/com/vayunmathur/todo/widget/TodayWidget.kt@@ -47,8 +47,10 @@ import kotlinx.datetime.TimeZone /** Open tasks due today or overdue, as the Today view shows them. */ data class TodayWidgetData(val rows: List<TodayWidgetRow>) +/** One row in the Today widget: the task sync id, title and whether it is overdue. */ data class TodayWidgetRow(val syncId: String, val title: String, val overdue: Boolean) +/** Home-screen widget listing open tasks due today or overdue, with in-widget completion. */ class TodayWidget : MaWidget<TodayWidgetData>() {     override suspend fun loadData(context: Context, id: GlanceId): TodayWidgetData {         val repo = TodoRepository.get(context)@@ -158,6 +160,7 @@ class CompleteTaskAction : ActionCallback {         if (!todo.done) repo.setDone(todo, true)     } +    /** Action parameter key carrying the sync id of the task to complete from the widget. */     companion object {         val SYNC_ID = ActionParameters.Key<String>("sync_id")     }
todo/src/main/java/com/vayunmathur/todo/widget/TodayWidgetReceiver.kt
diff --git a/todo/src/main/java/com/vayunmathur/todo/widget/TodayWidgetReceiver.kt b/todo/src/main/java/com/vayunmathur/todo/widget/TodayWidgetReceiver.ktindex fba54ebffd..20bca08780 100644--- a/todo/src/main/java/com/vayunmathur/todo/widget/TodayWidgetReceiver.kt+++ b/todo/src/main/java/com/vayunmathur/todo/widget/TodayWidgetReceiver.kt@@ -2,6 +2,7 @@ package com.vayunmathur.todo.widget  import com.vayunmathur.library.widgets.MaWidgetReceiver +/** Glance receiver that hosts the Today widget and refreshes it when the date changes. */ class TodayWidgetReceiver : MaWidgetReceiver<TodayWidget>(     widgetClass = TodayWidget::class,     receiverClass = TodayWidgetReceiver::class,