diff --git a/app/src/main/java/org/bspeice/minimalbible/activity/viewer/BibleViewer.java b/app/src/main/java/org/bspeice/minimalbible/activity/viewer/BibleViewer.java index 76fda11..6a543a3 100644 --- a/app/src/main/java/org/bspeice/minimalbible/activity/viewer/BibleViewer.java +++ b/app/src/main/java/org/bspeice/minimalbible/activity/viewer/BibleViewer.java @@ -25,9 +25,15 @@ public class BibleViewer extends BaseActivity implements Injector { @Named("MainBook") Book mainBook; + @Inject + BibleViewerPreferences prefs; + @InjectView(R.id.navigation_drawer) BibleMenu bibleMenu; + @InjectView(R.id.content) + BibleView bibleContent; + @InjectView(R.id.toolbar) Toolbar toolbar; @@ -78,5 +84,7 @@ public class BibleViewer extends BaseActivity implements Injector { setSupportActionBar(toolbar); bibleMenu.setBible(mainBook); setInsets(this, bibleMenu); + + bibleContent.setBook(mainBook, prefs); } } 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 13ed5e7..a1154d3 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 @@ -92,20 +92,4 @@ public class BibleViewerModules { BookManager bookManager() { return new BookManager(); } - - /* - Commenting, as I will likely need these in the near future. - @Provides - @Named("MainAdapter") - @Singleton - BookAdapter bookAdapter(@Named("MainBook") Book b, BibleViewerPreferences prefs) { - return new BookAdapter(b, prefs); - } - - @Provides - @Singleton - PublishSubject scrollEventProvider() { - return PublishSubject.create(); - } - */ } \ No newline at end of file diff --git a/app/src/main/kotlin/org/bspeice/minimalbible/activity/viewer/BookAdapter.kt b/app/src/main/kotlin/org/bspeice/minimalbible/activity/viewer/BibleView.kt similarity index 85% rename from app/src/main/kotlin/org/bspeice/minimalbible/activity/viewer/BookAdapter.kt rename to app/src/main/kotlin/org/bspeice/minimalbible/activity/viewer/BibleView.kt index 1ddcc40..05b5057 100644 --- a/app/src/main/kotlin/org/bspeice/minimalbible/activity/viewer/BookAdapter.kt +++ b/app/src/main/kotlin/org/bspeice/minimalbible/activity/viewer/BibleView.kt @@ -15,6 +15,28 @@ import android.text.SpannableStringBuilder import android.util.TypedValue import org.bspeice.minimalbible.service.format.osisparser.OsisParser import android.util.Log +import android.content.Context +import android.util.AttributeSet +import kotlin.properties.Delegates +import android.support.v7.widget.LinearLayoutManager +import android.widget.LinearLayout + +class BibleView(val ctx: Context, val attrs: AttributeSet) : LinearLayout(ctx, attrs) { + var bibleContent: RecyclerView by Delegates.notNull(); + + { + val inflater = ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater + // Don't attach yet, as we haven't finished setup + val rootView = inflater.inflate(R.layout.view_bible, this, true) + + bibleContent = rootView.findViewById(R.id.bible_content) as RecyclerView + bibleContent setLayoutManager LinearLayoutManager(ctx) + } + + fun setBook(b: Book, prefs: BibleViewerPreferences) { + bibleContent setAdapter BookAdapter(b, prefs) + } +} /** * Adapter used for displaying a book diff --git a/app/src/main/res/layout/activity_bible_viewer.xml b/app/src/main/res/layout/activity_bible_viewer.xml index 98a4f30..2b9448a 100644 --- a/app/src/main/res/layout/activity_bible_viewer.xml +++ b/app/src/main/res/layout/activity_bible_viewer.xml @@ -21,10 +21,10 @@ android:background="@color/colorPrimary" android:minHeight="?attr/actionBarSize" /> - + diff --git a/app/src/main/res/layout/view_bible.xml b/app/src/main/res/layout/view_bible.xml new file mode 100644 index 0000000..a3f863c --- /dev/null +++ b/app/src/main/res/layout/view_bible.xml @@ -0,0 +1,11 @@ + + + + + + diff --git a/gradle.properties b/gradle.properties index 6dea0cb..8585542 100644 --- a/gradle.properties +++ b/gradle.properties @@ -18,4 +18,4 @@ org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryErro # org.gradle.parallel=true # Use the build daemon -org.gradle.daemon=true +org.gradle.daemon=false