fix #135, adding a basic PDF Viewer
This commit is contained in:
parent
e0802b72fe
commit
c687e1bd27
|
@ -64,10 +64,11 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.github.SimpleMobileTools:Simple-Commons:d5f0ed856d'
|
||||
implementation 'com.github.SimpleMobileTools:Simple-Commons:d6434b3912'
|
||||
implementation 'com.github.Stericson:RootTools:df729dcb13'
|
||||
implementation 'com.github.Stericson:RootShell:1.6'
|
||||
implementation 'com.alexvasilkov:gesture-views:2.5.2'
|
||||
implementation 'androidx.documentfile:documentfile:1.0.1'
|
||||
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
|
||||
implementation 'com.github.barteksc:android-pdf-viewer:2.8.2'
|
||||
}
|
||||
|
|
|
@ -2,3 +2,4 @@
|
|||
-dontnote org.apache.http.**
|
||||
-keep class com.simplemobiletools.** { *; }
|
||||
-dontwarn com.simplemobiletools.**
|
||||
-keep class com.shockwave.**
|
||||
|
|
|
@ -620,7 +620,7 @@ class MainActivity : SimpleActivity() {
|
|||
|
||||
private fun launchAbout() {
|
||||
closeSearchIfOpen()
|
||||
val licenses = LICENSE_GLIDE or LICENSE_PATTERN or LICENSE_REPRINT or LICENSE_GESTURE_VIEWS
|
||||
val licenses = LICENSE_GLIDE or LICENSE_PATTERN or LICENSE_REPRINT or LICENSE_GESTURE_VIEWS or LICENSE_PDF_VIEWER
|
||||
|
||||
val faqItems = arrayListOf(
|
||||
FAQItem(R.string.faq_3_title_commons, R.string.faq_3_text_commons),
|
||||
|
|
|
@ -2,7 +2,10 @@ package com.simplemobiletools.filemanager.pro.activities
|
|||
|
||||
import android.os.Bundle
|
||||
import com.simplemobiletools.commons.extensions.checkAppSideloading
|
||||
import com.simplemobiletools.commons.extensions.getFilenameFromUri
|
||||
import com.simplemobiletools.commons.extensions.getProperBackgroundColor
|
||||
import com.simplemobiletools.filemanager.pro.R
|
||||
import kotlinx.android.synthetic.main.activity_pdf_viewer.*
|
||||
|
||||
class PDFViewerActivity : SimpleActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
|
@ -12,5 +15,25 @@ class PDFViewerActivity : SimpleActivity() {
|
|||
if (checkAppSideloading()) {
|
||||
return
|
||||
}
|
||||
|
||||
checkIntent()
|
||||
}
|
||||
|
||||
private fun checkIntent() {
|
||||
val uri = intent.data
|
||||
if (uri == null) {
|
||||
finish()
|
||||
return
|
||||
}
|
||||
|
||||
val filename = getFilenameFromUri(uri)
|
||||
if (filename.isNotEmpty()) {
|
||||
title = filename
|
||||
}
|
||||
|
||||
pdf_viewer.setBackgroundColor(getProperBackgroundColor())
|
||||
pdf_viewer.fromUri(uri)
|
||||
.spacing(15)
|
||||
.load()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,4 +4,9 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<com.github.barteksc.pdfviewer.PDFView
|
||||
android:id="@+id/pdf_viewer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
|
Loading…
Reference in New Issue