mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 09:08:52 -06:00
Convert org.isoron.uhabits.inject
This commit is contained in:
@@ -16,28 +16,14 @@
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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
|
||||
)
|
||||
@@ -16,29 +16,15 @@
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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
|
||||
)
|
||||
@@ -1,88 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2016-2021 Álinson Santos Xavier <git@axavier.org>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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();
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* Copyright (C) 2016-2021 Álinson Santos Xavier <git@axavier.org>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user