|
1 | 1 | # Readium Kotlin Toolkit |
2 | 2 |
|
| 3 | +[Readium Mobile](https://github.com/readium/mobile) is a toolkit for ebooks, audiobooks and comics written in Swift & Kotlin. |
| 4 | + |
| 5 | +This toolkit is a modular project, which follows the [Readium Architecture](https://github.com/readium/architecture). The different modules are found under [`readium/`](readium). |
| 6 | + |
| 7 | +* [`shared`](readium/shared) – Shared `Publication` models and utilities |
| 8 | +* [`streamer`](readium/streamer) – Publication parsers and local HTTP server |
| 9 | +* [`navigator`](readium/navigator) – Plain `Fragment` and `Activity` classes rendering publications |
| 10 | +* [`opds`](readium/opds) – Parsers for OPDS catalog feeds |
| 11 | +* [`lcp`](readium/lcp) – Service and models for [Readium LCP](https://www.edrlab.org/readium-lcp/) |
| 12 | + |
| 13 | +A [Test App](test-app) demonstrates how to integrate the Readium Kotlin toolkit in your own reading app |
| 14 | + |
| 15 | +## Using Readium |
| 16 | + |
| 17 | +Readium modules are distributed through [JitPack](https://jitpack.io/#readium/kotlin-toolkit). It's also possible to clone the repository (or a fork) and depend on the modules locally. |
| 18 | + |
| 19 | +### From the JitPack Maven repository |
| 20 | + |
| 21 | +Make sure that you have the `$readium_version` property set in your root `build.gradle` and add the JitPack repository. |
| 22 | + |
| 23 | +```gradle |
| 24 | +buildscript { |
| 25 | + ext.readium_version = '2.1.0' |
| 26 | +} |
| 27 | +
|
| 28 | +allprojects { |
| 29 | + repositories { |
| 30 | + maven { url 'https://jitpack.io' } |
| 31 | + } |
| 32 | +} |
| 33 | +``` |
| 34 | + |
| 35 | +Then, add the dependencies to the Readium modules you need in your app's `build.gradle`. |
| 36 | + |
| 37 | +```gradle |
| 38 | +dependencies { |
| 39 | + implementation "com.github.readium.kotlin-toolkit:readium-shared:$readium_version" |
| 40 | + implementation "com.github.readium.kotlin-toolkit:readium-streamer:$readium_version" |
| 41 | + implementation "com.github.readium.kotlin-toolkit:readium-navigator:$readium_version" |
| 42 | + implementation "com.github.readium.kotlin-toolkit:readium-opds:$readium_version" |
| 43 | + implementation "com.github.readium.kotlin-toolkit:readium-lcp:$readium_version" |
| 44 | +} |
| 45 | +``` |
| 46 | + |
| 47 | +### From a local Git clone |
| 48 | + |
| 49 | +You may prefer to use a local Git clone if you want to contribute to Readium, or if you are using your own fork. |
| 50 | + |
| 51 | +First, add the repository as a Git submodule of your app repository, then checkout the desired branch or tag: |
| 52 | + |
| 53 | +```sh |
| 54 | +git submodule add https://github.com/readium/kotlin-toolkit.git |
| 55 | +``` |
| 56 | + |
| 57 | +Next, declare the Kotlin version used in your root `build.gradle`. |
| 58 | + |
| 59 | +```gradle |
| 60 | +buildscript { |
| 61 | + ext.kotlin_version = '1.5.31' |
| 62 | +} |
| 63 | +``` |
| 64 | + |
| 65 | +Then, add the following to your project's `settings.gradle` file, altering the paths if needed. Keep only the modules you want to use. |
| 66 | + |
| 67 | +```gradle |
| 68 | +include ':readium:shared' |
| 69 | +project(':readium:shared').projectDir = file('kotlin-toolkit/readium/shared') |
| 70 | +
|
| 71 | +include ':readium:streamer' |
| 72 | +project(':readium:streamer').projectDir = file('kotlin-toolkit/readium/streamer') |
| 73 | +
|
| 74 | +include ':readium:navigator' |
| 75 | +project(':readium:navigator').projectDir = file('kotlin-toolkit/readium/navigator') |
| 76 | +
|
| 77 | +include ':readium:opds' |
| 78 | +project(':readium:opds').projectDir = file('kotlin-toolkit/readium/opds') |
| 79 | +
|
| 80 | +include ':readium:lcp' |
| 81 | +project(':readium:lcp').projectDir = file('kotlin-toolkit/readium/lcp') |
| 82 | +``` |
| 83 | + |
| 84 | +You should now see the Readium modules appear as part of your project. You can depend on them as you would on any other local module: |
| 85 | + |
| 86 | +``` |
| 87 | +dependencies { |
| 88 | + implementation project(':readium:shared') |
| 89 | + implementation project(':readium:streamer') |
| 90 | + implementation project(':readium:navigator') |
| 91 | + implementation project(':readium:opds') |
| 92 | + implementation project(':readium:lcp') |
| 93 | +} |
| 94 | +``` |
| 95 | + |
| 96 | +### Building with Readium LCP |
| 97 | + |
| 98 | +Using the toolkit with Readium LCP requires additional dependencies, including the binary `liblcp` provided by EDRLab. [Contact EDRLab](mailto:contact@edrlab.org) to request your private `liblcp` and the setup instructions. |
0 commit comments