Main content now working correctly

This commit is contained in:
Bradlee Speice 2014-12-22 23:22:59 -05:00
parent 21f940d767
commit 21730b7db6
6 changed files with 46 additions and 21 deletions

View File

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

View File

@ -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<BookScrollEvent> scrollEventProvider() {
return PublishSubject.create();
}
*/
}

View File

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

View File

@ -21,10 +21,10 @@
android:background="@color/colorPrimary"
android:minHeight="?attr/actionBarSize" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Main Content" />
<org.bspeice.minimalbible.activity.viewer.BibleView
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
<!-- Navigation drawer - layout_gravity:start activates the magic. -->

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/bible_content"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>

View File

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