Refactor out some dependencies

This commit is contained in:
Bradlee Speice 2014-11-26 23:27:30 -05:00
parent 66076c759a
commit ee62ddb707
3 changed files with 11 additions and 5 deletions

View File

@ -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<BookScrollEvent> scrollEventProvider() {

View File

@ -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<BookScrollEvent> 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);

View File

@ -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