diff --git a/app/build.gradle b/app/build.gradle index cf11fe69..78cab067 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -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' } diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index f3d41e79..c30362f8 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -2,3 +2,4 @@ -dontnote org.apache.http.** -keep class com.simplemobiletools.** { *; } -dontwarn com.simplemobiletools.** +-keep class com.shockwave.** diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MainActivity.kt index 8059457a..bc95c2f5 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/MainActivity.kt @@ -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), diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/PDFViewerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/PDFViewerActivity.kt index 6600ebac..9c0ee515 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/PDFViewerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/PDFViewerActivity.kt @@ -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() } } diff --git a/app/src/main/res/layout/activity_pdf_viewer.xml b/app/src/main/res/layout/activity_pdf_viewer.xml index ecadf3e8..f6d0d427 100644 --- a/app/src/main/res/layout/activity_pdf_viewer.xml +++ b/app/src/main/res/layout/activity_pdf_viewer.xml @@ -4,4 +4,9 @@ android:layout_width="match_parent" android:layout_height="wrap_content"> + +