mirror of
https://github.com/MinimalBible/MinimalBible
synced 2025-07-01 05:45:58 -04:00
Handle navigating on clicking a search item
This commit is contained in:
@ -1,8 +1,17 @@
|
||||
package org.bspeice.minimalbible.activity.viewer
|
||||
|
||||
import org.crosswire.jsword.book.Book
|
||||
import org.crosswire.jsword.book.getVersification
|
||||
import org.crosswire.jsword.passage.Verse
|
||||
import org.crosswire.jsword.versification.BibleBook
|
||||
|
||||
/**
|
||||
* Created by bspeice on 11/26/14.
|
||||
*/
|
||||
data class BookScrollEvent(val b: BibleBook, val chapter: Int) {}
|
||||
data class BookScrollEvent(val b: BibleBook, val chapter: Int) {
|
||||
constructor(v: Verse) : this(v.getBook(), v.getChapter()) {
|
||||
}
|
||||
|
||||
constructor(b: Book, ordinal: Int) : this(b.getVersification().decodeOrdinal(ordinal)) {
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,27 @@
|
||||
package org.bspeice.minimalbible.activity.viewer
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import org.crosswire.jsword.passage.Verse
|
||||
|
||||
/**
|
||||
* Created by bspeice on 4/2/15.
|
||||
*/
|
||||
class ViewerIntent() {
|
||||
|
||||
companion object {
|
||||
val VERSE_RESULT_KEY = "VERSE_RESULT"
|
||||
|
||||
fun fromSearchResult(ctx: Context, verse: Verse): Intent {
|
||||
val i = Intent(ctx, javaClass<BibleViewer>())
|
||||
i.putExtra(VERSE_RESULT_KEY, verse.getOrdinal())
|
||||
return i
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to get the result of a search out of the intent
|
||||
* Returns -1 if no search result was found
|
||||
*/
|
||||
fun decodeSearchResult(i: Intent) = i.getIntExtra(VERSE_RESULT_KEY, -1)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user