mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-17 19:35:36 -04:00
Use filterIsInstance & mapNotNull to filter book titles
This commit is contained in:
parent
46f986ebc9
commit
0c084510ea
@ -175,9 +175,11 @@ class ZimHostActivity : BaseActivity(), ZimHostCallbacks, ZimHostContract.View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun saveHostedBooks(booksList: ArrayList<BooksOnDiskListItem>) {
|
private fun saveHostedBooks(booksList: ArrayList<BooksOnDiskListItem>) {
|
||||||
sharedPreferenceUtil.hostedBooks =
|
sharedPreferenceUtil.hostedBooks = booksList.asSequence()
|
||||||
booksList.filter { book -> book.isSelected && book is BookOnDisk && book.book.title != null }
|
.filter(BooksOnDiskListItem::isSelected)
|
||||||
.map { book -> (book as BookOnDisk).book.title }.toSet()
|
.filterIsInstance<BookOnDisk>()
|
||||||
|
.mapNotNull { it.book.title }
|
||||||
|
.toSet()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun layoutServerStarted() {
|
private fun layoutServerStarted() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user