Ugly hack to get everything working until Dagger issues resolved.

Dagger issue is being tracked here: https://github.com/square/dagger/issues/410
This commit is contained in:
Bradlee Speice 2014-05-10 19:09:21 -04:00
parent e88c68b1e3
commit 8b499b9215
3 changed files with 76 additions and 5 deletions

View File

@ -1,8 +1,5 @@
package org.bspeice.minimalbible.activities.downloader; package org.bspeice.minimalbible.activities.downloader;
import android.app.Activity;
import android.content.Context;
import org.bspeice.minimalbible.MinimalBible; import org.bspeice.minimalbible.MinimalBible;
import org.bspeice.minimalbible.activities.downloader.manager.BookRefreshTask; import org.bspeice.minimalbible.activities.downloader.manager.BookRefreshTask;
import org.bspeice.minimalbible.activities.downloader.manager.DownloadManager; import org.bspeice.minimalbible.activities.downloader.manager.DownloadManager;
@ -41,6 +38,7 @@ public class ActivityDownloaderModule {
return new EventBus(); return new EventBus();
} }
@Provides //@Singleton @Provides //@Singleton
DownloadPrefs_ provideDownloadPrefs() { DownloadPrefs_ provideDownloadPrefs() {
return new DownloadPrefs_(MinimalBible.getApplication()); return new DownloadPrefs_(MinimalBible.getApplication());

View File

@ -0,0 +1,72 @@
/*
This is brutally ugly, but until https://github.com/square/dagger/issues/410 is resolved,
this is the best I can do while making sure that I can refactor the API later.
*/
//
// DO NOT EDIT THIS FILE, IT HAS BEEN GENERATED USING AndroidAnnotations 3.0.1.
//
package org.bspeice.minimalbible.activities.downloader;
import android.content.Context;
import android.content.SharedPreferences;
import org.androidannotations.api.sharedpreferences.BooleanPrefEditorField;
import org.androidannotations.api.sharedpreferences.BooleanPrefField;
import org.androidannotations.api.sharedpreferences.EditorHelper;
import org.androidannotations.api.sharedpreferences.LongPrefEditorField;
import org.androidannotations.api.sharedpreferences.LongPrefField;
import org.androidannotations.api.sharedpreferences.SharedPreferencesHelper;
public final class DownloadPrefs_
extends SharedPreferencesHelper
{
private Context context_;
public DownloadPrefs_(Context context) {
super(context.getSharedPreferences("DownloadPrefs", 0));
this.context_ = context;
}
public DownloadPrefs_.DownloadPrefsEditor_ edit() {
return new DownloadPrefs_.DownloadPrefsEditor_(getSharedPreferences());
}
public BooleanPrefField hasEnabledDownload() {
return booleanField("hasEnabledDownload", false);
}
public BooleanPrefField showedDownloadDialog() {
return booleanField("showedDownloadDialog", false);
}
public LongPrefField downloadRefreshedOn() {
return longField("downloadRefreshedOn", 0L);
}
public final static class DownloadPrefsEditor_
extends EditorHelper<DownloadPrefs_.DownloadPrefsEditor_>
{
DownloadPrefsEditor_(SharedPreferences sharedPreferences) {
super(sharedPreferences);
}
public BooleanPrefEditorField<DownloadPrefs_.DownloadPrefsEditor_> hasEnabledDownload() {
return booleanField("hasEnabledDownload");
}
public BooleanPrefEditorField<DownloadPrefs_.DownloadPrefsEditor_> showedDownloadDialog() {
return booleanField("showedDownloadDialog");
}
public LongPrefEditorField<DownloadPrefs_.DownloadPrefsEditor_> downloadRefreshedOn() {
return longField("downloadRefreshedOn");
}
}
}

View File

@ -5,10 +5,11 @@ import org.androidannotations.annotations.sharedpreferences.DefaultLong;
import org.androidannotations.annotations.sharedpreferences.SharedPref; import org.androidannotations.annotations.sharedpreferences.SharedPref;
/** /**
* Created by Bradlee Speice on 5/8/2014. * Renamed while waiting for https://github.com/square/dagger/issues/410 to get resolved.
* Once the issue is fixed, this should go back to being DownloadPrefs
*/ */
@SharedPref(value= SharedPref.Scope.UNIQUE) @SharedPref(value= SharedPref.Scope.UNIQUE)
public interface DownloadPrefs { public interface _DownloadPrefs {
@DefaultBoolean(false) @DefaultBoolean(false)
boolean hasEnabledDownload(); boolean hasEnabledDownload();