Creating the Habitgroup model

This commit is contained in:
Dharanish
2024-05-26 10:02:43 +02:00
parent 340bde9f69
commit 73387e5e63
15 changed files with 709 additions and 19 deletions

View File

@@ -79,6 +79,10 @@ class HabitsApplication : Application() {
val habitList = component.habitList
for (h in habitList) h.recompute()
val habitGroupList = component.habitGroupList
for (hgr in habitGroupList) hgr.recompute()
habitGroupList.populateGroupsWith(habitList)
widgetUpdater = component.widgetUpdater.apply {
startListening()
scheduleStartDayWidgetUpdate()

View File

@@ -24,6 +24,7 @@ import org.isoron.uhabits.core.AppScope
import org.isoron.uhabits.core.commands.CommandRunner
import org.isoron.uhabits.core.io.GenericImporter
import org.isoron.uhabits.core.io.Logging
import org.isoron.uhabits.core.models.HabitGroupList
import org.isoron.uhabits.core.models.HabitList
import org.isoron.uhabits.core.models.ModelFactory
import org.isoron.uhabits.core.preferences.Preferences
@@ -50,6 +51,7 @@ interface HabitsApplicationComponent {
val genericImporter: GenericImporter
val habitCardListCache: HabitCardListCache
val habitList: HabitList
val habitGroupList: HabitGroupList
val intentFactory: IntentFactory
val intentParser: IntentParser
val logging: Logging

View File

@@ -26,9 +26,11 @@ import org.isoron.uhabits.core.commands.CommandRunner
import org.isoron.uhabits.core.database.Database
import org.isoron.uhabits.core.database.DatabaseOpener
import org.isoron.uhabits.core.io.Logging
import org.isoron.uhabits.core.models.HabitGroupList
import org.isoron.uhabits.core.models.HabitList
import org.isoron.uhabits.core.models.ModelFactory
import org.isoron.uhabits.core.models.sqlite.SQLModelFactory
import org.isoron.uhabits.core.models.sqlite.SQLiteHabitGroupList
import org.isoron.uhabits.core.models.sqlite.SQLiteHabitList
import org.isoron.uhabits.core.preferences.Preferences
import org.isoron.uhabits.core.preferences.WidgetPreferences
@@ -97,6 +99,12 @@ class HabitsModule(dbFile: File) {
return list
}
@Provides
@AppScope
fun getHabitGroupList(list: SQLiteHabitGroupList): HabitGroupList {
return list
}
@Provides
@AppScope
fun getDatabaseOpener(opener: AndroidDatabaseOpener): DatabaseOpener {