diff --git a/MinimalBible/src/org/bspeice/minimalbible/activities/downloader/ActivityDownloaderModule.java b/MinimalBible/src/org/bspeice/minimalbible/activities/downloader/ActivityDownloaderModule.java index e04bce2..c7dd3c7 100644 --- a/MinimalBible/src/org/bspeice/minimalbible/activities/downloader/ActivityDownloaderModule.java +++ b/MinimalBible/src/org/bspeice/minimalbible/activities/downloader/ActivityDownloaderModule.java @@ -1,8 +1,5 @@ package org.bspeice.minimalbible.activities.downloader; -import android.app.Activity; -import android.content.Context; - import org.bspeice.minimalbible.MinimalBible; import org.bspeice.minimalbible.activities.downloader.manager.BookRefreshTask; import org.bspeice.minimalbible.activities.downloader.manager.DownloadManager; @@ -41,6 +38,7 @@ public class ActivityDownloaderModule { return new EventBus(); } + @Provides //@Singleton DownloadPrefs_ provideDownloadPrefs() { return new DownloadPrefs_(MinimalBible.getApplication()); diff --git a/MinimalBible/src/org/bspeice/minimalbible/activities/downloader/DownloadPrefs_.java b/MinimalBible/src/org/bspeice/minimalbible/activities/downloader/DownloadPrefs_.java new file mode 100644 index 0000000..4c8c71d --- /dev/null +++ b/MinimalBible/src/org/bspeice/minimalbible/activities/downloader/DownloadPrefs_.java @@ -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 + { + + + DownloadPrefsEditor_(SharedPreferences sharedPreferences) { + super(sharedPreferences); + } + + public BooleanPrefEditorField hasEnabledDownload() { + return booleanField("hasEnabledDownload"); + } + + public BooleanPrefEditorField showedDownloadDialog() { + return booleanField("showedDownloadDialog"); + } + + public LongPrefEditorField downloadRefreshedOn() { + return longField("downloadRefreshedOn"); + } + + } + +} diff --git a/MinimalBible/src/org/bspeice/minimalbible/activities/downloader/DownloadPrefs.java b/MinimalBible/src/org/bspeice/minimalbible/activities/downloader/_DownloadPrefs.java similarity index 72% rename from MinimalBible/src/org/bspeice/minimalbible/activities/downloader/DownloadPrefs.java rename to MinimalBible/src/org/bspeice/minimalbible/activities/downloader/_DownloadPrefs.java index 06ce475..45b76d4 100644 --- a/MinimalBible/src/org/bspeice/minimalbible/activities/downloader/DownloadPrefs.java +++ b/MinimalBible/src/org/bspeice/minimalbible/activities/downloader/_DownloadPrefs.java @@ -5,10 +5,11 @@ import org.androidannotations.annotations.sharedpreferences.DefaultLong; 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) -public interface DownloadPrefs { +public interface _DownloadPrefs { @DefaultBoolean(false) boolean hasEnabledDownload();