diff --git a/CHANGELOG.md b/CHANGELOG.md index 7652d133..a1c1f096 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,16 @@ +## 3.2.4 (2024-03-19) +* Update [PdfiumAndroid library](https://github.com/lion1988dev/PdfiumAndroid) to 1.9.4 + +## 3.2.3 (2024-03-18) +* Change minimum SDK version to 21 +* Update [PdfiumAndroid library](https://github.com/lion1988dev/PdfiumAndroid) to 1.9.3 + +## 3.2.1 (2024-03-10) +* Change minimum SDK version to 19 +* Drop MIPS support +* Update to Androidx +* Switch pdfium-android to a [fork](https://github.com/lion1988dev/PdfiumAndroid) so we can disable jetifier + ## 3.2.0-beta.1 (2019-08-18) * Merge PR #714 with optimized page load * Merge PR #776 with fix for max & min zoom level diff --git a/README.md b/README.md index 72fe8678..1fa2bedb 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ -# Looking for new maintainer! +#### This is a fork of the [AndroidPdfViewer](https://github.com/barteksc/AndroidPdfViewer) +switch back to the mainline repo when it gets migrated off JCenter # Android PdfViewer @@ -12,6 +13,20 @@ Library for displaying PDF documents on Android, with `animations`, `gestures`, It is based on [PdfiumAndroid](https://github.com/barteksc/PdfiumAndroid) for decoding PDF files. Works on API 11 (Android 3.0) and higher. Licensed under Apache License 2.0. +## 3.2.4 +* Update [PdfiumAndroid library](https://github.com/lion1988dev/PdfiumAndroid) to 1.9.4 + + +## 3.2.3 +* Change minimum SDK version to 21 +* Update [PdfiumAndroid library](https://github.com/lion1988dev/PdfiumAndroid) to 1.9.3 + +## 3.2.1 +* Change minimum SDK version to 23 +* Drop MIPS support +* Update to Androidx +* Switch pdfium-android to a [fork](https://github.com/lion1988dev/PdfiumAndroid) so we can disable jetifier + ## What's new in 3.2.0-beta.1? * Merge PR #714 with optimized page load * Merge PR #776 with fix for max & min zoom level @@ -35,15 +50,19 @@ Licensed under Apache License 2.0. ## Installation -Add to _build.gradle_: - -`implementation 'com.github.barteksc:android-pdf-viewer:3.2.0-beta.1'` - -or if you want to use more stable version: - -`implementation 'com.github.barteksc:android-pdf-viewer:2.8.2'` +Add to the root _build.gradle_: +```groovy +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + mavenCentral() + maven { url 'https://jitpack.io' } + } + } +``` +Add to the app _build.gradle_: -Library is available in jcenter repository, probably it'll be in Maven Central soon. +`implementation 'com.github.lion1988dev:AndroidPdfViewer:3.2.3'` ## ProGuard If you are using ProGuard, add following rule to proguard config file: diff --git a/android-pdf-viewer/bintray.gradle b/android-pdf-viewer/bintray.gradle deleted file mode 100644 index 9a01f197..00000000 --- a/android-pdf-viewer/bintray.gradle +++ /dev/null @@ -1,89 +0,0 @@ -apply plugin: 'com.github.dcendents.android-maven' -apply plugin: 'com.jfrog.bintray' - -group = publishedGroupId -version = libraryVersion - -install { - repositories.mavenInstaller { - pom.project { - packaging 'aar' - groupId publishedGroupId - artifactId artifact - - name libraryName - description libraryDescription - url siteUrl - - licenses { - license { - name licenseName - url licenseUrl - } - } - developers { - developer { - id developerId - name developerName - email developerEmail - } - } - scm { - connection gitUrl - developerConnection gitUrl - url siteUrl - } - } - } -} - -task sourcesJar(type: Jar) { - classifier = 'sources' - from android.sourceSets.main.java.srcDirs -} - -task javadoc(type: Javadoc) { - source = android.sourceSets.main.java.srcDirs - classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) -} - -afterEvaluate { - javadoc.classpath += files(android.libraryVariants.collect { variant -> - variant.javaCompileProvider.get().classpath.files - }) -} - -task javadocJar(type: Jar, dependsOn: javadoc) { - classifier = 'javadoc' - from javadoc.destinationDir -} - -artifacts { - archives javadocJar - archives sourcesJar -} - -Properties properties = new Properties() -properties.load(project.rootProject.file('local.properties').newDataInputStream()) - -bintray { - user = properties.getProperty("bintray.user") - key = properties.getProperty("bintray.apikey") - - configurations = ['archives'] - pkg { - repo = bintrayRepo - name = bintrayName - desc = libraryDescription - websiteUrl = siteUrl - vcsUrl = gitUrl - licenses = allLicenses - dryRun = false - publish = true - override = false - publicDownloadNumbers = true - version { - desc = libraryDescription - } - } -} \ No newline at end of file diff --git a/android-pdf-viewer/build.gradle b/android-pdf-viewer/build.gradle index 32d03665..9f48e95c 100644 --- a/android-pdf-viewer/build.gradle +++ b/android-pdf-viewer/build.gradle @@ -1,44 +1,60 @@ -apply plugin: 'com.android.library' - -ext { - bintrayRepo = 'maven' - bintrayName = 'android-pdf-viewer' - - publishedGroupId = 'com.github.barteksc' - libraryName = 'AndroidPdfViewer' - artifact = 'android-pdf-viewer' +plugins { + id 'com.android.library' + id 'maven-publish' +} - libraryDescription = 'Android view for displaying PDFs rendered with PdfiumAndroid' +group "com.github.lion1988dev" - siteUrl = 'https://github.com/barteksc/AndroidPdfViewer' - gitUrl = 'https://github.com/barteksc/AndroidPdfViewer.git' +android { + namespace "com.github.barteksc.pdfviewer" - libraryVersion = '3.2.0-beta.1' + compileSdk rootProject.tools.compileSdk - developerId = 'barteksc' - developerName = 'Bartosz Schiller' - developerEmail = 'barteksch@boo.pl' + defaultConfig { + minSdk rootProject.tools.minSdk + targetSdk rootProject.tools.targetSdk - licenseName = 'The Apache Software License, Version 2.0' - licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt' - allLicenses = ["Apache-2.0"] -} + versionCode rootProject.tools.versionCode + versionName "${rootProject.tools.versionName}" + } -android { - compileSdkVersion 28 + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } - defaultConfig { - minSdkVersion 14 - targetSdkVersion 28 - versionCode 1 - versionName "3.2.0-beta.1" + compileOptions { + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } + publishing { + publishing { + singleVariant("release") { + withSourcesJar() + withJavadocJar() + } + } + } } dependencies { - implementation 'com.android.support:support-compat:28.0.0' - api 'com.github.barteksc:pdfium-android:1.9.0' + implementation 'androidx.appcompat:appcompat:1.6.1' + api 'com.github.lion1988dev:PdfiumAndroid:1.9.4' } -apply from: 'bintray.gradle' \ No newline at end of file +publishing { + publications { + release(MavenPublication) { + groupId = 'com.github.lion1988dev' + artifactId = 'AndroidPdfViewer' + version = "3.2.4" + + afterEvaluate { + from components.release + } + } + } +} \ No newline at end of file diff --git a/android-pdf-viewer/consumer-rules.pro b/android-pdf-viewer/consumer-rules.pro new file mode 100644 index 00000000..e69de29b diff --git a/android-pdf-viewer/proguard-rules.pro b/android-pdf-viewer/proguard-rules.pro new file mode 100644 index 00000000..8dbc9fc1 --- /dev/null +++ b/android-pdf-viewer/proguard-rules.pro @@ -0,0 +1,22 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile +-keep class com.shockwave.** diff --git a/android-pdf-viewer/src/main/AndroidManifest.xml b/android-pdf-viewer/src/main/AndroidManifest.xml index 4263d3a5..f0dcb5ed 100644 --- a/android-pdf-viewer/src/main/AndroidManifest.xml +++ b/android-pdf-viewer/src/main/AndroidManifest.xml @@ -1,5 +1,4 @@ - + \ No newline at end of file diff --git a/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/CacheManager.java b/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/CacheManager.java index 082ca3bf..8ba04a53 100644 --- a/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/CacheManager.java +++ b/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/CacheManager.java @@ -16,7 +16,7 @@ package com.github.barteksc.pdfviewer; import android.graphics.RectF; -import android.support.annotation.Nullable; +import androidx.annotation.Nullable; import com.github.barteksc.pdfviewer.model.PagePart; diff --git a/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/scroll/DefaultScrollHandle.java b/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/scroll/DefaultScrollHandle.java index 8195a540..aa9206b4 100644 --- a/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/scroll/DefaultScrollHandle.java +++ b/android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/scroll/DefaultScrollHandle.java @@ -4,7 +4,7 @@ import android.graphics.Color; import android.graphics.drawable.Drawable; import android.os.Handler; -import android.support.v4.content.ContextCompat; +import androidx.core.content.ContextCompat; import android.util.TypedValue; import android.view.MotionEvent; import android.view.ViewGroup; diff --git a/build.gradle b/build.gradle index 0a9a0ba0..395eeff6 100644 --- a/build.gradle +++ b/build.gradle @@ -1,19 +1,14 @@ - -buildscript { - repositories { - google() - jcenter() - } - dependencies { - classpath 'com.android.tools.build:gradle:3.4.2' - classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4' - classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1' - } +plugins { + id 'com.android.application' version '8.3.0' apply false + id 'com.android.library' version '8.3.0' apply false } -allprojects { - repositories { - google() - jcenter() - } +ext { + tools = [ + minSdk : 21, + targetSdk : 34, + compileSdk : 34, + versionCode: 3, + versionName: '3.2.4' + ] } diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 00000000..7ba01846 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,3 @@ +android.enableJetifier=false +android.useAndroidX=true +android.nonFinalResIds=false diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 1a59b22b..dd5eae38 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Sun Aug 18 01:14:14 CEST 2019 +#Sun Mar 10 12:47:57 EET 2024 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip diff --git a/sample/build.gradle b/sample/build.gradle index 133bcdde..ab1f8403 100644 --- a/sample/build.gradle +++ b/sample/build.gradle @@ -1,32 +1,33 @@ -buildscript { - repositories { - google() - jcenter() - } -} - -repositories { - google() - jcenter() +plugins { + id 'com.android.application' } -apply plugin: 'com.android.application' - android { - compileSdkVersion 28 + namespace "com.github.barteksc.sample" + + compileSdk rootProject.tools.compileSdk defaultConfig { - minSdkVersion 14 - targetSdkVersion 28 + minSdk rootProject.tools.minSdk + targetSdk rootProject.tools.targetSdk + versionCode 3 - versionName "3.0.0" - } + versionName "${rootProject.tools.versionName}" + javaCompileOptions { + annotationProcessorOptions { + arguments = ["androidManifestFile": "$projectDir/src/main/AndroidManifest.xml".toString()] + } + } + } } dependencies { + implementation 'androidx.appcompat:appcompat:1.6.1' implementation project(':android-pdf-viewer') - implementation 'com.android.support:appcompat-v7:28.0.0' +// implementation 'com.github.lion1988dev:AndroidPdfViewer:3.2.1' + implementation 'org.androidannotations:androidannotations-api:4.6.0' + annotationProcessor "org.androidannotations:androidannotations:4.6.0" } diff --git a/sample/src/main/AndroidManifest.xml b/sample/src/main/AndroidManifest.xml index d6ce646c..2777d3dd 100644 --- a/sample/src/main/AndroidManifest.xml +++ b/sample/src/main/AndroidManifest.xml @@ -7,14 +7,18 @@ android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/Theme.AppCompat.Light"> + + android:exported="true"> + + + \ No newline at end of file diff --git a/sample/src/main/java/com/github/barteksc/sample/PDFViewActivity.java b/sample/src/main/java/com/github/barteksc/sample/PDFViewActivity.java index d23b0008..1a9ec7ea 100755 --- a/sample/src/main/java/com/github/barteksc/sample/PDFViewActivity.java +++ b/sample/src/main/java/com/github/barteksc/sample/PDFViewActivity.java @@ -22,10 +22,10 @@ import android.graphics.Color; import android.net.Uri; import android.provider.OpenableColumns; -import android.support.annotation.NonNull; -import android.support.v4.app.ActivityCompat; -import android.support.v4.content.ContextCompat; -import android.support.v7.app.AppCompatActivity; +import androidx.annotation.NonNull; +import androidx.core.app.ActivityCompat; +import androidx.core.content.ContextCompat; +import androidx.appcompat.app.AppCompatActivity; import android.util.Log; import android.widget.Toast; diff --git a/settings.gradle b/settings.gradle index 90ef0b93..64fac2de 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,2 +1,19 @@ +pluginManagement { + repositories { + gradlePluginPortal() + google() + mavenCentral() + } +} +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + maven { url 'https://jitpack.io' } + } +} +rootProject.name = "AndroidPdfViewer demo" + include ':android-pdf-viewer' -include ':sample' \ No newline at end of file +include ':sample'