fix #619, use a different pdf viewer
This commit is contained in:
parent
44c07dd253
commit
ab47bcadbe
|
@ -64,8 +64,8 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.github.SimpleMobileTools:Simple-Commons:f538687d6e'
|
||||
implementation 'com.github.tibbi:AndroidPdfViewer:da57ff410e'
|
||||
implementation 'com.github.SimpleMobileTools:Simple-Commons:b452494768'
|
||||
implementation 'com.github.tibbi:PdfViewPager:1bc22f031a'
|
||||
implementation 'com.github.Stericson:RootTools:df729dcb13'
|
||||
implementation 'com.github.Stericson:RootShell:1.6'
|
||||
implementation 'com.alexvasilkov:gesture-views:2.5.2'
|
||||
|
|
|
@ -640,7 +640,7 @@ class MainActivity : SimpleActivity() {
|
|||
|
||||
private fun launchAbout() {
|
||||
closeSearch()
|
||||
val licenses = LICENSE_GLIDE or LICENSE_PATTERN or LICENSE_REPRINT or LICENSE_GESTURE_VIEWS or LICENSE_PDF_VIEWER or LICENSE_AUTOFITTEXTVIEW
|
||||
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(
|
||||
FAQItem(R.string.faq_3_title_commons, R.string.faq_3_text_commons),
|
||||
|
|
|
@ -8,7 +8,6 @@ import android.print.PrintAttributes
|
|||
import android.print.PrintManager
|
||||
import android.view.WindowManager
|
||||
import android.widget.RelativeLayout
|
||||
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
|
||||
|
@ -16,11 +15,14 @@ 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.BasePDFPagerAdapter
|
||||
import es.voghdev.pdfviewpager.library.adapter.PDFPagerAdapter
|
||||
import kotlinx.android.synthetic.main.activity_pdf_viewer.*
|
||||
|
||||
class PDFViewerActivity : SimpleActivity() {
|
||||
private var realFilePath = ""
|
||||
private var isFullScreen = false
|
||||
private var adapter: BasePDFPagerAdapter? = null
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
showTransparentTop = true
|
||||
|
@ -54,6 +56,11 @@ class PDFViewerActivity : SimpleActivity() {
|
|||
window.navigationBarColor = Color.TRANSPARENT
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
adapter?.close()
|
||||
}
|
||||
|
||||
private fun setupMenu() {
|
||||
(pdf_viewer_appbar.layoutParams as RelativeLayout.LayoutParams).topMargin = statusBarHeight
|
||||
pdf_viewer_toolbar.menu.apply {
|
||||
|
@ -92,17 +99,19 @@ class PDFViewerActivity : SimpleActivity() {
|
|||
return
|
||||
}
|
||||
|
||||
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()
|
||||
|
||||
adapter = PDFPagerAdapter.Builder(this)
|
||||
.setPdfPath(uri.toString())
|
||||
.setOnPageClickListener {
|
||||
toggleFullScreen()
|
||||
}
|
||||
.load()
|
||||
.setErrorHandler { throwable ->
|
||||
showErrorToast(throwable.toString())
|
||||
}
|
||||
.create()
|
||||
|
||||
pdf_viewer.adapter = adapter
|
||||
|
||||
showSystemUI(true)
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior">
|
||||
|
||||
<com.github.barteksc.pdfviewer.PDFView
|
||||
<es.voghdev.pdfviewpager.library.PDFViewPager
|
||||
android:id="@+id/pdf_viewer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
|
Loading…
Reference in New Issue