mirror of
https://github.com/MinimalBible/MinimalBible
synced 2025-07-04 15:25:14 -04:00
Add a list of books to exclude
Still need to fix some references to Books.installed(), please use injection for this.
This commit is contained in:
@ -16,6 +16,7 @@ import java.util.Date
|
||||
*/
|
||||
|
||||
class RefreshManager(val installers: Collection<Installer>,
|
||||
val exclude: List<String>,
|
||||
val prefs: DownloadPrefs,
|
||||
val connManager: ConnectivityManager?) {
|
||||
val refreshComplete = AtomicBoolean()
|
||||
@ -26,7 +27,9 @@ class RefreshManager(val installers: Collection<Installer>,
|
||||
it.reloadBookList() // TODO: Handle InstallException
|
||||
prefs.downloadRefreshedOn(Date().getTime())
|
||||
}
|
||||
mapOf(Pair(it, it.getBooks()))
|
||||
val validBooks = it.getBooks()
|
||||
.filterNot { exclude contains it.getInitials() }
|
||||
mapOf(Pair(it, validBooks))
|
||||
}
|
||||
.subscribeOn(Schedulers.io())
|
||||
.cache();
|
||||
|
@ -1,28 +0,0 @@
|
||||
package org.bspeice.minimalbible.activity.settings
|
||||
|
||||
import android.preference.PreferenceActivity
|
||||
import android.os.Bundle
|
||||
import org.bspeice.minimalbible.R
|
||||
import android.support.v7.widget.Toolbar
|
||||
import org.bspeice.minimalbible.activity.BaseActivity
|
||||
import android.widget.LinearLayout
|
||||
|
||||
/**
|
||||
* Created by bspeice on 12/1/14.
|
||||
*/
|
||||
class MinimalBibleSettings() : PreferenceActivity() {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super<PreferenceActivity>.onCreate(savedInstanceState)
|
||||
|
||||
addPreferencesFromResource(R.xml.preferences)
|
||||
setContentView(R.layout.activity_settings)
|
||||
BaseActivity.setupStatusBar(this)
|
||||
|
||||
val toolbar = findViewById(R.id.toolbar) as Toolbar
|
||||
toolbar.setTitle(R.string.action_settings)
|
||||
|
||||
val root = findViewById(R.id.container) as LinearLayout
|
||||
BaseActivity.setupInsets(this, root)
|
||||
}
|
||||
}
|
@ -14,11 +14,9 @@ import javax.inject.Singleton
|
||||
*/
|
||||
|
||||
Singleton
|
||||
open class BookManager() {
|
||||
// Some extra books like to think they're installed, but trigger NPE all over the place...
|
||||
val ignore = array("ERen_no", "ot1nt2");
|
||||
|
||||
open class BookManager(val ignore: List<String>) {
|
||||
|
||||
// TODO: Remove static reference to Books.installed()
|
||||
open val installedBooks = Observable.from(Books.installed()!!.getBooks())
|
||||
?.filter { !ignore.contains(it!!.getInitials()) }
|
||||
?.cache() ?: throw NoBooksInstalledException()
|
||||
|
Reference in New Issue
Block a user