From ee62ddb7075fba2fcd0d3729c78a2a6c22c45cbb Mon Sep 17 00:00:00 2001 From: Bradlee Speice Date: Wed, 26 Nov 2014 23:27:30 -0500 Subject: [PATCH] Refactor out some dependencies --- .../minimalbible/activity/viewer/BibleViewerModules.java | 7 +++++++ .../bspeice/minimalbible/activity/viewer/BookFragment.java | 5 ++--- .../minimalbible/service/format/osisparser/OsisParser.kt | 4 ++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/org/bspeice/minimalbible/activity/viewer/BibleViewerModules.java b/app/src/main/java/org/bspeice/minimalbible/activity/viewer/BibleViewerModules.java index ba6ca53..8550b22 100644 --- a/app/src/main/java/org/bspeice/minimalbible/activity/viewer/BibleViewerModules.java +++ b/app/src/main/java/org/bspeice/minimalbible/activity/viewer/BibleViewerModules.java @@ -103,6 +103,13 @@ public class BibleViewerModules { return new VerseLookup(b); } + @Provides + @Named("MainAdapter") + @Singleton + BookAdapter bookAdapter(@Named("MainBook") Book b, VerseLookup v) { + return new BookAdapter(b, v); + } + @Provides @Singleton PublishSubject scrollEventProvider() { diff --git a/app/src/main/java/org/bspeice/minimalbible/activity/viewer/BookFragment.java b/app/src/main/java/org/bspeice/minimalbible/activity/viewer/BookFragment.java index 7d31f27..8bf53b5 100644 --- a/app/src/main/java/org/bspeice/minimalbible/activity/viewer/BookFragment.java +++ b/app/src/main/java/org/bspeice/minimalbible/activity/viewer/BookFragment.java @@ -12,7 +12,6 @@ import android.view.ViewGroup; import org.bspeice.minimalbible.Injector; import org.bspeice.minimalbible.R; import org.bspeice.minimalbible.activity.BaseFragment; -import org.bspeice.minimalbible.service.lookup.VerseLookup; import org.crosswire.jsword.book.Book; import javax.inject.Inject; @@ -36,7 +35,8 @@ public class BookFragment extends BaseFragment { @Inject PublishSubject scrollEventProvider; @Inject - VerseLookup lookup; + @Named("MainAdapter") + BookAdapter adapter; @InjectView(R.id.book_content) RecyclerView bookContent; @@ -94,7 +94,6 @@ public class BookFragment extends BaseFragment { ((BibleViewer)getActivity()).setActionBarTitle(b.getInitials()); final RecyclerView.LayoutManager manager = new LinearLayoutManager(getActivity()); - BookAdapter adapter = new BookAdapter(b, lookup); bookContent.setLayoutManager(manager); bookContent.setAdapter(adapter); diff --git a/app/src/main/kotlin/org/bspeice/minimalbible/service/format/osisparser/OsisParser.kt b/app/src/main/kotlin/org/bspeice/minimalbible/service/format/osisparser/OsisParser.kt index 2197369..8305961 100644 --- a/app/src/main/kotlin/org/bspeice/minimalbible/service/format/osisparser/OsisParser.kt +++ b/app/src/main/kotlin/org/bspeice/minimalbible/service/format/osisparser/OsisParser.kt @@ -10,9 +10,9 @@ import org.crosswire.jsword.book.Book import kotlin.properties.Delegates /** - * Created by bspeice on 9/10/14. + * Parse out the OSIS XML into whatever we want! + * TODO: Speed up parsing. This is the single most expensive repeated operation */ - class OsisParser() : DefaultHandler() { // Don't pass a verse as part of the constructor, but still guarantee