All notable changes to this project will be documented in this file. Take a look at the migration guide to upgrade between two major versions.
Warning: Features marked as experimental may change or be removed in a future release without notice. Use with caution.
- #286 Fixed broken dependency to NanoHTTPD.
- A new
Publication.conformsTo()
API to identify the profile of a publication. - Support for the
conformsTo
RWPM metadata, to identify the profile of aPublication
.
- The PDF navigator now honors the publication reading progression with support for right-to-left and horizontal scrolling.
- The default (auto) reading progression for PDF is top-to-bottom, which is vertical scrolling.
- A new convenience utility
EdgeTapNavigation
to trigger page turns while tapping the screen edges.- It takes into account the navigator reading progression to move into the right direction.
- Call it from the
VisualNavigator.Listener.onTap()
callback as demonstrated below:
override fun onTap(point: PointF): Boolean { val navigated = edgeTapNavigation.onTap(point, requireView()) if (!navigated) { // Fallback action, for example toggling the app bar. } return true }
- The new
Navigator.Listener.onJumpToLocator()
API is called every time the navigator jumps to an explicit location, which might break the linear reading progression.- For example, it is called when clicking on internal links or programmatically calling
Navigator.go()
, but not when turning pages. - You can use this callback to implement a navigation history by differentiating between continuous and discontinuous moves.
- For example, it is called when clicking on internal links or programmatically calling
- You can now disable the display cutouts padding in the EPUB navigator (contributed by @szymn).
- This is useful when the navigator is not laid out full screen.
- (experimental) A new audiobook navigator based on Jetpack
media2
.- See the pull request #80 for the differences with the previous audiobook navigator.
- This navigator is located in its own module
readium-navigator-media2
. You will need to add it to your dependencies to use it. - The Test App demonstrates how to use the new audiobook navigator, see
MediaService
andAudioReaderFragment
.
- (experimental) The EPUB navigator now supports overridable drag gestures. See
VisualNavigator.Listener
.
Publication.type
is now deprecated in favor of the newPublication.conformsTo()
API which is more accurate.- For example, replace
publication.type == Publication.TYPE.EPUB
withpublication.conformsTo(Publication.Profile.EPUB)
before opening a publication with theEpubNavigatorFragment
.
- For example, replace
Link.toLocator()
is deprecated as it may create an incorrectLocator
if the linktype
is missing.- Use
publication.locatorFromLink()
instead.
- Use
- Fix building with Kotlin 1.6.
- Fixed the rendering of PDF covers in some edge cases.
- Fixed reading ranges of obfuscated EPUB resources.
- Fixed turning pages of an EPUB reflowable resource with an odd number of columns. A virtual blank trailing column is appended to the resource when displayed as two columns.
- EPUB: Fallback on
reflowable
if thepresentation.layout
hint is missing from a manifest. - EPUB: Offset of the current selection's
rect
to take into account the vertical padding. - Improve backward compatibility of JavaScript files using Babel.
- #193 Fixed invisible
<audio>
elements.
- Improve loading of EPUB reflowable resources.
- Resources are hidden until fully loaded and positioned.
- Intermediary locators are not broadcasted as
currentLocator
anymore while loading a resource. - Improved accuracy when jumping to the middle of a large resource.
EpubNavigatorFragment.PaginationListener.onPageLoaded()
is now called only a single time, for the currently visible page.VisualNavigator.Listener.onTap()
is called even when a resource is not fully loaded.
EpubNavigatorFragment
'sgoForward()
andgoBackward()
are now jumping to the previous or next pages instead of resources.- #20 EPUB navigator stuck between two pages with vertical swipes.
- #27 Internal links break the EPUB navigator (contributed by @mihai-wolfpack).
- (experimental) A new Publication
SearchService
to search through the resources' content, with a default implementationStringSearchService
. ContentProtection.Scheme
can be used to identify protection technologies using unique URI identifiers.Link
objects from archive-based publication assets (e.g. an EPUB/ZIP) have additional properties for entry metadata."properties" { "archive": { "entryLength": 8273, "isEntryCompressed": true } }
- EPUB publications implement a
SearchService
to search through the content. - Known DRM schemes (LCP and Adobe ADEPT) are now sniffed by the
Streamer
, when no registeredContentProtection
supports them.- This is helpful to present an error message when the user attempts to open a protected publication not supported by the app.
- The EPUB navigator is now able to navigate to a
Locator
using itstext
context. This is useful for search results or highlights missing precise locations. - Get or clear the current user selection of the navigators implementing
SelectableNavigator
. - (experimental) Support for the Decorator API to draw user interface elements over a publication's content.
- This can be used to render highlights over a text selection, for example.
- For now, only the EPUB navigator implements
DecorableNavigator
, for reflowable publications. You can implement custom decoration styles withHtmlDecorationTemplate
.
- Customize the EPUB selection context menu by providing a custom
ActionMode.Callback
implementation withEpubNavigatorFragment.Configuration.selectionActionModeCallback
.- This is an alternative to overriding
Activity.onActionModeStarted()
which does not seem to work anymore with Android 12.
- This is an alternative to overriding
- (experimental) A new audiobook navigator based on Android's
MediaSession
.- It supports out-of-the-box media style notifications and background playback.
- ExoPlayer is used by default for the actual playback, but you can use a custom player by implementing
MediaPlayer
.
- New APIs using coroutines and R2's
HttpClient
instead of Fuel and kovenant (contributed by @stevenzeck).
- Upgraded to Kotlin 1.5.31 and Gradle 7.1.1
- The default EPUB positions service now uses the archive entry length when available. This is similar to how Adobe RMSDK generates page numbers.
- To use the former strategy, create the
Streamer
with:Streamer(parsers = listOf(EpubParser(reflowablePositionsStrategy = OriginalLength(pageLength = 1024))))
- To use the former strategy, create the
- The order of precedence of
Locator
locations in the reflowable EPUB navigator is:text
, HTML ID, thenprogression
. The navigator will now fallback on less precise locations in case of failure.
- Migrated to Jetpack Room for the SQLite database storing rights and passphrases (contributed by @stevenzeck).
- Note that the internal SQL schema changed. You will need to update your app if you were querying the database manually.
- Crash with
HttpRequest.setPostForm()
on Android 6. - HREF normalization when a resource path contains special characters.
- EPUB style injection when a resource has a
<head>
tag with attributes.
- When restoring a
Locator
, The PDF navigator now falls back onlocations.position
if thepage=
fragment identifier is missing.
- Links in an OPDS 2 feed are normalized to the feed base URL.
HttpFetcher
is a new publication fetcher able to serve remote resources through HTTP.- The actual HTTP requests are performed with an instance of
HttpClient
.
- The actual HTTP requests are performed with an instance of
HttpClient
is a new protocol exposing a high level API to perform HTTP requests.DefaultHttpClient
is an implementation ofHttpClient
using standardHttpURLConnection
APIs. You can useDefaultHttpClient.Callback
to customize how requests are created and even recover from errors, e.g. to implement Authentication for OPDS.- You can provide your own implementation of
HttpClient
to Readium APIs if you prefer to use a third-party networking library.
Streamer
takes a new optionalHttpClient
dependency to handle HTTP requests.
- Scrolling to an EPUB ID (e.g. from the table of contents) when the target spans several screens.
Publication.Service.Context
now holds a reference to the parentPublication
. This can be used to access other services from a givenPublication.Service
implementation.- The default
LocatorService
implementation can be used to get aLocator
from a global progression in the publication.publication.locateProgression(0.5)
Server.addPublication()
is a new API which replacesaddEpub()
and is easier to use.- If the publication can be served, it will return the base URL which you need to provide to the Navigator
Activity
orFragment
. - You do not need to give the publication filename nor add the server port in the
$key-publicationPort
SharedPreference
value anymore.
- If the publication can be served, it will return the base URL which you need to provide to the Navigator
- You can observe the progress of an acquisition by providing an
onProgress
closure toLcpService.acquirePublication()
. - Extensibility in licenses'
Rights
model.
- The HTTP server now requests that publication resources are not cached by browsers.
- Caching poses a security risk for protected publications.
R2EpubActivity
andR2AudiobookActivity
require a newbaseUrl
Intent
extra. You need to set it to the base URL returned byServer.addPublication()
from the Streamer.
- The Renew Loan API got revamped to better support renewal through a web page.
- You will need to implement
LcpLicense.RenewListener
to coordinate the UX interaction. - If your application fits Material Design guidelines, take a look at
MaterialRenewListener
for a default implementation.
- You will need to implement
- Removed dependency on Joda's
DateTime
in public APIs.- You can always create a
DateTime
from the standardDate
objects if you relied on Joda's features in the callers.
- You can always create a
- #129 Improve performances when reading deflated ZIP resources.
- For example, it helps with large image-based FXL EPUB which used to be slow to render.
- #136
null
values in JSON string properties are now properly parsed as nullable types, instead of the string"null"
- #217 Interactive HTML elements are not bypassed anymore when handling touch gestures.
- Scripts using
preventDefault()
are now taken into account and do not trigger a tap event anymore.
- Scripts using
- #150 External links are opened in a Chrome Custom Tab instead of the navigator's web view.
- #52 Memory leak in EPUB web views. This fixes ongoing media playback when closing an EPUB.
- #287 Make sure the passphrase input is visible on smaller devices in the authentication dialog.
PublicationAsset
is a new interface which can be used to open a publication from various medium, such as a file, a remote URL or a custom source.File
was replaced byFileAsset
, which implementsPublicationAsset
.
- Support for display cutouts (screen notches).
- IMPORTANT: You need to remove any
setPadding()
statement from your app inUserSettings.kt
, if you copied it from the test app. - If you embed a navigator fragment (e.g.
EpubNavigatorFragment
) yourself, you need to opt-in by specifying thelayoutInDisplayCutoutMode
of the hostActivity
. R2EpubActivity
andR2CbzActivity
automatically applyLAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
to their window'slayoutInDisplayCutoutMode
.PdfNavigatorFragment
is not yet compatible with display cutouts, because of limitations from the underlying PDF viewer.
- IMPORTANT: You need to remove any
- Customize EPUB vertical padding by overriding the
r2.navigator.epub.vertical_padding
dimension.- Follow Android's convention for alternative resources to specify different paddings for landscape (
values-land
) or large screens.
- Follow Android's convention for alternative resources to specify different paddings for landscape (
- Upgraded to Kotlin 1.4.10.
Format
got merged intoMediaType
, to simplify the media type APIs.- You can use
MediaType.of()
to sniff the type of a file or bytes.- All the
MediaType.of()
functions are now suspending to prevent deadlocks withrunBlocking
.
- All the
MediaType
has now optionalname
andfileExtension
properties.- Some publication formats can be represented by several media type aliases. Using
mediaType.canonicalMediaType()
will give you the canonical media type to use, for example when persisting the file type in a database. All Readium APIs are already returning canonical media types, so it only matters if you create aMediaType
yourself from its string representation.
- You can use
ContentLayout
is deprecated, usepublication.metadata.effectiveReadingProgression
to determine the reading progression of a publication instead.
Streamer
is now expecting aPublicationAsset
instead of aFile
. You can create custom implementations ofPublicationAsset
to open a publication from different medium, such as a file, a remote URL, in-memory bytes, etc.FileAsset
can be used to replaceFile
and provides the same behavior.
- All
utils.js
functions were moved under areadium.
namespace. You will need to update your code if you were calling them manually.
- When acquiring a publication, falls back on the media type declared in the license link if the server returns an unknown media type.
- EPUBs declaring multiple languages were laid out from right to left if the first language had an RTL reading
progression. Now if no reading progression is set, the
effectiveReadingProgression
will be LTR. - #152 Panning through a zoomed-in fixed layout EPUB (contributed by @johanpoirier).
- #146 Various reflowable EPUB columns shift issues.
- Restoring the last EPUB location after configuration changes (e.g. screen rotation).
- Edge taps to turn pages when the app runs in a multi-windows environment.
- The Publication Services API allows to extend a
Publication
with custom implementations of known services. This version ships with a few predefined services:PositionsService
provides a list of discrete locations in the publication, no matter what the original format is.CoverService
provides an easy access to a bitmap version of the publication cover.
- The Composite Fetcher API can be used to extend the way publication resources are accessed.
- Support for exploded directories for any archive-based publication format.
- Content Protection handles DRM and other format-specific protections in a more systematic way.
- LCP now ships an
LcpContentProtection
implementation to be plugged into theStreamer
. - You can add custom
ContentProtection
implementations to support other DRMs by providing an instance to theStreamer
.
- LCP now ships an
- Streamer API offers a simple interface to parse a publication and replace standalone parsers.
- A generic
ImageParser
for bitmap-based archives (CBZ or exploded directories) and single image files. - A generic
AudioParser
for audio-based archives (Zipped Audio Book or exploded directories) and single audio files.
- Support for the new
Publication
model using the Content Protection for DRM rights and the Fetcher for resource access. - (experimental) New
Fragment
implementations as an alternative to the legacyActivity
ones (contributed by @johanpoirier).- The fragments are chromeless, to let you customize the reading UX.
- To create the fragments use the matching factory such as
EpubNavigatorFragment.createFactory()
, as showcased inR2EpubActivity
. - At the moment, highlights and TTS are not yet supported in the new EPUB navigator
Fragment
. - This is now the recommended way to integrate Readium in your applications.
- LCP implementation of the Content Protection API to work with the new Streamer API (contributed by @qnga).
- It is highly recommended that you upgrade to the new
Streamer
API to open publications, which will simplify DRM unlocking.
- It is highly recommended that you upgrade to the new
- Two default implementations of
LcpAuthenticating
:LcpDialogAuthentication
to prompt the user for its passphrase with the official LCP dialog.LcpPassphraseAuthentication
to provide directly a passphrase, pulled for example from a database or a web service.
LcpService::isLcpProtected()
provides a way to check if a file is protected with LCP.- All the
LcpException
errors are now implementingUserException
and are suitable for user display. UsegetUserMessage()
to get the localized message.
- The
Publication
andContainer
types were merged together to offer a single interface to a publication's resources.- Use
publication.get()
to read the content of a resource, such as the cover. It will automatically be decrypted if aContentProtection
was attached to thePublication
.
- Use
Container
andContentFilters
were replaced by a shared implementation of aFetcher
.
currentLocator
is now aStateFlow
instead ofLiveData
, to better support chromeless navigators such as an audiobook navigator.- If you were observing
currentLocator
in a UI context, you can continue to do so withcurrentLocator.asLiveData()
.
- If you were observing
- Improvements to the PDF navigator:
- The navigator doesn't require PDF publications to be served from an HTTP server anymore. A side effect is that the navigator is now able to open larger PDF files.
PdfNavigatorFragment.Listener::onResourceLoadFailed()
can be used to report fatal errors to the user, such as when trying to open a PDF document that is too large for the available memory.- A dedicated
PdfNavigatorFragment.createFactory()
was added, which deprecates the use ofNavigatorFragmentFactory
.
- The public API got modernized to be more Kotlin idiomatic (contributed by @qnga).
- All asynchronous APIs are now suspending to take advantage of Kotlin's coroutines.
LcpAuthenticating
is now provided with more information and you will need to update any implementation you may have.- If you copied the default authentication dialog, it's recommended to use
LcpDialogAuthentication
instead.
- If you copied the default authentication dialog, it's recommended to use
- Publications are now downloaded to a temporary location, to make sure disk storage can be recovered automatically by the system. After acquiring the publication, you need to move the downloaded file to another permanent location.
- The private
liblcp
dependency is now accessed through reflection, to allow switching LCP dynamically (contributed by @qnga).- You need to add
implementation "readium:liblcp:1.0.0@aar"
to yourbuild.gradle
. LcpService::create()
returnsnull
iflcplib
is not found.
- You need to add
OutOfMemoryError
occuring while opening large publications are now caught to prevent crashes. They are reported asResource.Exception.OutOfMemory
.- Readium can now open PDF documents of any size without crashing. However, LCP protected PDFs are still limited by the available memory.
- Readium can now open PDF documents of any size without crashing. However, LCP protected PDFs are still limited by the available memory.
- Various HTTP server fixes and optimizations.
- Prevent switching to the next resource by mistake when scrolling through an EPUB resource in scroll mode.
- Decrypting resources in some edge cases (contributed by @qnga)
- Issues with LSD interactions:
- Exceptions handling with
renew
andreturn
interactions. - Presentation of the
renew
interaction through an HTML page.
- Exceptions handling with
- The timeout of fetching the License Status Document is reduced to 5 seconds, to avoid blocking a publication opening in low Internet conditions.
- Support for Positions List, which provides a list of discrete locations in a publication and can be used to implement an approximation of page numbers.
- Get the visible position from the current
Locator
withlocations.position
. - The total number of positions can be retrieved with
publication.positions().size
. It is a suspending function because computing positions the first time can be expensive.
- Get the visible position from the current
- The new Format API simplifies the detection of file formats, including known publication formats such as EPUB and PDF.
- A format can be "sniffed" from files, raw bytes or even HTTP responses.
- Reading apps are welcome to extend the API with custom formats.
- Using
Link.mediaType.matches()
is now recommended to safely check the type of a resource. - More details about the Kotlin implementation can be found in the pull request.
- In
Publication
shared models:- Support for the Presentation Hints extension.
- Support for OPDS holds, copies and availability in
Link
, for library-specific features. - Readium Web Publication Manifest extensibility is now supported for
Publication
,Metadata
, link'sProperties
and locator'sLocations
, which means that you are now able to access custom JSON properties in a manifest by creating Kotlin extensions on the shared models.
- Support for Positions List with EPUB, CBZ and PDF. Positions provide a list of discrete locations in a publication and can be used to implement an approximation of page numbers.
- Get the visible position from the current
Locator
withlocations.position
. - The total number of positions can be retrieved with
publication.positions().size
. It is a suspending function because computing positions the first time can be expensive.
- Get the visible position from the current
ReadiumWebPubParser
to parse all Readium Web Publication profiles, including Audiobooks, LCP for Audiobooks and LCP for PDF. It parses both manifests and packages.- (experimental)
PDFParser
to parse single PDF documents.- The PDF parser is based on PdfiumAndroid, which may increase the size of your apps. Please open an issue if this is a problem for you, as we are considering different solutions to fix this in a future release.
- The position is now reported in the locators for EPUB, CBZ and PDF.
- (experimental) PDF navigator.
- Supports both single PDF and LCP protected PDF.
- As a proof of concept, it is implemented using
Fragment
instead ofActivity
.R2PdfActivity
showcases how to use thePdfNavigatorFragment
with the newNavigatorFragmentFactory
. - The navigator is based on AndroidPdfViewer, which may increase the size of your apps. Please open an issue if this is a problem for you, as we are considering different solutions to fix this in a future release.
- Support for PDF and Readium Audiobooks protected with LCP.
- The
Publication
shared models underwent an important refactoring and some of these changes are breaking. Please refer to the migration guide to update your codebase.- All the models are now immutable data classes, to improve code safety. This should not impact reading apps unless you created
Publication
or other models yourself. - A few types and enums were renamed to follow the Google Android Style coding convention better. Just follow deprecation warnings to update your codebase.
- All the models are now immutable data classes, to improve code safety. This should not impact reading apps unless you created
- The CSS, JavaScript and fonts injection in the
Server
was refactored to reduce the risk of collisions and simplify your codebase.- This is a breaking change, to upgrade your app you need to:
- Provide the application's
Context
when creating aServer
. - Remove the following injection statements, which are now handled directly by the Streamer:
- Provide the application's
- This is a breaking change, to upgrade your app you need to:
server.loadCustomResource(assets.open("scripts/crypto-sha256.js"), "crypto-sha256.js", Injectable.Script)
server.loadCustomResource(assets.open("scripts/highlight.js"), "highlight.js", Injectable.Script)
- Upgraded to Readium CSS 1.0.0-beta.1.
- Two new fonts are available: AccessibleDfa and IA Writer Duospace.
- The file structure now follows strictly the one from ReadiumCSS's
dist/
, for easy upgrades and custom builds replacement.
LCPAuthenticating
can now return hashed passphrases in addition to clear ones. This can be used by reading apps fetching hashed passphrases from a web service or Authentication for OPDS, for example.
R2SyntheticPageList
was replaced by the aforementioned Positions List and can be safely removed from your codebase.
Navigator.currentLocation
andNavigatorDelegate.locationDidChange()
are deprecated in favor of a unifiedNavigator.currentLocator
, which is observable thanks toLiveData
.
- Important: Publications parsed from large manifests could crash the application when starting a reading activity. To fix this,
Publication
must not be put in anIntent
extra anymore. Instead, use the newIntent
extensions provided by Readium. This solution is a crutch until we move away fromActivity
in the Navigator and let reading apps handle the lifecycle ofPublication
themselves. - The local HTTP server was broken when provided with publication filenames containing invalid characters.
- XML namespace prefixes are now properly supported when an author chooses unusual ones (contributed by @qnga).
- The
AndroidManifest.xml
is not forcing anymoreallowBackup
andsupportsRtl
, to let reading apps manage these features themselves (contributed by @twaddington).
- The EPUB parser underwent a significant refactoring to fix a number of issues (contributed by @qnga)
- Metadata parsing was updated to follow our up-to-date specifications.
- XML namespace prefixes are now properly supported, when an author chooses unusual ones.
- Similarly, default vocabularies and prefixes for EPUB 3 Property Data Types are now properly handled.
Server
was broken when provided with publication filenames containing invalid characters.- EPUB publishers' default styles are not overriden by Readium CSS anymore.
- The
AndroidManifest.xml
is not forcing anymoreallowBackup
andsupportsRtl
, to let reading apps manage these features themselves (contributed by @twaddington).
- Important: Publications parsed from large manifests could crash the application when starting a reading activity. To fix this,
Publication
must not be put in anIntent
extra anymore. Instead, use the newIntent
extensions provided by Readium. This solution is a crutch until we move away fromActivity
in the Navigator and let reading apps handle the lifecycle ofPublication
themselves. - Crash when opening a publication with a space in its filename.
- Jumping to an EPUB location from the search.
- The
AndroidManifest.xml
is not forcing anymoreallowBackup
andsupportsRtl
, to let reading apps manage these features themselves (contributed by @twaddington).
- XML namespace prefixes are now properly supported when an author chooses unusual ones (contributed by @qnga).
- The
AndroidManifest.xml
is not forcing anymoreallowBackup
andsupportsRtl
, to let reading apps manage these features themselves (contributed by @twaddington).
OutOfMemoryError
when downloading a large publication. This fix removed the dependency to Fuel.- The
AndroidManifest.xml
is not forcing anymoreallowBackup
andsupportsRtl
, to let reading apps manage these features themselves (contributed by @twaddington).