Skip to content

Commit

Permalink
Merged #2
Browse files Browse the repository at this point in the history
  • Loading branch information
TalbotGooday committed Aug 7, 2020
1 parent 6f7fb20 commit c4208ae
Show file tree
Hide file tree
Showing 14 changed files with 182 additions and 256 deletions.
89 changes: 0 additions & 89 deletions android-pdf-viewer/bintray.gradle

This file was deleted.

35 changes: 4 additions & 31 deletions android-pdf-viewer/build.gradle
Original file line number Diff line number Diff line change
@@ -1,44 +1,17 @@
apply plugin: 'com.android.library'

ext {
bintrayRepo = 'maven'
bintrayName = 'android-pdf-viewer'

publishedGroupId = 'com.github.barteksc'
libraryName = 'AndroidPdfViewer'
artifact = 'android-pdf-viewer'

libraryDescription = 'Android view for displaying PDFs rendered with PdfiumAndroid'

siteUrl = 'https://github.com/barteksc/AndroidPdfViewer'
gitUrl = 'https://github.com/barteksc/AndroidPdfViewer.git'

libraryVersion = '3.2.0-beta.1'

developerId = 'barteksc'
developerName = 'Bartosz Schiller'
developerEmail = '[email protected]'

licenseName = 'The Apache Software License, Version 2.0'
licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
allLicenses = ["Apache-2.0"]
}

android {
compileSdkVersion 29

defaultConfig {
minSdkVersion 14
minSdkVersion 16
targetSdkVersion 29
versionCode 1
versionName "3.2.0-beta.1"
}

}

dependencies {
implementation 'androidx.core:core:1.2.0'
api 'com.github.barteksc:pdfium-android:1.9.0'
}

apply from: 'bintray.gradle'
implementation 'androidx.core:core:1.3.1'
api 'com.github.TalbotGooday:PdfiumAndroid:1.0.1'
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,19 @@ protected Throwable doInBackground(Void... params) {
PDFView pdfView = pdfViewReference.get();
if (pdfView != null) {
PdfDocument pdfDocument = docSource.createDocument(pdfView.getContext(), pdfiumCore, password);
pdfFile = new PdfFile(pdfiumCore, pdfDocument, pdfView.getPageFitPolicy(), getViewSize(pdfView),
userPages, pdfView.isOnDualPageMode(), pdfView.isSwipeVertical(), pdfView.getSpacingPx(), pdfView.isAutoSpacingEnabled(),
pdfView.isFitEachPage(), pdfView.isOnLandscapeOrientation());
pdfFile = new PdfFile(
pdfiumCore,
pdfDocument,
pdfView.getPageFitPolicy(),
getViewSize(pdfView),
userPages,
pdfView.isOnDualPageMode(),
pdfView.isSwipeVertical(),
pdfView.getSpacingPx(),
pdfView.isAutoSpacingEnabled(),
pdfView.isFitEachPage(),
pdfView.isOnLandscapeOrientation()
);
return null;
} else {
return new NullPointerException("pdfView == null");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,9 @@ enum ScrollDir {

private boolean isLandscapeOrientation = false;

/** True if should scroll through pages vertically instead of horizontally */
/**
* True if should scroll through pages vertically instead of horizontally
*/
private boolean swipeVertical = true;

private boolean enableSwipe = true;
Expand Down Expand Up @@ -807,7 +809,7 @@ void loadComplete(PdfFile pdfFile) {

this.pdfFile = pdfFile;

if(renderingHandlerThread == null){
if (renderingHandlerThread == null) {
renderingHandlerThread = new HandlerThread("PDF renderer");
}

Expand Down Expand Up @@ -1242,9 +1244,13 @@ public boolean isOnDualPageMode() {
return dualPageMode;
}

public boolean isOnLandscapeOrientation() { return isLandscapeOrientation; }
public boolean isOnLandscapeOrientation() {
return isLandscapeOrientation;
}

public void setLandscapeOrientation(boolean landscapeOrientation) {this.isLandscapeOrientation = landscapeOrientation; }
public void setLandscapeOrientation(boolean landscapeOrientation) {
this.isLandscapeOrientation = landscapeOrientation;
}

public void setDualPageMode(boolean dualPageMode) {
this.dualPageMode = dualPageMode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,7 @@ public void setupLayout(PDFView pdfView) {
}
}

if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN) {
setBackgroundDrawable(background);
} else {
setBackground(background);
}
setBackground(background);

LayoutParams lp = new LayoutParams(Util.getDP(context, width), Util.getDP(context, height));
lp.setMargins(0, 0, 0, 0);
Expand Down Expand Up @@ -151,8 +147,8 @@ private void calculateMiddle() {
pdfViewSize = pdfView.getHeight();
} else if (pdfView.isOnDualPageMode()){
pos = getX();
viewSize = getWidth() / 2;
pdfViewSize = pdfView.getWidth() / 2;
viewSize = getWidth() / 2f;
pdfViewSize = pdfView.getWidth() / 2f;
} else {
pos = getX();
viewSize = getWidth();
Expand Down
7 changes: 3 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@

buildscript {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
}
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'
classpath 'com.android.tools.build:gradle:4.0.1'
}
}

allprojects {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io' }
}
}
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
android.useAndroidX=true
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sun Aug 18 01:14:14 CEST 2019
#Tue Aug 04 20:30:19 EEST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
Loading

0 comments on commit c4208ae

Please sign in to comment.