Skip to content
This repository has been archived by the owner on Jul 29, 2022. It is now read-only.

Commit

Permalink
Use Parcelable for Publication, and use readingOrder instead of image…
Browse files Browse the repository at this point in the history
…s for CBZ
  • Loading branch information
mickael-menu committed Feb 4, 2020
1 parent b6dca6d commit 7ae44d9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class ComicActivity : R2CbzActivity(), CoroutineScope, NavigatorDelegate {
return booksDB.books.currentLocator(bookId)?.let {
it
} ?: run {
val resource = publication.images[resourcePager.currentItem]
val resource = publication.readingOrder[resourcePager.currentItem]
val resourceHref = resource.href
val resourceType = resource.type ?: ""
Locator(resourceHref, resourceType, publication.metadata.title, Locations(progression = 0.0))
Expand Down Expand Up @@ -74,7 +74,7 @@ class ComicActivity : R2CbzActivity(), CoroutineScope, NavigatorDelegate {
navigatorDelegate = this
bookId = intent.getLongExtra("bookId", -1)

currentPagerPosition = publication.images.indexOfFirst { it.href == currentLocation?.href }
currentPagerPosition = publication.readingOrder.indexOfFirst { it.href == currentLocation?.href }
resourcePager.currentItem = currentPagerPosition

toggleActionBar()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class OPDSDetailActivity : AppCompatActivity(), CoroutineScope {
val database = BooksDatabase(this)

val opdsDownloader = OPDSDownloader(this)
val publication: Publication = intent.getSerializableExtra("publication") as Publication
val publication: Publication = intent.getParcelableExtra("publication") as Publication
nestedScrollView {
fitsSystemWindows = true
lparams(width = matchParent, height = matchParent)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class R2OutlineActivity : AppCompatActivity() {
val tabHost = findViewById<TabHost>(R.id.tabhost)
tabHost.setup()

val publication = intent.getSerializableExtra("publication") as Publication
val publication = intent.getParcelableExtra("publication") as Publication

title = publication.metadata.title

Expand Down

0 comments on commit 7ae44d9

Please sign in to comment.