mirror of
https://github.com/beemdevelopment/Aegis.git
synced 2025-06-10 00:27:49 +00:00
Use Dagger Hilt for dependency injection
This gets rid of our own janky dependency injection through the AegisApplication class
This commit is contained in:
parent
927f5f2bd5
commit
71f2b54deb
42 changed files with 1157 additions and 977 deletions
35
app/src/main/java/com/beemdevelopment/aegis/AegisModule.java
Normal file
35
app/src/main/java/com/beemdevelopment/aegis/AegisModule.java
Normal file
|
@ -0,0 +1,35 @@
|
|||
package com.beemdevelopment.aegis;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.beemdevelopment.aegis.icons.IconPackManager;
|
||||
import com.beemdevelopment.aegis.vault.VaultManager;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import dagger.Module;
|
||||
import dagger.Provides;
|
||||
import dagger.hilt.InstallIn;
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext;
|
||||
import dagger.hilt.components.SingletonComponent;
|
||||
|
||||
@Module
|
||||
@InstallIn(SingletonComponent.class)
|
||||
public class AegisModule {
|
||||
@Provides
|
||||
@Singleton
|
||||
public static IconPackManager provideIconPackManager(@ApplicationContext Context context) {
|
||||
return new IconPackManager(context);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
public static VaultManager provideVaultManager(@ApplicationContext Context context) {
|
||||
return new VaultManager(context);
|
||||
}
|
||||
|
||||
@Provides
|
||||
public static Preferences providePreferences(@ApplicationContext Context context) {
|
||||
return new Preferences(context);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue