Skip to content
This repository has been archived by the owner on Jul 28, 2021. It is now read-only.

add pinch to zoom #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/src/main/assets/viewer.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html>
<head>
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; form-action 'none'; child-src 'self'; connect-src 'self' content:; img-src 'self' blob:; script-src 'self'; style-src 'self'" />
<meta name="viewport" content="width=device-width, user-scalable=no" />
<meta name="viewport" content="width=device-width, user-scalable=yes" />
<title>PDF</title>
<link rel="stylesheet" href="viewer.css" />
<script src="pdf.js"></script>
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/java/co/copperhead/pdfviewer/PdfViewer.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.ScaleGestureDetector;
import android.view.View;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
Expand Down Expand Up @@ -96,6 +98,10 @@ protected void onCreate(Bundle savedInstanceState) {
settings.setAllowFileAccess(false);
settings.setAllowUniversalAccessFromFileURLs(true);

settings.setSupportZoom(true);
settings.setBuiltInZoomControls(true);
settings.setDisplayZoomControls(false);

mChannel = new Channel();
mWebView.addJavascriptInterface(mChannel, "channel");

Expand Down
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
Expand All @@ -15,6 +16,7 @@ buildscript {
allprojects {
repositories {
jcenter()
google()
}
}

Expand Down