mirror of
https://github.com/SimpleMobileTools/Simple-File-Manager.git
synced 2025-06-05 22:09:15 +02:00
fix #135, adding a basic PDF Viewer
This commit is contained in:
@ -64,10 +64,11 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
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:RootTools:df729dcb13'
|
||||||
implementation 'com.github.Stericson:RootShell:1.6'
|
implementation 'com.github.Stericson:RootShell:1.6'
|
||||||
implementation 'com.alexvasilkov:gesture-views:2.5.2'
|
implementation 'com.alexvasilkov:gesture-views:2.5.2'
|
||||||
implementation 'androidx.documentfile:documentfile:1.0.1'
|
implementation 'androidx.documentfile:documentfile:1.0.1'
|
||||||
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
|
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
|
||||||
|
implementation 'com.github.barteksc:android-pdf-viewer:2.8.2'
|
||||||
}
|
}
|
||||||
|
1
app/proguard-rules.pro
vendored
1
app/proguard-rules.pro
vendored
@ -2,3 +2,4 @@
|
|||||||
-dontnote org.apache.http.**
|
-dontnote org.apache.http.**
|
||||||
-keep class com.simplemobiletools.** { *; }
|
-keep class com.simplemobiletools.** { *; }
|
||||||
-dontwarn com.simplemobiletools.**
|
-dontwarn com.simplemobiletools.**
|
||||||
|
-keep class com.shockwave.**
|
||||||
|
@ -620,7 +620,7 @@ class MainActivity : SimpleActivity() {
|
|||||||
|
|
||||||
private fun launchAbout() {
|
private fun launchAbout() {
|
||||||
closeSearchIfOpen()
|
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(
|
val faqItems = arrayListOf(
|
||||||
FAQItem(R.string.faq_3_title_commons, R.string.faq_3_text_commons),
|
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 android.os.Bundle
|
||||||
import com.simplemobiletools.commons.extensions.checkAppSideloading
|
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 com.simplemobiletools.filemanager.pro.R
|
||||||
|
import kotlinx.android.synthetic.main.activity_pdf_viewer.*
|
||||||
|
|
||||||
class PDFViewerActivity : SimpleActivity() {
|
class PDFViewerActivity : SimpleActivity() {
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
@ -12,5 +15,25 @@ class PDFViewerActivity : SimpleActivity() {
|
|||||||
if (checkAppSideloading()) {
|
if (checkAppSideloading()) {
|
||||||
return
|
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_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
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>
|
</RelativeLayout>
|
||||||
|
Reference in New Issue
Block a user