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

Commit

Permalink
2.2.0 (#411)
Browse files Browse the repository at this point in the history
  • Loading branch information
mickael-menu authored Apr 22, 2021
1 parent 0f33b47 commit 970576f
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 15 deletions.
4 changes: 2 additions & 2 deletions r2-testapp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ group = 'com.github.readium'
int major = 2
int minor = 2
int patch = 0
int build = 27
int build = 28
String type = ""

def version = "$major.$minor.$patch"
Expand Down Expand Up @@ -77,7 +77,7 @@ android {
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')

final READIUM_VERSION = '2.0.0-beta.2'
final READIUM_VERSION = '2.0.0'
if (findProject(':r2-shared')) {
implementation project(':r2-shared')
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import org.jetbrains.anko.appcompat.v7.Appcompat
import org.jetbrains.anko.design.longSnackbar
import org.joda.time.DateTime
import org.joda.time.format.DateTimeFormat
import org.readium.r2.lcp.MaterialRenewListener
import org.readium.r2.lcp.lcpLicense
import org.readium.r2.shared.UserException
import org.readium.r2.testapp.R
Expand All @@ -36,7 +37,13 @@ class DrmManagementFragment : Fragment(R.layout.fragment_drm_management) {

val publication = ViewModelProvider(requireActivity()).get(ReaderViewModel::class.java).publication
val license = checkNotNull(publication.lcpLicense)
val modelFactory = LcpManagementViewModel.Factory(license)
val renewListener = MaterialRenewListener(
license = license,
caller = this,
fragmentManager = this.childFragmentManager
)

val modelFactory = LcpManagementViewModel.Factory(license, renewListener)
model = ViewModelProvider(this, modelFactory).get(LcpManagementViewModel::class.java)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,19 @@ import org.readium.r2.lcp.MaterialRenewListener
import org.readium.r2.shared.util.Try
import java.util.*

class LcpManagementViewModel(private val lcpLicense: LcpLicense) : DrmManagementViewModel() {
class LcpManagementViewModel(
private val lcpLicense: LcpLicense,
private val renewListener: LcpLicense.RenewListener,
) : DrmManagementViewModel() {

class Factory(private val lcpLicense: LcpLicense)
: ViewModelProvider.NewInstanceFactory() {
class Factory(
private val lcpLicense: LcpLicense,
private val renewListener: LcpLicense.RenewListener,
) : ViewModelProvider.NewInstanceFactory() {

override fun <T : ViewModel?> create(modelClass: Class<T>): T =
modelClass.getDeclaredConstructor(LcpLicense::class.java)
.newInstance(lcpLicense)
modelClass.getDeclaredConstructor(LcpLicense::class.java, LcpLicense.RenewListener::class.java)
.newInstance(lcpLicense, renewListener)
}

override val type: String = "LCP"
Expand Down Expand Up @@ -58,11 +63,6 @@ class LcpManagementViewModel(private val lcpLicense: LcpLicense) : DrmManagement
get() = lcpLicense.canRenewLoan

override suspend fun renewLoan(fragment: Fragment): Try<Date?, Exception> {
val renewListener = MaterialRenewListener(
license = lcpLicense,
caller = fragment,
fragmentManager = fragment.childFragmentManager
)
return lcpLicense.renewLoan(renewListener)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ class PdfReaderFragment : VisualReaderFragment(), PdfNavigatorFragment.Listener
val leftRange = 0.0..(0.2 * viewWidth)

when {
leftRange.contains(point.x) -> navigator.goBackward(animated = true)
leftRange.contains(viewWidth - point.x) -> navigator.goForward(animated = true)
leftRange.contains(point.x) -> navigator.goBackward()
leftRange.contains(viewWidth - point.x) -> navigator.goForward()
else -> requireActivity().toggleSystemUi()
}

Expand Down
4 changes: 4 additions & 0 deletions r2-testapp/src/main/res/xml/network_security_config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,9 @@
-->
<domain includeSubdomains="false">crl.edrlab.telesec.de</domain>

<!-- Publications from Feedbooks' catalog are downloaded through HTTP -->
<domain includeSubdomains="true">feedbooks.com</domain>
<domain includeSubdomains="true">feedbooks.net</domain>

</domain-config>
</network-security-config>

0 comments on commit 970576f

Please sign in to comment.