Commit 473e0762 authored by wanglei's avatar wanglei

...提交部分ui...

parent 68f0c62e
...@@ -57,5 +57,7 @@ dependencies { ...@@ -57,5 +57,7 @@ dependencies {
implementation 'com.github.bumptech.glide:glide:4.16.0' implementation 'com.github.bumptech.glide:glide:4.16.0'
//pdf浏览 //pdf浏览
//https://github.com/DImuthuUpe/AndroidPdfViewer
implementation 'com.github.barteksc:android-pdf-viewer:2.8.2'
implementation 'com.github.barteksc:pdfium-android:1.7.1' implementation 'com.github.barteksc:pdfium-android:1.7.1'
} }
\ No newline at end of file
...@@ -18,4 +18,6 @@ ...@@ -18,4 +18,6 @@
# If you keep the line number information, uncomment this to # If you keep the line number information, uncomment this to
# hide the original source file name. # hide the original source file name.
#-renamesourcefileattribute SourceFile #-renamesourcefileattribute SourceFile
\ No newline at end of file
-keep class com.shockwave.**
\ No newline at end of file
package com.base.superpdfreader.activity package com.base.superpdfreader.activity
import android.os.Bundle
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import com.base.superpdfreader.R
import com.base.superpdfreader.databinding.ActivityPdfBrowserBinding import com.base.superpdfreader.databinding.ActivityPdfBrowserBinding
import com.base.superpdfreader.helps.BaseActivity import com.base.superpdfreader.helps.BaseActivity
import com.github.barteksc.pdfviewer.scroll.DefaultScrollHandle
import java.io.File
class PdfBrowserActivity : BaseActivity<ActivityPdfBrowserBinding>() { class PdfBrowserActivity : BaseActivity<ActivityPdfBrowserBinding>() {
var pageNumber = 0
override val binding: ActivityPdfBrowserBinding by lazy { override val binding: ActivityPdfBrowserBinding by lazy {
ActivityPdfBrowserBinding.inflate(layoutInflater) ActivityPdfBrowserBinding.inflate(layoutInflater)
} }
override fun initView() { override fun initView() {
val path = intent.extras?.getString("Path") ?: ""
val file = File(path)
if (file.exists()) {
binding.pdfview.fromFile(file)
.defaultPage(pageNumber)
.enableAnnotationRendering(true)
.scrollHandle(object : DefaultScrollHandle(this) {})
.spacing(10)
.onPageError { page, t -> }
.load()
}
} }
} }
\ No newline at end of file
...@@ -46,7 +46,13 @@ class DocumentAdapter(val itemClick: (bean: DocumentBean) -> Unit) : RecyclerVie ...@@ -46,7 +46,13 @@ class DocumentAdapter(val itemClick: (bean: DocumentBean) -> Unit) : RecyclerVie
list.forEach { file -> list.forEach { file ->
val flag = hasData.add(file) val flag = hasData.add(file)
if (flag) { if (flag) {
val bean = DocumentBean(drawable, file.name, file.lastModified(), file.length(), type) val bean = DocumentBean(
drawable,
file.name,
file.lastModified(),
file.length(),
file.absolutePath, type
)
docList.add(bean) docList.add(bean)
} }
} }
......
...@@ -10,6 +10,7 @@ data class DocumentBean( ...@@ -10,6 +10,7 @@ data class DocumentBean(
val name: String = "", val name: String = "",
val time: Long = 0, val time: Long = 0,
val size: Long = 0, val size: Long = 0,
val path: String = "",
val type: String = "", val type: String = "",
) { ) {
@SuppressLint("SimpleDateFormat") @SuppressLint("SimpleDateFormat")
......
...@@ -68,7 +68,9 @@ object DocumentDetailDialog { ...@@ -68,7 +68,9 @@ object DocumentDetailDialog {
} }
} }
binding.llOpen.setOnClickListener { binding.llOpen.setOnClickListener {
startActivity(Intent(this, PdfBrowserActivity::class.java)) startActivity(Intent(this, PdfBrowserActivity::class.java).apply {
putExtra("Path", bean.path)
})
} }
} }
} }
\ No newline at end of file
...@@ -7,10 +7,17 @@ ...@@ -7,10 +7,17 @@
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".activity.PdfBrowserActivity"> tools:context=".activity.PdfBrowserActivity">
<com.github.barteksc.pdfviewer.PDFView
android:id="@+id/pdfview"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/ll_tools" android:id="@+id/ll_tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/white"
app:layout_constraintTop_toTopOf="parent"> app:layout_constraintTop_toTopOf="parent">
<LinearLayout <LinearLayout
......
...@@ -20,4 +20,5 @@ kotlin.code.style=official ...@@ -20,4 +20,5 @@ kotlin.code.style=official
# Enables namespacing of each library's R class so that its R class includes only the # Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies, # resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library # thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true android.nonTransitiveRClass=true
\ No newline at end of file android.enableJetifier=true
\ No newline at end of file
...@@ -14,8 +14,9 @@ pluginManagement { ...@@ -14,8 +14,9 @@ pluginManagement {
dependencyResolutionManagement { dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories { repositories {
google()
mavenCentral() mavenCentral()
google()
jcenter()
maven { url 'https://jitpack.io' } maven { url 'https://jitpack.io' }
maven { url "https://android-sdk.is.com" } maven { url "https://android-sdk.is.com" }
maven { url "https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_oversea" } maven { url "https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_oversea" }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment