Releases: readium/kotlin-toolkit
Releases · readium/kotlin-toolkit
3.0.1
Resources
Changelog
Fixed
Shared
- Improved performance when accessing a publication from the Shared Storage.
Navigator
- Fixed crash in the image navigator.
What's Changed
- Improve footnotes handling by @qnga in #571
- Fix crash in the image navigator by @mickael-menu in #582
- Speed up access to shared storage by @qnga in #581
- 3.0.1 by @mickael-menu in #583
Full Changelog: 3.0.0...3.0.1
3.0.0
Resources
Changelog
If you upgrade from a 2.x version, you might want to check out the Changelog of the alpha and beta versions as well.
Fixed
Navigator
- Fixed computing the total progression of audiobook locators.
- Fixed starting the TTS from the current resource in a fixed-layout EPUB.
What's Changed
- Fix audiobook locators' total progression by @mickael-menu in #553
- Fix TTS in a fixed-layout EPUB by @mickael-menu in #555
- Migrate away from JCenter by @mickael-menu in #557
- Try to fix Exoplayer illegal state by @qnga in #556
- Import
android-pdf-viewer
as a JAR instead of an AAR by @mickael-menu in #562 - Promote the Preferences API to stable by @mickael-menu in #568
- 3.0.0 by @mickael-menu in #569
Full Changelog: 3.0.0-beta.2...3.0.0
2.4.3
Resources
Changelog
This release is the same as 2.4.2, with a fix for Maven Central.
- Bump to Kotlin 1.9.24.
- Remove JCenter dependencies.
2.4.2
Resources
Changelog
- Bump to Kotlin 1.9.24.
- Remove JCenter dependencies.
3.0.0-beta.1
Resources
Changelog
Deprecated
Navigator
- All the
completion
parameters of theNavigator
APIs are removed.
Changed
- All the APIs using or returning a
Date
objects are now using a customInstant
type.
Shared
- The
Link
property key for archive-based publication assets (e.g. an EPUB/ZIP) is nowhttps://readium.org/webpub-manifest/properties#archive
instead ofarchive
.
LCP
- #493 The LCP module does not require the Bluetooth permissions anymore to derive the device name.
Fixed
Navigator
- #325 Top EPUB selections no longer break when dragging the selection handles.
- Fixed applying preferences while the EPUB navigator fragment is being recreated.
What's Changed
- Prevent Opds2Sniffer from reading the whole blob by @qnga in #482
- Various improvements in LcpService by @qnga in #483
- Fix various crashes by @mickael-menu in #484
- Don't read content whose length is unknown in sniffing by @qnga in #485
- Downgrade to jsoup 1.16.1 by @mickael-menu in #489
- Fix opening LCP-protected publication in restricted mode by @qnga in #494
- Fix a bunch of thread violations by @mickael-menu in #490
- Remove
completion
fromNavigator
APIs by @mickael-menu in #488 - Prevent reporting the current position while loading a locator by @mickael-menu in #487
- Enable core library desugaring by @mickael-menu in #496
- Fix various EPUB positioning issues by @mickael-menu in #499
- Fix handling EPUB
noteref
with nested elements by @mickael-menu in #503 - Fix broken EPUB selection in paginated mode by @mickael-menu in #502
- Make possible crashes of PSPDFKit more explicit by @qnga in #495
- Revamp format specifications and other changes by @qnga in #500
- Replace
Date
withInstant
by @mickael-menu in #506 - Documentation by @mickael-menu in #486
- Fix applying preferences while recreating EPUB fragments by @mickael-menu in #507
- Change LCP device name strategy by @mickael-menu in #508
- Support for the new 2.x LCP Profiles by @mickael-menu in #510
- 2.4.1 by @mickael-menu in #511
- Deprecate media1 and media2 navigators by @mickael-menu in #512
- Rename
archive
Link property by @mickael-menu in #514 - 3.0.0-beta.1 by @mickael-menu in #515
Full Changelog: 3.0.0-alpha.2...3.0.0-beta.1
2.4.1
3.0.0-alpha.2
Resources
Changelog
Added
Navigator
- The new
HyperlinkNavigator.Listener.shouldFollowInternalLink(Link, LinkContext?)
allows you to handle footnotes according to your preference.- By default, the navigator now moves to the footnote content instead of displaying a pop-up as it did in version 2.x.
LCP
- You can use
LcpService.injectLicenseDocument()
to insert an LCPL into a package, if you downloaded it manually instead of usingLcpService.acquirePublication()
.
Deprecated
Shared
- The
DownloadManager
introduced in version 3.0.0-alpha.1 has been removed due to the Android Download Manager introducing unnecessary complexities in the toolkit. Instead, we chose to enable apps to manually handle an LCP download withLcpService.injectLicenseDocument()
.
Commits
- Fix Maven Central publishing and refactor Gradle configurations by @mickael-menu in #452
- Use canonical EPUB HREFs by @mickael-menu in #453
- Extract footnote popups from the Epub navigator by @qnga in #448
- Implement sniffing of CSS and JS files by @io7m in #455
- Remove
android:clearTaskOnLaunch
by @mickael-menu in #459 - Cleanup Gradle and Version files, fix Dokka by @stevenzeck in #456
- Use Flow instead of LiveData by @stevenzeck in #461
- Bump
css-selector-generator
script dependency by @mickael-menu in #466 - Remove the download manager by @qnga in #465
- Small fix by @qnga in #467
- Use material3 for Compose views by @stevenzeck in #460
- Add LcpService.injectLicenseDocument by @qnga in #473
- Fix EPUB deobfuscation by @mickael-menu in #475
- Prevent infinite recursion in format sniffing by @qnga in #476
- Fix TTS player crash by @qnga in #477
- Update media3 and fix some issues with MediaService by @qnga in #478
- Simplify LcpService.injectLicense by @qnga in #479
- 3.0.0-alpha.2 by @mickael-menu in #480
New Contributors
Full Changelog: 3.0.0-alpha.1...3.0.0-alpha.2
3.0.0-alpha.1
Resources
Changelog
Added
Shared
- A new
Format
type was introduced to augmentMediaType
with more precise information about the format specifications of anAsset
. - The
DownloadManager
interface handles HTTP downloads. Components like theLcpService
rely on it for downloading publications. Readium v3 ships with two implementations:ForegroundDownloadManager
uses anHttpClient
to download files while the app is running.AndroidDownloadManager
is built upon Android'sDownloadManager
to manage HTTP downloads, even when the application is closed. It allows for resuming downloads after losing connection.
- The default
ZipArchiveOpener
now supports streaming ZIP archives, which enables opening a packaged publication (e.g. EPUB or LCP protected audiobook):- served by a remote HTTP server,
- accessed through an Android
ContentProvider
, such as the shared storage.
Navigator
- Support for keyboard events in the EPUB, PDF and image navigators. See
VisualNavigator.addInputListener()
.
LCP
- You can now stream an LCP protected publication using its LCP License Document. This is useful for example to read a large audiobook without downloading it on the device first.
- The hash of protected publications is now verified upon download.
Changed
⚠️ To avoid conflicts when merging your app resources, all resources declared in the Readium toolkit now have the prefixreadium_
. This means that you must rename any layouts or strings you have overridden. Some resources were removed from the toolkit. Please consult the migration guide.- Most APIs now return an
Error
instance instead of anException
in case of failure, as these objects are not thrown by the toolkit but returned as values
Shared
⚠️ To improve the interoperability with other Readium toolkits (in particular the Readium Web Toolkits, which only work in a streaming context) Readium v3 now generates and expects valid URLs forLocator
andLink
'shref
. You must migrate the HREFs or Locators stored in your database, please consult the migration guide.Link.href
andLocator.href
are now respectivelyHref
andUrl
objects. If you still need the string value, you can calltoString()
MediaType
no longer has static helpers for sniffing it from a file or URL. Instead, you can use anAssetRetriever
to retrieve the format of a file.
Navigator
- Version 3 includes a new component called
DirectionalNavigationAdapter
that replacesEdgeTapNavigation
. This helper enables users to navigate between pages using arrow and space keys on their keyboard or by tapping the edge of the screen. - The
onTap
andonDrag
events ofVisualNavigator.Listener
have been deprecated. You can now use multiple implementations ofInputListener
withVisualNavigator.addInputListener()
.
Streamer
- The
Streamer
object has been deprecated in favor of components with smaller responsibilities:AssetRetriever
andPublicationOpener
.
LCP
LcpService.acquirePublication()
is deprecated in favor ofLcpService.publicationRetriever()
, which provides greater flexibility thanks to theDownloadManager
.- The way the host view of a
LcpDialogAuthentication
is retrieved was changed to support Android configuration changes.
Deprecated
- Both the Fuel and Kovenant libraries have been completely removed from the toolkit. With that, several deprecated functions have also been removed.
Shared
- The
putPublication
andgetPublication
helpers inIntent
are deprecated. Now, it is the application's responsibility to passPublication
objects between activities and reopen them when necessary.
Navigator
- EPUB external links are no longer handled by the navigator. You need to open the link in your own Web View or Chrome Custom Tab.
2.4.0
Resources
Changelog
- Readium is now distributed with Maven Central. Take a look at the migration guide to update your Gradle configuration.
Added
Navigator
- The EPUB
backgroundColor
preference is now available with fixed-layout publications. - New
EPUBNavigatorFragment.Configuration.useReadiumCssFontSize
option to revert to the 2.2.0 strategy for setting the font size of reflowable EPUB publications.- The native font size strategy introduced in 2.3.0 uses the Android web view's
WebSettings.textZoom
property to adjust the font size. 2.2.0 was using Readium CSS's--USER__fontSize
variable. WebSettings.textZoom
will work with more publications than--USER__fontSize
, even the ones poorly authored. However the page width is not adjusted when changing the font size to keep the optimal line length.
- The native font size strategy introduced in 2.3.0 uses the Android web view's
- Scroll mode: jumping between two EPUB resources with a horizontal swipe triggers the
Navigator.Listener.onJumpToLocator()
callback.- This can be used to allow the user to go back to their previous location if they swiped across chapters by mistake.
- Support for non-linear EPUB resources with an opt-in in reading apps (contributed by @chrfalch in #375 and #376).
- Override loading non-linear resources with
VisualNavigator.Listener.shouldJumpToLink()
. - Present a new
EpubNavigatorFragment
by providing a customreadingOrder
with only this resource to the constructor.
- Override loading non-linear resources with
- Added dummy navigator fragment factories to prevent crashes caused by Android restoring the fragments after a process death.
- To use it, set the dummy fragment factory when you don't have access to the
Publication
instance. Then, either finish theActivity
or pop the fragment from the UI before it resumes.override fun onCreate(savedInstanceState: Bundle?) { val publication = model.publication ?: run { childFragmentManager.fragmentFactory = EpubNavigatorFragment.createDummyFactory() super.onCreate(savedInstanceState) requireActivity().finish() // or navController?.popBackStack() return } // Create the real navigator factory as usual... }
- To use it, set the dummy fragment factory when you don't have access to the
Streamer
- The EPUB content iterator now returns
audio
andvideo
elements.
Changed
Navigator
EpubNavigatorFragment.firstVisibleElementLocator()
now returns the first block element that is visible on the screen, even if it starts on previous pages.- This is used to make sure the user will not miss any context when restoring a TTS session in the middle of a resource.
Fixed
Navigator
- #360 Fix EPUB JavaScript interface injection when rotating the screen on some devices.
Streamer
- Fixed issue with the TTS starting from the beginning of the chapter instead of the current position.
2.3.0
Resources
Changelog
Added
Shared
- Extract the raw content (text, images, etc.) of a publication. Take a look at the user guide.
- Add support for unsafe HTTP redirections with
DefaultHttpClient
.- You will need to opt-in explicitly by implementing
DefaultHttpClient.Callback.onFollowUnsafeRedirect
.
- You will need to opt-in explicitly by implementing
Navigator
- Improved Javascript support in the EPUB navigator:
- Register custom JavascriptInterface objects to inject native Kotlin code in the EPUB web views.
EpubNavigatorFragment.createFactory( publication = publication, …, config = EpubNavigatorFragment.Configuration().apply { registerJavascriptInterface("customInterface") { link -> MyCustomApi(link) } } ) class MyCustomApi(val link: Link) { @JavascriptInterface fun api(arg: String): String { return "API called from the resource ${link.href} with argument $arg") } }
- Evaluate JavaScript on the currently visible HTML resource with
EpubNavigatorFragment.evaluateJavascript()
.val result = navigator.evaluateJavascript("customInterface.api('argument')")
- Register custom JavascriptInterface objects to inject native Kotlin code in the EPUB web views.
- New PSPDFKit adapter for rendering PDF documents. Take a look at the user guide.
- A brand new text-to-speech implementation.
- Support for custom fonts with the EPUB navigator.
- New EPUB user preferences, as part of the revamped Settings API:
backgroundColor
- Default page background color.fontWeight
- Base text font weight.textColor
- Default page text color.textNormalization
- Normalize font style, weight and variants, which improves accessibility.imageFilter
- Filter applied to images in dark theme (darken, invert colors)language
- Language of the publication content.readingProgression
- Direction of the reading progression across resources, e.g. RTL.typeScale
- Scale applied to all element font sizes.paragraphIndent
- Text indentation for paragraphs.paragraphSpacing
- Vertical margins for paragraphs.hyphens
- Enable hyphenation.ligatures
- Enable ligatures in Arabic.
- Fixed scroll inertia when scrolling an EPUB.
- EPUB decorations can now be attached to
Locator
objects containing only an HTML ID (locations.fragments
) or a CSS selector (locations.cssSelector
).
Changed
Shared
TransformingResource
now caches its content by default, as it is the correct behavior in most cases. SetcacheBytes = false
explicitly to revert to the previous behavior.- The previous PDF navigator was extracted in its own package to support third-party PDF engines. This is a breaking change if your app supported PDF, take a look at the migration guide.
Navigator
- The EPUB and PDF user preferences API got revamped. Take a look at the user guide and the migration guide to learn how to use it.
Decoration.extras
is now aMap<String, Any>
instead ofBundle
. You will need to update your app if you were storing custom data inextras
, for example:val decoration = Decoration(..., extras = mapOf("id" to id) ) val id = decoration.extras["id"] as? Long
Deprecated
Streamer
- The local HTTP server is not needed anymore to render EPUB publications. Take a look at the migration guide.
Fixed
Streamer
- Fixed parsing the table of contents of an EPUB 3 using NCX instead of a Navigation Document.
Navigator
- swift-toolkit#61 Fixed serving EPUB resources when the HREF contains an anchor or query parameters.
- Fixed emitting
currentLocator
with fixed layout EPUBs. - Prevent refreshing an already loaded EPUB resource when jumping to a
Locator
in it. - #86 Fixed page swipes while selecting text in an EPUB resource.
- The
onTap
event is not sent when an EPUB text selection is active anymore, to prevent showing the app bar while dismissing a selection. - #76 Fixed EPUB fixed layout font size affected by device settings.
Decoration
objects are now properly comparable withequals()
.- #292 Fix broken pagination when an EPUB uses
overflow-x: hidden
.