mirror of
https://github.com/kiwix/kiwix-android.git
synced 2025-09-17 11:25:34 -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>) {
|
||||
sharedPreferenceUtil.hostedBooks =
|
||||
booksList.filter { book -> book.isSelected && book is BookOnDisk && book.book.title != null }
|
||||
.map { book -> (book as BookOnDisk).book.title }.toSet()
|
||||
sharedPreferenceUtil.hostedBooks = booksList.asSequence()
|
||||
.filter(BooksOnDiskListItem::isSelected)
|
||||
.filterIsInstance<BookOnDisk>()
|
||||
.mapNotNull { it.book.title }
|
||||
.toSet()
|
||||
}
|
||||
|
||||
private fun layoutServerStarted() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user