diff --git a/uhabits-android/src/main/java/org/isoron/uhabits/inject/AppContextModule.java b/uhabits-android/src/main/java/org/isoron/uhabits/inject/ActivityContextModule.kt
similarity index 67%
rename from uhabits-android/src/main/java/org/isoron/uhabits/inject/AppContextModule.java
rename to uhabits-android/src/main/java/org/isoron/uhabits/inject/ActivityContextModule.kt
index 307cac9af..89efc00af 100644
--- a/uhabits-android/src/main/java/org/isoron/uhabits/inject/AppContextModule.java
+++ b/uhabits-android/src/main/java/org/isoron/uhabits/inject/ActivityContextModule.kt
@@ -16,28 +16,14 @@
* You should have received a copy of the GNU General Public License along
* with this program. If not, see .
*/
+package org.isoron.uhabits.inject
-package org.isoron.uhabits.inject;
-
-import android.content.Context;
-
-import dagger.Module;
-import dagger.Provides;
+import android.content.Context
+import dagger.Module
+import dagger.Provides
@Module
-public class AppContextModule
-{
- private final Context context;
-
- public AppContextModule(@AppContext Context context)
- {
- this.context = context;
- }
-
- @Provides
- @AppContext
- Context getContext()
- {
- return context;
- }
-}
+class ActivityContextModule(
+ @get:Provides
+ @get:ActivityContext val context: Context
+)
diff --git a/uhabits-android/src/main/java/org/isoron/uhabits/inject/ActivityContextModule.java b/uhabits-android/src/main/java/org/isoron/uhabits/inject/AppContextModule.kt
similarity index 67%
rename from uhabits-android/src/main/java/org/isoron/uhabits/inject/ActivityContextModule.java
rename to uhabits-android/src/main/java/org/isoron/uhabits/inject/AppContextModule.kt
index 919a0622d..74b433ea2 100644
--- a/uhabits-android/src/main/java/org/isoron/uhabits/inject/ActivityContextModule.java
+++ b/uhabits-android/src/main/java/org/isoron/uhabits/inject/AppContextModule.kt
@@ -16,29 +16,15 @@
* You should have received a copy of the GNU General Public License along
* with this program. If not, see .
*/
+package org.isoron.uhabits.inject
-package org.isoron.uhabits.inject;
-
-
-import android.content.Context;
-
-import dagger.Module;
-import dagger.Provides;
+import android.content.Context
+import dagger.Module
+import dagger.Provides
@Module
-public class ActivityContextModule
-{
- private Context context;
-
- public ActivityContextModule(Context context)
- {
- this.context = context;
- }
-
- @Provides
- @ActivityContext
- public Context getContext()
- {
- return context;
- }
-}
+class AppContextModule(
+ @get:Provides
+ @get:AppContext
+ @param:AppContext val context: Context
+)
diff --git a/uhabits-android/src/main/java/org/isoron/uhabits/inject/HabitsApplicationComponent.java b/uhabits-android/src/main/java/org/isoron/uhabits/inject/HabitsApplicationComponent.java
deleted file mode 100644
index dd4d27504..000000000
--- a/uhabits-android/src/main/java/org/isoron/uhabits/inject/HabitsApplicationComponent.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (C) 2016-2021 Álinson Santos Xavier
- *
- * This file is part of Loop Habit Tracker.
- *
- * Loop Habit Tracker is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or (at your
- * option) any later version.
- *
- * Loop Habit Tracker is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see .
- */
-
-package org.isoron.uhabits.inject;
-
-import android.content.*;
-
-import org.isoron.uhabits.core.*;
-import org.isoron.uhabits.core.commands.*;
-import org.isoron.uhabits.core.io.*;
-import org.isoron.uhabits.core.models.*;
-import org.isoron.uhabits.core.preferences.*;
-import org.isoron.uhabits.core.reminders.*;
-import org.isoron.uhabits.core.sync.*;
-import org.isoron.uhabits.core.tasks.*;
-import org.isoron.uhabits.core.ui.*;
-import org.isoron.uhabits.core.ui.screens.habits.list.*;
-import org.isoron.uhabits.core.utils.*;
-import org.isoron.uhabits.intents.*;
-import org.isoron.uhabits.receivers.*;
-import org.isoron.uhabits.tasks.*;
-import org.isoron.uhabits.widgets.*;
-
-import dagger.*;
-
-@AppScope
-@Component(modules = {
- AppContextModule.class,
- HabitsModule.class,
- AndroidTaskRunner.class,
-})
-public interface HabitsApplicationComponent
-{
- CommandRunner getCommandRunner();
-
- @AppContext
- Context getContext();
-
- GenericImporter getGenericImporter();
-
- HabitCardListCache getHabitCardListCache();
-
- HabitList getHabitList();
-
- IntentFactory getIntentFactory();
-
- IntentParser getIntentParser();
-
- Logging getLogging();
-
- MidnightTimer getMidnightTimer();
-
- ModelFactory getModelFactory();
-
- NotificationTray getNotificationTray();
-
- PendingIntentFactory getPendingIntentFactory();
-
- Preferences getPreferences();
-
- ReminderScheduler getReminderScheduler();
-
- ReminderController getReminderController();
-
- TaskRunner getTaskRunner();
-
- WidgetPreferences getWidgetPreferences();
-
- WidgetUpdater getWidgetUpdater();
-
- SyncManager getSyncManager();
-}
diff --git a/uhabits-android/src/main/java/org/isoron/uhabits/inject/HabitsApplicationComponent.kt b/uhabits-android/src/main/java/org/isoron/uhabits/inject/HabitsApplicationComponent.kt
new file mode 100644
index 000000000..49bb8d67f
--- /dev/null
+++ b/uhabits-android/src/main/java/org/isoron/uhabits/inject/HabitsApplicationComponent.kt
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2016-2021 Álinson Santos Xavier
+ *
+ * This file is part of Loop Habit Tracker.
+ *
+ * Loop Habit Tracker is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or (at your
+ * option) any later version.
+ *
+ * Loop Habit Tracker is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see .
+ */
+package org.isoron.uhabits.inject
+
+import android.content.Context
+import dagger.Component
+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.HabitList
+import org.isoron.uhabits.core.models.ModelFactory
+import org.isoron.uhabits.core.preferences.Preferences
+import org.isoron.uhabits.core.preferences.WidgetPreferences
+import org.isoron.uhabits.core.reminders.ReminderScheduler
+import org.isoron.uhabits.core.sync.SyncManager
+import org.isoron.uhabits.core.tasks.TaskRunner
+import org.isoron.uhabits.core.ui.NotificationTray
+import org.isoron.uhabits.core.ui.screens.habits.list.HabitCardListCache
+import org.isoron.uhabits.core.utils.MidnightTimer
+import org.isoron.uhabits.intents.IntentFactory
+import org.isoron.uhabits.intents.IntentParser
+import org.isoron.uhabits.intents.PendingIntentFactory
+import org.isoron.uhabits.receivers.ReminderController
+import org.isoron.uhabits.tasks.AndroidTaskRunner
+import org.isoron.uhabits.widgets.WidgetUpdater
+
+@AppScope
+@Component(modules = [AppContextModule::class, HabitsModule::class, AndroidTaskRunner::class])
+interface HabitsApplicationComponent {
+ val commandRunner: CommandRunner
+
+ @get:AppContext
+ val context: Context
+ val genericImporter: GenericImporter
+ val habitCardListCache: HabitCardListCache
+ val habitList: HabitList
+ val intentFactory: IntentFactory
+ val intentParser: IntentParser
+ val logging: Logging
+ val midnightTimer: MidnightTimer
+ val modelFactory: ModelFactory
+ val notificationTray: NotificationTray
+ val pendingIntentFactory: PendingIntentFactory
+ val preferences: Preferences
+ val reminderScheduler: ReminderScheduler
+ val reminderController: ReminderController
+ val taskRunner: TaskRunner
+ val widgetPreferences: WidgetPreferences
+ val widgetUpdater: WidgetUpdater
+ val syncManager: SyncManager
+}