diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index ae750dd372..6d9d2e0003 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -12,6 +12,7 @@ repositories { gradlePluginPortal() google() mavenCentral() + maven("https://jitpack.io") } dependencies { diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 6a23e17f8c..588bc40489 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -56,9 +56,9 @@ ksp = "2.1.21-2.0.1" ktlint = "12.1.1" -# We cannot upgrade to 1.9.0 as it conflicts with liblcp. -# See https://github.com/readium/kotlin-toolkit/issues/29 #noinspection GradleDependency +pdfium = "1.9.8" +pdf-viewer = "3.2.8" picasso = "2.8" pspdfkit = "8.4.1" @@ -122,6 +122,8 @@ kotlinx-datetime = { group = "org.jetbrains.kotlinx", name = "kotlinx-datetime", kotlinx-serialization-json = { group = "org.jetbrains.kotlinx", name = "kotlinx-serialization-json", version.ref = "kotlinx-serialization-json" } kotlinx-collections-immutable = { group = "org.jetbrains.kotlinx", name = "kotlinx-collections-immutable", version.ref = "kotlinx-collections-immutable" } +pdfium = { group = "com.github.marain87", name = "PdfiumAndroid", version.ref = "pdfium" } +pdfviewer = { group = "com.github.marain87", name = "AndroidPdfViewer", version.ref = "pdf-viewer" } picasso = { group = "com.squareup.picasso", name = "picasso", version.ref = "picasso" } pspdfkit = { group = "com.pspdfkit", name = "pspdfkit", version.ref ="pspdfkit" } diff --git a/readium/adapters/pdfium/common/build.gradle.kts b/readium/adapters/pdfium/common/build.gradle.kts deleted file mode 100644 index 39ac763ba6..0000000000 --- a/readium/adapters/pdfium/common/build.gradle.kts +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright 2022 Readium Foundation. All rights reserved. - * Use of this source code is governed by the BSD-style license - * available in the top-level LICENSE file of the project. - */ - -plugins { - id("readium.library-conventions") -} - -android { - namespace = "org.readium.adapter.pdfium.common" -} - -dependencies { - api(files("libs/pdfium-android-1.8.2.jar")) -} diff --git a/readium/adapters/pdfium/common/gradle.properties b/readium/adapters/pdfium/common/gradle.properties deleted file mode 100644 index 01ff8cb739..0000000000 --- a/readium/adapters/pdfium/common/gradle.properties +++ /dev/null @@ -1 +0,0 @@ -pom.artifactId=readium-adapter-pdfium-common diff --git a/readium/adapters/pdfium/common/libs/pdfium-android-1.8.2.jar b/readium/adapters/pdfium/common/libs/pdfium-android-1.8.2.jar deleted file mode 100644 index 0eb0a55613..0000000000 Binary files a/readium/adapters/pdfium/common/libs/pdfium-android-1.8.2.jar and /dev/null differ diff --git a/readium/adapters/pdfium/common/src/main/AndroidManifest.xml b/readium/adapters/pdfium/common/src/main/AndroidManifest.xml deleted file mode 100644 index 2d10029868..0000000000 --- a/readium/adapters/pdfium/common/src/main/AndroidManifest.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/readium/adapters/pdfium/common/src/main/jniLibs/arm64-v8a/libjniPdfium.so b/readium/adapters/pdfium/common/src/main/jniLibs/arm64-v8a/libjniPdfium.so deleted file mode 100644 index c4704ea1d4..0000000000 Binary files a/readium/adapters/pdfium/common/src/main/jniLibs/arm64-v8a/libjniPdfium.so and /dev/null differ diff --git a/readium/adapters/pdfium/common/src/main/jniLibs/arm64-v8a/libmodft2.so b/readium/adapters/pdfium/common/src/main/jniLibs/arm64-v8a/libmodft2.so deleted file mode 100644 index dc6f24340a..0000000000 Binary files a/readium/adapters/pdfium/common/src/main/jniLibs/arm64-v8a/libmodft2.so and /dev/null differ diff --git a/readium/adapters/pdfium/common/src/main/jniLibs/arm64-v8a/libmodpdfium.so b/readium/adapters/pdfium/common/src/main/jniLibs/arm64-v8a/libmodpdfium.so deleted file mode 100644 index dd0fc9d2ee..0000000000 Binary files a/readium/adapters/pdfium/common/src/main/jniLibs/arm64-v8a/libmodpdfium.so and /dev/null differ diff --git a/readium/adapters/pdfium/common/src/main/jniLibs/arm64-v8a/libmodpng.so b/readium/adapters/pdfium/common/src/main/jniLibs/arm64-v8a/libmodpng.so deleted file mode 100644 index 0da7307baa..0000000000 Binary files a/readium/adapters/pdfium/common/src/main/jniLibs/arm64-v8a/libmodpng.so and /dev/null differ diff --git a/readium/adapters/pdfium/common/src/main/jniLibs/armeabi-v7a/libjniPdfium.so b/readium/adapters/pdfium/common/src/main/jniLibs/armeabi-v7a/libjniPdfium.so deleted file mode 100644 index 7cf9cb4bb5..0000000000 Binary files a/readium/adapters/pdfium/common/src/main/jniLibs/armeabi-v7a/libjniPdfium.so and /dev/null differ diff --git a/readium/adapters/pdfium/common/src/main/jniLibs/armeabi-v7a/libmodft2.so b/readium/adapters/pdfium/common/src/main/jniLibs/armeabi-v7a/libmodft2.so deleted file mode 100644 index bd9bb6a0ff..0000000000 Binary files a/readium/adapters/pdfium/common/src/main/jniLibs/armeabi-v7a/libmodft2.so and /dev/null differ diff --git a/readium/adapters/pdfium/common/src/main/jniLibs/armeabi-v7a/libmodpdfium.so b/readium/adapters/pdfium/common/src/main/jniLibs/armeabi-v7a/libmodpdfium.so deleted file mode 100644 index 85a7b23213..0000000000 Binary files a/readium/adapters/pdfium/common/src/main/jniLibs/armeabi-v7a/libmodpdfium.so and /dev/null differ diff --git a/readium/adapters/pdfium/common/src/main/jniLibs/armeabi-v7a/libmodpng.so b/readium/adapters/pdfium/common/src/main/jniLibs/armeabi-v7a/libmodpng.so deleted file mode 100644 index 5ebdff8fa3..0000000000 Binary files a/readium/adapters/pdfium/common/src/main/jniLibs/armeabi-v7a/libmodpng.so and /dev/null differ diff --git a/readium/adapters/pdfium/common/src/main/jniLibs/armeabi/libjniPdfium.so b/readium/adapters/pdfium/common/src/main/jniLibs/armeabi/libjniPdfium.so deleted file mode 100644 index 3659beb77b..0000000000 Binary files a/readium/adapters/pdfium/common/src/main/jniLibs/armeabi/libjniPdfium.so and /dev/null differ diff --git a/readium/adapters/pdfium/common/src/main/jniLibs/armeabi/libmodft2.so b/readium/adapters/pdfium/common/src/main/jniLibs/armeabi/libmodft2.so deleted file mode 100644 index bd9bb6a0ff..0000000000 Binary files a/readium/adapters/pdfium/common/src/main/jniLibs/armeabi/libmodft2.so and /dev/null differ diff --git a/readium/adapters/pdfium/common/src/main/jniLibs/armeabi/libmodpdfium.so b/readium/adapters/pdfium/common/src/main/jniLibs/armeabi/libmodpdfium.so deleted file mode 100644 index 85a7b23213..0000000000 Binary files a/readium/adapters/pdfium/common/src/main/jniLibs/armeabi/libmodpdfium.so and /dev/null differ diff --git a/readium/adapters/pdfium/common/src/main/jniLibs/armeabi/libmodpng.so b/readium/adapters/pdfium/common/src/main/jniLibs/armeabi/libmodpng.so deleted file mode 100644 index 5ebdff8fa3..0000000000 Binary files a/readium/adapters/pdfium/common/src/main/jniLibs/armeabi/libmodpng.so and /dev/null differ diff --git a/readium/adapters/pdfium/common/src/main/jniLibs/mips/libjniPdfium.so b/readium/adapters/pdfium/common/src/main/jniLibs/mips/libjniPdfium.so deleted file mode 100644 index 36621c4a90..0000000000 Binary files a/readium/adapters/pdfium/common/src/main/jniLibs/mips/libjniPdfium.so and /dev/null differ diff --git a/readium/adapters/pdfium/common/src/main/jniLibs/mips/libmodft2.so b/readium/adapters/pdfium/common/src/main/jniLibs/mips/libmodft2.so deleted file mode 100644 index 1ce95469f0..0000000000 Binary files a/readium/adapters/pdfium/common/src/main/jniLibs/mips/libmodft2.so and /dev/null differ diff --git a/readium/adapters/pdfium/common/src/main/jniLibs/mips/libmodpdfium.so b/readium/adapters/pdfium/common/src/main/jniLibs/mips/libmodpdfium.so deleted file mode 100644 index 3bcf661912..0000000000 Binary files a/readium/adapters/pdfium/common/src/main/jniLibs/mips/libmodpdfium.so and /dev/null differ diff --git a/readium/adapters/pdfium/common/src/main/jniLibs/mips/libmodpng.so b/readium/adapters/pdfium/common/src/main/jniLibs/mips/libmodpng.so deleted file mode 100644 index 373f7d42a5..0000000000 Binary files a/readium/adapters/pdfium/common/src/main/jniLibs/mips/libmodpng.so and /dev/null differ diff --git a/readium/adapters/pdfium/common/src/main/jniLibs/x86/libjniPdfium.so b/readium/adapters/pdfium/common/src/main/jniLibs/x86/libjniPdfium.so deleted file mode 100644 index 2408ce87bb..0000000000 Binary files a/readium/adapters/pdfium/common/src/main/jniLibs/x86/libjniPdfium.so and /dev/null differ diff --git a/readium/adapters/pdfium/common/src/main/jniLibs/x86/libmodft2.so b/readium/adapters/pdfium/common/src/main/jniLibs/x86/libmodft2.so deleted file mode 100644 index 0829637e4c..0000000000 Binary files a/readium/adapters/pdfium/common/src/main/jniLibs/x86/libmodft2.so and /dev/null differ diff --git a/readium/adapters/pdfium/common/src/main/jniLibs/x86/libmodpdfium.so b/readium/adapters/pdfium/common/src/main/jniLibs/x86/libmodpdfium.so deleted file mode 100644 index 266c68ef31..0000000000 Binary files a/readium/adapters/pdfium/common/src/main/jniLibs/x86/libmodpdfium.so and /dev/null differ diff --git a/readium/adapters/pdfium/common/src/main/jniLibs/x86/libmodpng.so b/readium/adapters/pdfium/common/src/main/jniLibs/x86/libmodpng.so deleted file mode 100644 index 31d7bf49d4..0000000000 Binary files a/readium/adapters/pdfium/common/src/main/jniLibs/x86/libmodpng.so and /dev/null differ diff --git a/readium/adapters/pdfium/common/src/main/jniLibs/x86_64/libjniPdfium.so b/readium/adapters/pdfium/common/src/main/jniLibs/x86_64/libjniPdfium.so deleted file mode 100644 index 49b5c5266a..0000000000 Binary files a/readium/adapters/pdfium/common/src/main/jniLibs/x86_64/libjniPdfium.so and /dev/null differ diff --git a/readium/adapters/pdfium/common/src/main/jniLibs/x86_64/libmodft2.so b/readium/adapters/pdfium/common/src/main/jniLibs/x86_64/libmodft2.so deleted file mode 100644 index 900913cb44..0000000000 Binary files a/readium/adapters/pdfium/common/src/main/jniLibs/x86_64/libmodft2.so and /dev/null differ diff --git a/readium/adapters/pdfium/common/src/main/jniLibs/x86_64/libmodpdfium.so b/readium/adapters/pdfium/common/src/main/jniLibs/x86_64/libmodpdfium.so deleted file mode 100644 index 89f4e84130..0000000000 Binary files a/readium/adapters/pdfium/common/src/main/jniLibs/x86_64/libmodpdfium.so and /dev/null differ diff --git a/readium/adapters/pdfium/common/src/main/jniLibs/x86_64/libmodpng.so b/readium/adapters/pdfium/common/src/main/jniLibs/x86_64/libmodpng.so deleted file mode 100644 index 11eeaa480c..0000000000 Binary files a/readium/adapters/pdfium/common/src/main/jniLibs/x86_64/libmodpng.so and /dev/null differ diff --git a/readium/adapters/pdfium/document/build.gradle.kts b/readium/adapters/pdfium/document/build.gradle.kts index cc786d4012..55954870e8 100644 --- a/readium/adapters/pdfium/document/build.gradle.kts +++ b/readium/adapters/pdfium/document/build.gradle.kts @@ -14,8 +14,7 @@ android { dependencies { api(project(":readium:readium-shared")) - implementation(project(":readium:adapters:pdfium:readium-adapter-pdfium-common")) - + implementation(libs.pdfviewer) implementation(libs.timber) implementation(libs.kotlinx.coroutines.android) } diff --git a/readium/adapters/pdfium/navigator/build.gradle.kts b/readium/adapters/pdfium/navigator/build.gradle.kts index ac7c0b3ea9..f3a20823a6 100644 --- a/readium/adapters/pdfium/navigator/build.gradle.kts +++ b/readium/adapters/pdfium/navigator/build.gradle.kts @@ -21,8 +21,8 @@ dependencies { api(project(":readium:readium-shared")) api(project(":readium:readium-navigator")) api(project(":readium:adapters:pdfium:readium-adapter-pdfium-document")) - implementation(project(":readium:adapters:pdfium:readium-adapter-pdfium-common")) - implementation(files("libs/android-pdf-viewer-2.8.2.jar")) + implementation(libs.pdfium) + implementation(libs.pdfviewer) implementation(libs.androidx.fragment.ktx) implementation(libs.timber) diff --git a/readium/adapters/pdfium/navigator/src/main/java/org/readium/adapter/pdfium/navigator/PdfiumDocumentFragment.kt b/readium/adapters/pdfium/navigator/src/main/java/org/readium/adapter/pdfium/navigator/PdfiumDocumentFragment.kt index ddc1cd957a..447b628ef5 100644 --- a/readium/adapters/pdfium/navigator/src/main/java/org/readium/adapter/pdfium/navigator/PdfiumDocumentFragment.kt +++ b/readium/adapters/pdfium/navigator/src/main/java/org/readium/adapter/pdfium/navigator/PdfiumDocumentFragment.kt @@ -128,9 +128,9 @@ public class PdfiumDocumentFragment internal constructor( // navigator. .apply { listener?.onConfigurePdfView(this) } .defaultPage(page) - .onRender { _, _, _ -> + .onRender { if (settings.fit == Fit.WIDTH) { - pdfView.fitToWidth() + pdfView.fitToWidth(page) // Using `fitToWidth` often breaks the use of `defaultPage`, so we // need to jump manually to the target page. pdfView.jumpTo(page, false) diff --git a/settings.gradle.kts b/settings.gradle.kts index 3f4779fd7f..cecf327a4b 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -12,15 +12,12 @@ dependencyResolutionManagement { mavenCentral() maven(url = "https://s3.amazonaws.com/repo.commonsware.com") maven(url = "https://customers.pspdfkit.com/maven") + maven(url = "https://jitpack.io") } } rootProject.name = "Readium" -include(":readium:adapters:pdfium:common") -project(":readium:adapters:pdfium:common") - .name = "readium-adapter-pdfium-common" - include(":readium:adapters:pdfium:document") project(":readium:adapters:pdfium:document") .name = "readium-adapter-pdfium-document"