Revert "fix #619, use a different pdf viewer"
This reverts commit ab47bcadbe
.
This commit is contained in:
parent
089f352818
commit
d1c68d55bb
|
@ -65,7 +65,7 @@ android {
|
|||
|
||||
dependencies {
|
||||
implementation 'com.github.SimpleMobileTools:Simple-Commons:30e6321592'
|
||||
implementation 'com.github.tibbi:PdfViewPager:d2af24208d'
|
||||
implementation 'com.github.esensar:AndroidPdfViewer:1b33733a2b'
|
||||
implementation 'com.github.Stericson:RootTools:df729dcb13'
|
||||
implementation 'com.github.Stericson:RootShell:1.6'
|
||||
implementation 'com.alexvasilkov:gesture-views:2.5.2'
|
||||
|
|
|
@ -632,6 +632,7 @@ class MainActivity : SimpleActivity() {
|
|||
}
|
||||
|
||||
private fun launchAbout() {
|
||||
// TODO: Add PDFViewer license
|
||||
val licenses = LICENSE_GLIDE or LICENSE_PATTERN or LICENSE_REPRINT or LICENSE_GESTURE_VIEWS or LICENSE_PDF_VIEW_PAGER or LICENSE_AUTOFITTEXTVIEW
|
||||
|
||||
val faqItems = arrayListOf(
|
||||
|
|
|
@ -6,11 +6,9 @@ import android.graphics.Color
|
|||
import android.os.Bundle
|
||||
import android.print.PrintAttributes
|
||||
import android.print.PrintManager
|
||||
import android.view.View
|
||||
import android.view.WindowManager
|
||||
import androidx.viewpager2.widget.MarginPageTransformer
|
||||
import android.widget.RelativeLayout
|
||||
import androidx.viewpager2.widget.ViewPager2
|
||||
import com.github.barteksc.pdfviewer.scroll.DefaultScrollHandle
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.helpers.REAL_FILE_PATH
|
||||
import com.simplemobiletools.commons.helpers.isPiePlus
|
||||
|
@ -18,8 +16,6 @@ import com.simplemobiletools.filemanager.pro.R
|
|||
import com.simplemobiletools.filemanager.pro.extensions.hideSystemUI
|
||||
import com.simplemobiletools.filemanager.pro.extensions.showSystemUI
|
||||
import com.simplemobiletools.filemanager.pro.helpers.PdfDocumentAdapter
|
||||
import es.voghdev.pdfviewpager.library.adapter.PDFPagerAdapter
|
||||
import es.voghdev.pdfviewpager.library.adapter.PdfErrorHandler
|
||||
import kotlinx.android.synthetic.main.activity_pdf_viewer.*
|
||||
|
||||
class PDFViewerActivity : SimpleActivity() {
|
||||
|
@ -95,21 +91,17 @@ class PDFViewerActivity : SimpleActivity() {
|
|||
return
|
||||
}
|
||||
|
||||
val clickListener = View.OnClickListener {
|
||||
toggleFullScreen()
|
||||
}
|
||||
|
||||
val errorHandler = PdfErrorHandler { throwable -> showErrorToast(throwable.toString()) }
|
||||
|
||||
pdf_viewer.setPageTransformer(MarginPageTransformer(resources.getDimension(R.dimen.activity_margin).toInt()))
|
||||
pdf_viewer.orientation = ViewPager2.ORIENTATION_VERTICAL
|
||||
try {
|
||||
pdf_viewer.adapter = PDFPagerAdapter(this, clickListener, errorHandler, uri.toString(), getProperBackgroundColor())
|
||||
} catch (e: Exception) {
|
||||
showErrorToast(e)
|
||||
val primaryColor = getProperPrimaryColor()
|
||||
pdf_viewer.setBackgroundColor(getProperBackgroundColor())
|
||||
pdf_viewer.fromUri(uri)
|
||||
.scrollHandle(DefaultScrollHandle(this, primaryColor.getContrastColor(), primaryColor))
|
||||
.spacing(15)
|
||||
.onTap { toggleFullScreen() }
|
||||
.onError {
|
||||
showErrorToast(it.localizedMessage?.toString() ?: getString(R.string.unknown_error_occurred))
|
||||
finish()
|
||||
return
|
||||
}
|
||||
.load()
|
||||
|
||||
showSystemUI(true)
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||
|
||||
<androidx.viewpager2.widget.ViewPager2
|
||||
<com.github.barteksc.pdfviewer.PDFView
|
||||
android:id="@+id/pdf_viewer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
|
Loading…
Reference in New Issue