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

Commit

Permalink
Upgrade to Readium 2.0.0-alpha.2
Browse files Browse the repository at this point in the history
  • Loading branch information
mickael-menu committed Oct 26, 2020
1 parent 0d900be commit 03c73bb
Show file tree
Hide file tree
Showing 12 changed files with 158 additions and 637 deletions.
1 change: 1 addition & 0 deletions r2-testapp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ dependencies {
}
if (findProject(':r2-lcp')) {
implementation project(':r2-lcp')
implementation "readium:liblcp:1.0.0@aar"
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import android.os.Handler
import android.view.Menu
import android.view.MenuItem
import android.widget.ImageView
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.launch
import org.jetbrains.anko.indeterminateProgressDialog
import org.jetbrains.anko.toast
Expand Down Expand Up @@ -94,6 +95,7 @@ class AudiobookActivity : R2AudiobookActivity(), NavigatorDelegate {
return true
}

@OptIn(ExperimentalCoroutinesApi::class)
override fun onOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import android.os.Bundle
import android.view.Menu
import android.view.MenuItem
import androidx.lifecycle.Observer
import androidx.lifecycle.asLiveData
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
Expand Down Expand Up @@ -64,7 +65,7 @@ class ComicActivity : R2CbzActivity(), CoroutineScope, NavigatorDelegate {
launch {
val positionCount = publication.positions().size

currentLocator.observe(this@ComicActivity, Observer { locator ->
currentLocator.asLiveData().observe(this@ComicActivity, Observer { locator ->
locator ?: return@Observer
Timber.d("locationDidChange position ${locator.locations.position ?: 0}/${positionCount} $locator")
booksDB.books.saveProgression(locator, bookId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,18 @@ package org.readium.r2.testapp.drm
import android.app.ProgressDialog
import android.net.Uri
import org.readium.r2.shared.drm.DRM
import org.readium.r2.shared.publication.Publication
import org.readium.r2.streamer.parser.epub.EpubParser
import org.readium.r2.streamer.parser.PubBox
import org.readium.r2.testapp.db.Book
import java.io.File


data class DRMFulfilledPublication(
val localURL: String,
val suggestedFilename: String)

interface DRMLibraryService {
val brand: DRM.Brand
fun canFulfill(file: String) : Boolean
fun fulfill(byteArray: ByteArray, completion: (Any?) -> Unit)
fun loadPublication(publication: String, drm: DRM, completion: (Any?) -> Unit)
}

interface LCPLibraryActivityService {
fun parseIntentLcpl(uriString: String, networkAvailable: Boolean)
fun prepareAndStartActivityWithLCP(drm: DRM, pub: PubBox, book: Book, file: File, publicationPath: String, publication: Publication, networkAvailable: Boolean)
fun processLcpActivityResult(uri: Uri, progress: ProgressDialog, networkAvailable: Boolean)
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import androidx.appcompat.app.AlertDialog
import androidx.appcompat.widget.SearchView
import androidx.core.widget.TextViewCompat
import androidx.lifecycle.Observer
import androidx.lifecycle.asLiveData
import androidx.recyclerview.widget.LinearLayoutManager
import com.google.gson.Gson
import kotlinx.android.synthetic.main.activity_epub.*
Expand Down Expand Up @@ -138,7 +139,7 @@ class EpubActivity : R2EpubActivity(), CoroutineScope, NavigatorDelegate/*, Visu
launch {
val positionCount = publication.positions().size

currentLocator.observe(this@EpubActivity, Observer { locator ->
currentLocator.asLiveData().observe(this@EpubActivity, Observer { locator ->
locator ?: return@Observer

Timber.d("locationDidChange position ${locator.locations.position ?: 0}/${positionCount} $locator")
Expand Down
Loading

0 comments on commit 03c73bb

Please sign in to comment.