Injected the CategoryDao where needed.

This commit is contained in:
Paul Hawke 2018-01-04 21:45:44 -06:00
parent feb435304f
commit 1d3befcbd2
4 changed files with 35 additions and 19 deletions

View file

@ -1,5 +1,6 @@
package fr.free.nrw.commons.di;
import android.content.ContentProviderClient;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.support.v4.util.LruCache;
@ -26,6 +27,8 @@ import static android.content.Context.MODE_PRIVATE;
@Module
@SuppressWarnings({"WeakerAccess", "unused"})
public class CommonsApplicationModule {
public static final String CATEGORY_AUTHORITY = "fr.free.nrw.commons.categories.contentprovider";
private CommonsApplication application;
public CommonsApplicationModule(CommonsApplication application) {
@ -37,6 +40,12 @@ public class CommonsApplicationModule {
return new AccountUtil(application);
}
@Provides
@Named("category")
public ContentProviderClient provideContentProviderClient() {
return application.getContentResolver().acquireContentProviderClient(CATEGORY_AUTHORITY);
}
@Provides
@Named("application_preferences")
public SharedPreferences providesApplicationSharedPreferences() {