mirror of
https://github.com/MinimalBible/MinimalBible
synced 2024-12-22 06:38:26 -05:00
Kotlin M11 updates
Looking forward to incorporating some of these things...
This commit is contained in:
parent
e552d4d5a6
commit
cbfd09ab66
@ -6,7 +6,6 @@ apply plugin: 'com.github.kt3k.coveralls'
|
|||||||
evaluationDependsOn(":app")
|
evaluationDependsOn(":app")
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '0.10.770'
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
@ -49,7 +48,7 @@ dependencies {
|
|||||||
testCompile 'org.robolectric:robolectric:2.+'
|
testCompile 'org.robolectric:robolectric:2.+'
|
||||||
testCompile 'org.mockito:mockito-core:+'
|
testCompile 'org.mockito:mockito-core:+'
|
||||||
testCompile 'com.jayway.awaitility:awaitility:+'
|
testCompile 'com.jayway.awaitility:awaitility:+'
|
||||||
testCompile 'org.jetbrains.spek:spek:+'
|
testCompile 'org.jetbrains.spek:spek:0.1-SNAPSHOT'
|
||||||
|
|
||||||
testCompile firstVariant.javaCompile.classpath
|
testCompile firstVariant.javaCompile.classpath
|
||||||
testCompile firstVariant.javaCompile.outputs.files
|
testCompile firstVariant.javaCompile.outputs.files
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
package org.bspeice.minimalbible.activity.downloader
|
package org.bspeice.minimalbible.activity.downloader
|
||||||
|
|
||||||
|
import android.content.DialogInterface
|
||||||
import org.jetbrains.spek.api.Spek
|
import org.jetbrains.spek.api.Spek
|
||||||
import kotlin.test.assertTrue
|
import kotlin.test.assertTrue
|
||||||
import android.content.DialogInterface
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by bspeice on 11/22/14.
|
* Created by bspeice on 11/22/14.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class BookListFragmentSpek : Spek() {{
|
class BookListFragmentSpek : Spek() {init {
|
||||||
|
|
||||||
given("A BookListFragment with showDialog() mocked out") {
|
given("A BookListFragment with showDialog() mocked out") {
|
||||||
val fragment = object : BookListFragment() {
|
val fragment = object : BookListFragment() {
|
||||||
|
@ -4,11 +4,12 @@
|
|||||||
|
|
||||||
import org.bspeice.minimalbible.activity.downloader.manager.DLProgressEvent
|
import org.bspeice.minimalbible.activity.downloader.manager.DLProgressEvent
|
||||||
import org.crosswire.jsword.book.Book
|
import org.crosswire.jsword.book.Book
|
||||||
import org.mockito.Mockito.mock
|
|
||||||
import org.jetbrains.spek.api.Spek
|
import org.jetbrains.spek.api.Spek
|
||||||
|
import org.mockito.Mockito.mock
|
||||||
import kotlin.test.assertEquals
|
import kotlin.test.assertEquals
|
||||||
|
|
||||||
class DLProgressEventSpek : Spek() {{
|
|
||||||
|
class DLProgressEventSpek : Spek() {init {
|
||||||
|
|
||||||
given("a DLProgressEvent created with 50% progress and a mock book") {
|
given("a DLProgressEvent created with 50% progress and a mock book") {
|
||||||
val mockBook = mock(javaClass<Book>())
|
val mockBook = mock(javaClass<Book>())
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
package org.bspeice.minimalbible.activity.downloader.manager
|
package org.bspeice.minimalbible.activity.downloader.manager
|
||||||
|
|
||||||
import org.jetbrains.spek.api.Spek
|
|
||||||
import org.crosswire.common.util.Language
|
import org.crosswire.common.util.Language
|
||||||
|
import org.jetbrains.spek.api.Spek
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by bspeice on 12/14/14.
|
* Created by bspeice on 12/14/14.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class LocaleManagerSpek() : Spek() {{
|
class LocaleManagerSpek() : Spek() {init {
|
||||||
|
|
||||||
given("some example language objects") {
|
given("some example language objects") {
|
||||||
val english = Language("en")
|
val english = Language("en")
|
||||||
|
@ -1,23 +1,23 @@
|
|||||||
package org.bspeice.minimalbible.activity.downloader.manager
|
package org.bspeice.minimalbible.activity.downloader.manager
|
||||||
|
|
||||||
import org.jetbrains.spek.api.Spek
|
|
||||||
import org.bspeice.minimalbible.activity.downloader.DownloadPrefs
|
|
||||||
import java.util.Calendar
|
|
||||||
import org.crosswire.jsword.book.install.Installer
|
|
||||||
import org.mockito.Mockito.*
|
|
||||||
import org.mockito.Matchers.*
|
|
||||||
import rx.schedulers.Schedulers
|
|
||||||
import java.util.concurrent.atomic.AtomicBoolean
|
|
||||||
import com.jayway.awaitility.Awaitility
|
import com.jayway.awaitility.Awaitility
|
||||||
import java.util.concurrent.TimeUnit
|
import org.bspeice.minimalbible.activity.downloader.DownloadPrefs
|
||||||
import rx.Subscriber
|
|
||||||
import org.crosswire.jsword.book.Book
|
import org.crosswire.jsword.book.Book
|
||||||
|
import org.crosswire.jsword.book.install.Installer
|
||||||
|
import org.jetbrains.spek.api.Spek
|
||||||
|
import org.mockito.Matchers.anyLong
|
||||||
|
import org.mockito.Mockito.*
|
||||||
|
import rx.Subscriber
|
||||||
|
import rx.schedulers.Schedulers
|
||||||
|
import java.util.Calendar
|
||||||
|
import java.util.concurrent.TimeUnit
|
||||||
|
import java.util.concurrent.atomic.AtomicBoolean
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by bspeice on 1/3/15.
|
* Created by bspeice on 1/3/15.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class RefreshManagerSpek() : Spek() {{
|
class RefreshManagerSpek() : Spek() {init {
|
||||||
|
|
||||||
fun buildRefreshmanager(installers: List<Installer>, prefs: DownloadPrefs) =
|
fun buildRefreshmanager(installers: List<Installer>, prefs: DownloadPrefs) =
|
||||||
RefreshManager(installers, listOf(""), prefs, null)
|
RefreshManager(installers, listOf(""), prefs, null)
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
package org.bspeice.minimalbible.activity.search
|
package org.bspeice.minimalbible.activity.search
|
||||||
|
|
||||||
|
import com.jayway.awaitility.Awaitility
|
||||||
|
import org.crosswire.jsword.book.Book
|
||||||
|
import org.crosswire.jsword.index.IndexManager
|
||||||
|
import org.crosswire.jsword.index.IndexStatus
|
||||||
import org.jetbrains.spek.api.Spek
|
import org.jetbrains.spek.api.Spek
|
||||||
import org.mockito.Mockito
|
import org.mockito.Mockito
|
||||||
import org.crosswire.jsword.index.IndexManager
|
import java.util.concurrent.TimeUnit
|
||||||
import org.crosswire.jsword.book.Book
|
|
||||||
import org.crosswire.jsword.index.IndexStatus
|
|
||||||
import java.util.concurrent.atomic.AtomicBoolean
|
import java.util.concurrent.atomic.AtomicBoolean
|
||||||
import java.util.concurrent.atomic.AtomicReference
|
import java.util.concurrent.atomic.AtomicReference
|
||||||
import kotlin.test.assertEquals
|
import kotlin.test.assertEquals
|
||||||
import com.jayway.awaitility.Awaitility
|
|
||||||
import java.util.concurrent.TimeUnit
|
|
||||||
import kotlin.test.assertTrue
|
|
||||||
import kotlin.test.assertFalse
|
import kotlin.test.assertFalse
|
||||||
|
import kotlin.test.assertTrue
|
||||||
import kotlin.test.fail
|
import kotlin.test.fail
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -23,7 +23,7 @@ data class Mocks() {
|
|||||||
val indexManager = MBIndexManager(mockIndex)
|
val indexManager = MBIndexManager(mockIndex)
|
||||||
}
|
}
|
||||||
|
|
||||||
class MBIndexManagerSpek() : Spek() {{
|
class MBIndexManagerSpek() : Spek() {init {
|
||||||
|
|
||||||
given("a mock IndexManager, Book, and real MBIndexManager") {
|
given("a mock IndexManager, Book, and real MBIndexManager") {
|
||||||
val mocks = Mocks()
|
val mocks = Mocks()
|
||||||
|
@ -2,6 +2,9 @@ buildscript {
|
|||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
|
@ -1,19 +1,14 @@
|
|||||||
package org.bspeice.minimalbible.activity.downloader.manager
|
package org.bspeice.minimalbible.activity.downloader.manager
|
||||||
|
|
||||||
import org.crosswire.common.progress.JobManager;
|
|
||||||
import org.crosswire.common.progress.WorkEvent;
|
|
||||||
import org.crosswire.common.progress.WorkListener;
|
|
||||||
import org.crosswire.jsword.book.Book;
|
|
||||||
import org.crosswire.jsword.book.Books;
|
|
||||||
import org.crosswire.jsword.book.BooksEvent;
|
|
||||||
import org.crosswire.jsword.book.BooksListener;
|
|
||||||
|
|
||||||
import rx.Observable;
|
|
||||||
import rx.schedulers.Schedulers;
|
|
||||||
import rx.subjects.PublishSubject;
|
|
||||||
import org.crosswire.jsword.book.BookException
|
|
||||||
import org.crosswire.common.progress.Progress
|
|
||||||
import org.bspeice.minimalbible.activity.search.MBIndexManager
|
import org.bspeice.minimalbible.activity.search.MBIndexManager
|
||||||
|
import org.crosswire.common.progress.JobManager
|
||||||
|
import org.crosswire.common.progress.Progress
|
||||||
|
import org.crosswire.common.progress.WorkEvent
|
||||||
|
import org.crosswire.common.progress.WorkListener
|
||||||
|
import org.crosswire.jsword.book.*
|
||||||
|
import rx.Observable
|
||||||
|
import rx.schedulers.Schedulers
|
||||||
|
import rx.subjects.PublishSubject
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Single point of authority for what is being downloaded and its progress
|
* Single point of authority for what is being downloaded and its progress
|
||||||
@ -27,7 +22,6 @@ class BookManager(private val installedBooks: Books,
|
|||||||
WorkListener, BooksListener {
|
WorkListener, BooksListener {
|
||||||
|
|
||||||
private val bookJobNamePrefix = Progress.INSTALL_BOOK.substringBeforeLast("%s")
|
private val bookJobNamePrefix = Progress.INSTALL_BOOK.substringBeforeLast("%s")
|
||||||
private val indexJobNamePrefix = Progress.DOWNLOAD_SEARCH_INDEX.substringBeforeLast("%s")
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* List of jobs currently active by their job name
|
* List of jobs currently active by their job name
|
||||||
@ -42,9 +36,9 @@ class BookManager(private val installedBooks: Books,
|
|||||||
/**
|
/**
|
||||||
* A list of books that is locally maintained - installedBooks isn't always up-to-date
|
* A list of books that is locally maintained - installedBooks isn't always up-to-date
|
||||||
*/
|
*/
|
||||||
val installedBooksList: MutableList<Book> = installedBooks.getBooks() ?: linkedListOf();
|
val installedBooksList: MutableList<Book> = installedBooks.getBooks() ?: linkedListOf()
|
||||||
|
|
||||||
{
|
init {
|
||||||
JobManager.addWorkListener(this)
|
JobManager.addWorkListener(this)
|
||||||
installedBooks.addBooksListener(this)
|
installedBooks.addBooksListener(this)
|
||||||
downloadEvents.subscribe { this.inProgressDownloads[it.b] = it }
|
downloadEvents.subscribe { this.inProgressDownloads[it.b] = it }
|
||||||
|
@ -7,7 +7,7 @@ import org.crosswire.jsword.book.Book
|
|||||||
*/
|
*/
|
||||||
data class DLProgressEvent(val progress: Int,
|
data class DLProgressEvent(val progress: Int,
|
||||||
val b: Book) {
|
val b: Book) {
|
||||||
class object {
|
companion object {
|
||||||
val PROGRESS_COMPLETE = 100
|
val PROGRESS_COMPLETE = 100
|
||||||
val PROGRESS_BEGINNING = 0
|
val PROGRESS_BEGINNING = 0
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package org.bspeice.minimalbible.activity.downloader.manager
|
package org.bspeice.minimalbible.activity.downloader.manager
|
||||||
|
|
||||||
import org.crosswire.common.util.Language
|
import org.crosswire.common.util.Language
|
||||||
import rx.Observable
|
|
||||||
import org.crosswire.jsword.book.BookCategory
|
import org.crosswire.jsword.book.BookCategory
|
||||||
|
import rx.Observable
|
||||||
import kotlin.platform.platformStatic
|
import kotlin.platform.platformStatic
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -38,7 +38,7 @@ class LocaleManager(val rM: RefreshManager) {
|
|||||||
// And flatten this into the actual List needed
|
// And flatten this into the actual List needed
|
||||||
.toBlocking().first()
|
.toBlocking().first()
|
||||||
|
|
||||||
class object {
|
companion object {
|
||||||
platformStatic
|
platformStatic
|
||||||
fun compareLanguages(left: Language, right: Language, current: Language) =
|
fun compareLanguages(left: Language, right: Language, current: Language) =
|
||||||
if (left == right)
|
if (left == right)
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
package org.bspeice.minimalbible.activity.search
|
package org.bspeice.minimalbible.activity.search
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.util.AttributeSet
|
|
||||||
import android.widget.LinearLayout
|
|
||||||
import android.support.v7.widget.RecyclerView
|
|
||||||
import android.support.v7.widget.LinearLayoutManager
|
import android.support.v7.widget.LinearLayoutManager
|
||||||
|
import android.support.v7.widget.RecyclerView
|
||||||
|
import android.util.AttributeSet
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import org.bspeice.minimalbible.R
|
import android.view.ViewGroup
|
||||||
import org.crosswire.jsword.passage.Verse
|
import android.widget.LinearLayout
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
|
import org.bspeice.minimalbible.R
|
||||||
import org.bspeice.minimalbible.service.format.osisparser.OsisParser
|
import org.bspeice.minimalbible.service.format.osisparser.OsisParser
|
||||||
import org.crosswire.jsword.book.Book
|
import org.crosswire.jsword.book.Book
|
||||||
import android.view.ViewGroup
|
import org.crosswire.jsword.passage.Verse
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by bspeice on 2/26/15.
|
* Created by bspeice on 2/26/15.
|
||||||
@ -21,9 +21,9 @@ class SearchResultsListView(val ctx: Context, val attrs: AttributeSet) : LinearL
|
|||||||
val layoutManager = LinearLayoutManager(ctx)
|
val layoutManager = LinearLayoutManager(ctx)
|
||||||
val inflater = ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater
|
val inflater = ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater
|
||||||
val contentView = inflater.inflate(R.layout.view_search_results_list, this, true)
|
val contentView = inflater.inflate(R.layout.view_search_results_list, this, true)
|
||||||
val searchResults = contentView.findViewById(R.id.search_results) as RecyclerView;
|
val searchResults = contentView.findViewById(R.id.search_results) as RecyclerView
|
||||||
|
|
||||||
{
|
init {
|
||||||
searchResults setLayoutManager layoutManager
|
searchResults setLayoutManager layoutManager
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ class ResultViewHolder(val view: SearchResultView) : RecyclerView.ViewHolder(vie
|
|||||||
* A custom view to wrap showing a search result
|
* A custom view to wrap showing a search result
|
||||||
*/
|
*/
|
||||||
class SearchResultView(val group: ViewGroup?) {
|
class SearchResultView(val group: ViewGroup?) {
|
||||||
val inflater = LayoutInflater.from(group?.getContext())
|
val inflater = LayoutInflater.from(group!!.getContext())
|
||||||
val contentView = inflater.inflate(R.layout.view_search_result, group, false)
|
val contentView = inflater.inflate(R.layout.view_search_result, group, false)
|
||||||
|
|
||||||
val verseName = contentView.findViewById(R.id.verseName) as TextView
|
val verseName = contentView.findViewById(R.id.verseName) as TextView
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
package org.bspeice.minimalbible.activity.settings
|
package org.bspeice.minimalbible.activity.settings
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.util.AttributeSet
|
|
||||||
import android.preference.Preference
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import org.bspeice.minimalbible.R
|
|
||||||
import android.os.Build
|
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
|
import android.os.Build
|
||||||
|
import android.preference.Preference
|
||||||
|
import android.util.AttributeSet
|
||||||
|
import org.bspeice.minimalbible.R
|
||||||
|
|
||||||
class ContactPreference(val ctx: Context, val attrs: AttributeSet)
|
class ContactPreference(val ctx: Context, val attrs: AttributeSet)
|
||||||
: Preference(ctx, attrs), Preference.OnPreferenceClickListener {
|
: Preference(ctx, attrs), Preference.OnPreferenceClickListener {
|
||||||
|
|
||||||
{
|
init {
|
||||||
setOnPreferenceClickListener(this);
|
setOnPreferenceClickListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,29 +1,27 @@
|
|||||||
package org.bspeice.minimalbible.activity.viewer
|
package org.bspeice.minimalbible.activity.viewer
|
||||||
|
|
||||||
import android.widget.BaseExpandableListAdapter
|
import android.content.Context
|
||||||
|
import android.content.res.Resources
|
||||||
|
import android.support.annotation.LayoutRes
|
||||||
|
import android.util.AttributeSet
|
||||||
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import org.crosswire.jsword.book.Book
|
import android.widget.BaseExpandableListAdapter
|
||||||
import org.crosswire.jsword.book.getVersification
|
import android.widget.ExpandableListView
|
||||||
import org.crosswire.jsword.versification.getBooks
|
import android.widget.LinearLayout
|
||||||
import org.crosswire.jsword.book.bookName
|
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import org.bspeice.minimalbible.R
|
import org.bspeice.minimalbible.R
|
||||||
import android.content.Context
|
import org.crosswire.jsword.book.Book
|
||||||
import android.view.LayoutInflater
|
import org.crosswire.jsword.book.bookName
|
||||||
import android.content.res.Resources
|
import org.crosswire.jsword.book.getVersification
|
||||||
import android.widget.ExpandableListView
|
|
||||||
import rx.subjects.PublishSubject
|
|
||||||
import android.widget.LinearLayout
|
|
||||||
import android.app.Activity
|
|
||||||
import android.util.AttributeSet
|
|
||||||
import org.bspeice.minimalbible.activity.setInset
|
|
||||||
import android.support.annotation.LayoutRes
|
|
||||||
import org.crosswire.jsword.versification.BibleBook
|
import org.crosswire.jsword.versification.BibleBook
|
||||||
|
import org.crosswire.jsword.versification.getBooks
|
||||||
|
import rx.subjects.PublishSubject
|
||||||
|
|
||||||
class BibleMenu(val ctx: Context, val attrs: AttributeSet) : LinearLayout(ctx, attrs) {
|
class BibleMenu(val ctx: Context, val attrs: AttributeSet) : LinearLayout(ctx, attrs) {
|
||||||
val inflater = ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater
|
// val inflater = ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater
|
||||||
val contentView = inflater.inflate(R.layout.view_bible_menu, this, true)
|
// val contentView = inflater.inflate(R.layout.view_bible_menu, this, true)
|
||||||
val menuContent = findViewById(R.id._bible_menu) as ExpandableListView
|
val menuContent = findViewById(R.id._bible_menu) as ExpandableListView
|
||||||
|
|
||||||
fun doInitialize(b: Book, publisher: PublishSubject<BookScrollEvent>) {
|
fun doInitialize(b: Book, publisher: PublishSubject<BookScrollEvent>) {
|
||||||
@ -33,8 +31,6 @@ class BibleMenu(val ctx: Context, val attrs: AttributeSet) : LinearLayout(ctx, a
|
|||||||
menuContent.collapseGroup(adapter.getGroupIdForBook(it.b))
|
menuContent.collapseGroup(adapter.getGroupIdForBook(it.b))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun placeInset(a: Activity) = setInset(a)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -62,7 +58,6 @@ class BibleAdapter(val b: Book, val scrollPublisher: PublishSubject<BookScrollEv
|
|||||||
)
|
)
|
||||||
|
|
||||||
var groupHighlighted: Int = 0
|
var groupHighlighted: Int = 0
|
||||||
var childHighlighted: Int = 0
|
|
||||||
|
|
||||||
override fun getGroupCount(): Int = menuMappings.count()
|
override fun getGroupCount(): Int = menuMappings.count()
|
||||||
|
|
||||||
@ -135,7 +130,7 @@ class GroupItemHolder(val bindTo: View) {
|
|||||||
val content = bindTo.findViewById(R.id.content) as TextView
|
val content = bindTo.findViewById(R.id.content) as TextView
|
||||||
val resources = bindTo.getResources(): Resources
|
val resources = bindTo.getResources(): Resources
|
||||||
|
|
||||||
class object {
|
companion object {
|
||||||
fun init(v: View, obj: Any, highlighted: Boolean): View {
|
fun init(v: View, obj: Any, highlighted: Boolean): View {
|
||||||
val holder =
|
val holder =
|
||||||
if (v.getTag() != null) v.getTag() as GroupItemHolder
|
if (v.getTag() != null) v.getTag() as GroupItemHolder
|
||||||
@ -166,7 +161,7 @@ class ChildItemHolder(val bindTo: View, val book: BibleBook,
|
|||||||
val content2 = bindTo.findViewById(R.id.content2) as TextView
|
val content2 = bindTo.findViewById(R.id.content2) as TextView
|
||||||
val content3 = bindTo.findViewById(R.id.content3) as TextView
|
val content3 = bindTo.findViewById(R.id.content3) as TextView
|
||||||
|
|
||||||
class object {
|
companion object {
|
||||||
fun init(v: View, obj: IntRange, book: BibleBook,
|
fun init(v: View, obj: IntRange, book: BibleBook,
|
||||||
scrollPublisher: PublishSubject<BookScrollEvent>): View {
|
scrollPublisher: PublishSubject<BookScrollEvent>): View {
|
||||||
val holder =
|
val holder =
|
||||||
|
@ -1,25 +1,25 @@
|
|||||||
package org.bspeice.minimalbible.activity.viewer
|
package org.bspeice.minimalbible.activity.viewer
|
||||||
|
|
||||||
import android.support.v7.widget.RecyclerView
|
|
||||||
import android.view.ViewGroup
|
|
||||||
import org.crosswire.jsword.book.Book
|
|
||||||
import android.view.LayoutInflater
|
|
||||||
import org.bspeice.minimalbible.R
|
|
||||||
import android.widget.TextView
|
|
||||||
import org.crosswire.jsword.book.getVersification
|
|
||||||
import org.crosswire.jsword.versification.getBooks
|
|
||||||
import org.crosswire.jsword.versification.BibleBook
|
|
||||||
import org.bspeice.minimalbible.activity.viewer.BookAdapter.ChapterInfo
|
|
||||||
import rx.subjects.PublishSubject
|
|
||||||
import android.text.SpannableStringBuilder
|
|
||||||
import android.util.TypedValue
|
|
||||||
import android.util.Log
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.util.AttributeSet
|
|
||||||
import android.support.v7.widget.LinearLayoutManager
|
import android.support.v7.widget.LinearLayoutManager
|
||||||
import android.widget.LinearLayout
|
import android.support.v7.widget.RecyclerView
|
||||||
|
import android.text.SpannableStringBuilder
|
||||||
|
import android.util.AttributeSet
|
||||||
|
import android.util.Log
|
||||||
|
import android.util.TypedValue
|
||||||
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import android.view.ViewGroup
|
||||||
|
import android.widget.LinearLayout
|
||||||
|
import android.widget.TextView
|
||||||
|
import org.bspeice.minimalbible.R
|
||||||
|
import org.bspeice.minimalbible.activity.viewer.BookAdapter.ChapterInfo
|
||||||
import org.bspeice.minimalbible.service.format.osisparser.OsisParser
|
import org.bspeice.minimalbible.service.format.osisparser.OsisParser
|
||||||
|
import org.crosswire.jsword.book.Book
|
||||||
|
import org.crosswire.jsword.book.getVersification
|
||||||
|
import org.crosswire.jsword.versification.BibleBook
|
||||||
|
import org.crosswire.jsword.versification.getBooks
|
||||||
|
import rx.subjects.PublishSubject
|
||||||
|
|
||||||
class BibleView(val ctx: Context, val attrs: AttributeSet) : LinearLayout(ctx, attrs) {
|
class BibleView(val ctx: Context, val attrs: AttributeSet) : LinearLayout(ctx, attrs) {
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ class BibleView(val ctx: Context, val attrs: AttributeSet) : LinearLayout(ctx, a
|
|||||||
val contentView: View = inflater.inflate(R.layout.view_bible, this, true)
|
val contentView: View = inflater.inflate(R.layout.view_bible, this, true)
|
||||||
val bibleContent = contentView.findViewById(R.id.bible_content) as RecyclerView
|
val bibleContent = contentView.findViewById(R.id.bible_content) as RecyclerView
|
||||||
|
|
||||||
{
|
init {
|
||||||
bibleContent setLayoutManager layoutManager
|
bibleContent setLayoutManager layoutManager
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ class BookAdapter(val b: Book, val prefs: BibleViewerPreferences)
|
|||||||
*/
|
*/
|
||||||
override fun onCreateViewHolder(parent: ViewGroup?,
|
override fun onCreateViewHolder(parent: ViewGroup?,
|
||||||
position: Int): PassageView {
|
position: Int): PassageView {
|
||||||
val emptyView = LayoutInflater.from(parent?.getContext())
|
val emptyView = LayoutInflater.from(parent!!.getContext())
|
||||||
.inflate(R.layout.viewer_passage_view, parent, false) as TextView
|
.inflate(R.layout.viewer_passage_view, parent, false) as TextView
|
||||||
|
|
||||||
// TODO: Listen for changes to the text size?
|
// TODO: Listen for changes to the text size?
|
||||||
@ -125,14 +125,14 @@ class BookAdapter(val b: Book, val prefs: BibleViewerPreferences)
|
|||||||
val event = it
|
val event = it
|
||||||
lM scrollToPosition
|
lM scrollToPosition
|
||||||
// Get all objects in the form (index, object)
|
// Get all objects in the form (index, object)
|
||||||
chapterList.withIndices()
|
chapterList.withIndex()
|
||||||
// Get one that matches our book and chapter
|
// get one that matches our book and chapter
|
||||||
.first {
|
.first {
|
||||||
event.b == it.second.bibleBook &&
|
event.b == it.value.bibleBook &&
|
||||||
event.chapter == it.second.chapter
|
event.chapter == it.value.chapter
|
||||||
}
|
}
|
||||||
// And get that index value to scroll to
|
// and get that index value to scroll to
|
||||||
.first
|
.index
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package org.bspeice.minimalbible.service.manager
|
package org.bspeice.minimalbible.service.manager
|
||||||
|
|
||||||
import rx.Observable
|
|
||||||
import org.crosswire.jsword.book.Books
|
|
||||||
import rx.functions.Action1
|
|
||||||
import org.crosswire.jsword.book.Book
|
|
||||||
import rx.functions.Action0
|
|
||||||
import org.bspeice.minimalbible.exception.NoBooksInstalledException
|
import org.bspeice.minimalbible.exception.NoBooksInstalledException
|
||||||
|
import org.crosswire.jsword.book.Book
|
||||||
|
import org.crosswire.jsword.book.Books
|
||||||
|
import rx.Observable
|
||||||
|
import rx.functions.Action0
|
||||||
|
import rx.functions.Action1
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -21,9 +21,9 @@ open class BookManager(val ignore: List<String>) {
|
|||||||
?.filter { !ignore.contains(it!!.getInitials()) }
|
?.filter { !ignore.contains(it!!.getInitials()) }
|
||||||
?.cache() ?: throw NoBooksInstalledException()
|
?.cache() ?: throw NoBooksInstalledException()
|
||||||
|
|
||||||
var refreshComplete = false;
|
var refreshComplete = false
|
||||||
|
|
||||||
{
|
init {
|
||||||
// TODO: Cleaner way of expressing this?
|
// TODO: Cleaner way of expressing this?
|
||||||
installedBooks.subscribe(Action1<Book> { result -> },
|
installedBooks.subscribe(Action1<Book> { result -> },
|
||||||
Action1<Throwable> { error -> },
|
Action1<Throwable> { error -> },
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
ext.kotlin_version = '0.9.976'
|
ext.kotlin_version = '0.11.91'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
Loading…
Reference in New Issue
Block a user