mirror of
https://github.com/MinimalBible/MinimalBible
synced 2024-11-05 07:38:20 -05:00
Autoscroll to the last chapter
Currently uses the last chapter loaded, not the last chapter on screen, so may not be 100% accurate. Resolves issue #7.
This commit is contained in:
parent
9898fe0a2f
commit
b1ecf8a404
@ -17,4 +17,8 @@ public interface BibleViewerPreferences {
|
|||||||
int baseTextSize();
|
int baseTextSize();
|
||||||
|
|
||||||
void baseTextSize(int baseTextSize);
|
void baseTextSize(int baseTextSize);
|
||||||
|
|
||||||
|
int currentChapter();
|
||||||
|
|
||||||
|
void currentChapter(int currentChapter);
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,7 @@ class BibleView(val ctx: Context, val attrs: AttributeSet) : LinearLayout(ctx, a
|
|||||||
val adapter = BookAdapter(b, prefs)
|
val adapter = BookAdapter(b, prefs)
|
||||||
adapter.bindScrollHandler(scrollPublisher, layoutManager)
|
adapter.bindScrollHandler(scrollPublisher, layoutManager)
|
||||||
bibleContent setAdapter adapter
|
bibleContent setAdapter adapter
|
||||||
|
bibleContent scrollToPosition prefs.currentChapter()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,8 +111,10 @@ class BookAdapter(val b: Book, val prefs: BibleViewerPreferences)
|
|||||||
/**
|
/**
|
||||||
* Bind an existing view to its chapter content
|
* Bind an existing view to its chapter content
|
||||||
*/
|
*/
|
||||||
override fun onBindViewHolder(view: PassageView, position: Int) =
|
override fun onBindViewHolder(view: PassageView, position: Int) {
|
||||||
view bind chapterList[position]
|
prefs.currentChapter(position)
|
||||||
|
return view bind chapterList[position]
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the number of chapters in the book
|
* Get the number of chapters in the book
|
||||||
|
Loading…
Reference in New Issue
Block a user