Compare commits

..

No commits in common. "c6fb2acedaf7a62ed90546dd819b8591ca84167d" and "eead76ad86dfe786f71008d2603c4fb9b2ed9ce3" have entirely different histories.

14 changed files with 48 additions and 2191 deletions

View File

@ -10,11 +10,11 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: true
- name: Set up JDK 19
- name: Set up JDK 18
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 19
java-version: 18
cache: gradle
- name: Build with Gradle
run: ./gradlew build --no-daemon

View File

@ -33,7 +33,7 @@ android {
}
compileSdk = 33
buildToolsVersion = "33.0.1"
buildToolsVersion = "33.0.0"
namespace = "app.grapheneos.pdfviewer"
@ -84,6 +84,6 @@ android {
}
dependencies {
implementation("androidx.appcompat:appcompat:1.6.0")
implementation("com.google.android.material:material:1.7.0")
implementation("androidx.appcompat:appcompat:1.5.1")
implementation("com.google.android.material:material:1.6.1")
}

View File

@ -4,8 +4,10 @@
<original-package android:name="org.grapheneos.pdfviewer" />
<application android:name=".App"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher"
android:theme="@style/AppTheme">
<activity android:name=".PdfViewer"
android:documentLaunchMode="always"

View File

@ -1,36 +1,24 @@
html, body {
height: 100%;
}
body, canvas {
padding: 0;
margin: 0;
}
canvas {
margin: auto;
display: block;
}
body {
background-color: #c0c0c0;
}
#container {
width: 100%;
height: 100%;
display: grid;
place-items: center;
}
#container canvas, #container .textLayer {
/* overlay child elements on top of each other */
grid-row-start: 1;
grid-column-start: 1;
}
canvas, .textLayer {
display: inline-block;
position: relative;
}
.textLayer {
position: absolute;
text-align: initial;
left: 0;
top: 0;
right: 0;
bottom: 0;
overflow: hidden;
opacity: 0.2;
line-height: 1;

View File

@ -7,10 +7,8 @@
<script src="pdf.js"></script>
</head>
<body>
<div id="container">
<canvas id="content"></canvas>
<div id="text" class="textLayer"></div>
</div>
<canvas id="content"></canvas>
<div id="text" class="textLayer"></div>
<script src="viewer.js"></script>
</body>
</html>

View File

@ -252,7 +252,6 @@ public class PdfViewer extends AppCompatActivity implements LoaderManager.Loader
settings.setAllowFileAccess(false);
settings.setCacheMode(WebSettings.LOAD_NO_CACHE);
settings.setJavaScriptEnabled(true);
settings.setMinimumFontSize(1);
CookieManager.getInstance().setAcceptCookie(false);
@ -386,9 +385,7 @@ public class PdfViewer extends AppCompatActivity implements LoaderManager.Loader
if (savedInstanceState != null) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {
@SuppressWarnings("deprecation")
final Uri uri = savedInstanceState.getParcelable(STATE_URI);
mUri = uri;
mUri = savedInstanceState.getParcelable(STATE_URI);
} else {
mUri = savedInstanceState.getParcelable(STATE_URI, Uri.class);
}
@ -440,15 +437,6 @@ public class PdfViewer extends AppCompatActivity implements LoaderManager.Loader
return mPasswordPromptFragment;
}
private void setToolbarTitleWithDocumentName() {
String documentName = getCurrentDocumentName();
if (documentName != null && !documentName.isEmpty()) {
getSupportActionBar().setTitle(documentName);
} else {
getSupportActionBar().setTitle(R.string.app_name);
}
}
@Override
protected void onResume() {
super.onResume();
@ -480,7 +468,6 @@ public class PdfViewer extends AppCompatActivity implements LoaderManager.Loader
@Override
public void onLoadFinished(@NonNull Loader<List<CharSequence>> loader, List<CharSequence> data) {
mDocumentProperties = data;
setToolbarTitleWithDocumentName();
LoaderManager.getInstance(this).destroyLoader(DocumentPropertiesLoader.ID);
}

View File

@ -22,19 +22,23 @@ public class JumpToPageFragment extends DialogFragment {
private NumberPicker mPicker;
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
mPicker = new NumberPicker(getActivity());
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
if (savedInstanceState != null) {
mPicker.setMinValue(savedInstanceState.getInt(STATE_PICKER_MIN));
mPicker.setMaxValue(savedInstanceState.getInt(STATE_PICKER_MAX));
mPicker.setValue(savedInstanceState.getInt(STATE_PICKER_CUR));
} else {
mPicker.setMinValue(1);
mPicker.setMaxValue(((PdfViewer)requireActivity()).mNumPages);
mPicker.setValue(((PdfViewer)requireActivity()).mPage);
}
}
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
mPicker = new NumberPicker(getActivity());
mPicker.setMinValue(1);
mPicker.setMaxValue(((PdfViewer)requireActivity()).mNumPages);
mPicker.setValue(((PdfViewer)requireActivity()).mPage);
final FrameLayout layout = new FrameLayout(getActivity());
layout.addView(mPicker, new FrameLayout.LayoutParams(

View File

@ -1,11 +1,17 @@
buildscript {
repositories {
google()
mavenCentral()
// dependabot cannot handle google()
maven {
url = uri("https://dl.google.com/dl/android/maven2")
}
// dependabot cannot handle mavenCentral()
maven {
url = uri("https://repo.maven.apache.org/maven2")
}
}
dependencies {
classpath("com.android.tools.build:gradle:7.4.0")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.22")
classpath("com.android.tools.build:gradle:7.3.0")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.20")
}
}

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -1,7 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=7ba68c54029790ab444b39d7e293d3236b2632631fb5f2e012bb28b4ff669e4b
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
networkTimeout=10000
distributionSha256Sum=f6b8596b10cce501591e92f229816aa4046424f3b24d771751b06779d58c8ec4
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

12
gradlew vendored
View File

@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
@ -80,11 +80,11 @@ do
esac
done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_NAME="Gradle"
APP_BASE_NAME=${0##*/}
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
@ -143,16 +143,12 @@ fi
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac

1
gradlew.bat vendored
View File

@ -26,7 +26,6 @@ if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@ -1 +1 @@
Subproject commit 5f07d5a4159bb99eee2f6143d1297f03b45bba58
Subproject commit cc3d3bf299ae11f8f72ae8d64cbf19b340f9a996