Update libpdfviewer

This commit is contained in:
Matéo Duparc 2022-03-06 21:44:58 +01:00
parent 58391802be
commit fd0296f801
Signed by untrusted user: hardcoresushi
GPG Key ID: AFE384344A45E13A
3 changed files with 7 additions and 9 deletions

View File

@ -3,7 +3,6 @@ package sushi.hardcore.droidfs.file_viewers
import android.view.Menu import android.view.Menu
import android.view.MenuItem import android.view.MenuItem
import org.grapheneos.pdfviewer.PdfViewer import org.grapheneos.pdfviewer.PdfViewer
import sushi.hardcore.droidfs.databinding.ActivityPdfViewerBinding
import java.io.ByteArrayInputStream import java.io.ByteArrayInputStream
import java.io.File import java.io.File
@ -19,11 +18,9 @@ class PdfViewer: FileViewerActivity() {
} }
override fun viewFile() { override fun viewFile() {
pdfViewer = ActivityPdfViewerBinding.inflate(layoutInflater).root pdfViewer = PdfViewer(this)
val fileName = File(filePath).name val fileName = File(filePath).name
title = fileName title = fileName
pdfViewer.activity = this
setContentView(pdfViewer)
val fileSize = gocryptfsVolume.getSize(filePath) val fileSize = gocryptfsVolume.getSize(filePath)
loadWholeFile(filePath, fileSize)?.let { loadWholeFile(filePath, fileSize)?.let {
pdfViewer.loadPdf(ByteArrayInputStream(it), fileName, fileSize) pdfViewer.loadPdf(ByteArrayInputStream(it), fileName, fileSize)
@ -35,6 +32,11 @@ class PdfViewer: FileViewerActivity() {
return super.onCreateOptionsMenu(menu) return super.onCreateOptionsMenu(menu)
} }
override fun onResume() {
super.onResume()
pdfViewer.onResume()
}
override fun onPrepareOptionsMenu(menu: Menu?): Boolean { override fun onPrepareOptionsMenu(menu: Menu?): Boolean {
return pdfViewer.onPrepareOptionsMenu(menu) return pdfViewer.onPrepareOptionsMenu(menu)
} }

View File

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<org.grapheneos.pdfviewer.PdfViewer xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"/>

@ -1 +1 @@
Subproject commit 4e4b7c5da4dddbc3841abd450fa250936be70f4e Subproject commit 0f312347ddcff4aab5edd7d7fdb6837c67584d56