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 31c06c1..192f920 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 @@ -22,8 +22,10 @@ import javax.inject.Named; import butterknife.ButterKnife; import butterknife.InjectView; +import rx.Observable; import rx.android.schedulers.AndroidSchedulers; import rx.functions.Action1; +import rx.schedulers.Schedulers; import rx.subjects.PublishSubject; /** @@ -98,7 +100,8 @@ public class BookFragment extends BaseFragment { Log.d("BookFragment", b.getName()); ((BibleViewer)getActivity()).setActionBarTitle(b.getInitials()); - bookContent.setLayoutManager(new LinearLayoutManager(getActivity())); + final RecyclerView.LayoutManager manager = new LinearLayoutManager(getActivity()); + bookContent.setLayoutManager(manager); bookContent.setAdapter(new BookAdapter(b)); } } diff --git a/app/src/main/kotlin/org/bspeice/minimalbible/activity/viewer/BookAdapter.kt b/app/src/main/kotlin/org/bspeice/minimalbible/activity/viewer/BookAdapter.kt index b7d7a0e..10d0abc 100644 --- a/app/src/main/kotlin/org/bspeice/minimalbible/activity/viewer/BookAdapter.kt +++ b/app/src/main/kotlin/org/bspeice/minimalbible/activity/viewer/BookAdapter.kt @@ -9,6 +9,7 @@ import android.view.LayoutInflater import org.bspeice.minimalbible.R import android.widget.TextView import org.bspeice.minimalbible.service.format.osisparser.OsisParser +import org.crosswire.jsword.book.getVersification /** * Adapter used for displaying a book @@ -41,7 +42,8 @@ class BookAdapter(val b: Book) : RecyclerView.Adapter() { /** * Get the number of chapters in the book */ - override fun getItemCount(): Int = 800 + override fun getItemCount(): Int = b.getVersification() + .getAllVerses().getEnd().getOrdinal() } class PassageView(val _v: View) : RecyclerView.ViewHolder(_v) {