Commit bfe2518c authored by wanglei's avatar wanglei

...

parent 94d0aa79
......@@ -60,6 +60,9 @@ dependencies {
//Pdf库
implementation("com.tom-roush:pdfbox-android:2.0.27.0")
api(project(":android-pdf-viewer"))
//https://mupdf.com/releases
//https://github.com/ArtifexSoftware/mupdf-android-viewer
api("com.artifex.mupdf:viewer:1.24.9a")
//Word库
......
......@@ -18,12 +18,7 @@
android:supportsRtl="true"
android:theme="@style/Theme.PDFViewerScannerWhite"
tools:targetApi="34">
<activity
android:name=".ui.document.pdf.PdfLoadingActivity"
android:exported="false" />
<activity
android:name=".ui.document.pdf.PdfSplitActivity"
android:exported="false" />
<meta-data
android:name="com.google.android.gms.version"
......@@ -50,6 +45,24 @@
android:launchMode="singleTop"
android:screenOrientation="portrait"
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
<activity
android:name="com.artifex.mupdf.viewer.PdfTestActivity"
android:exported="false"
android:launchMode="singleTop"
android:screenOrientation="portrait"
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
<activity
android:name=".ui.document.pdf.PdfLoadingActivity"
android:exported="false"
android:launchMode="singleTop"
android:screenOrientation="portrait"
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
<activity
android:name=".ui.document.pdf.PdfSplitActivity"
android:exported="false"
android:launchMode="singleTop"
android:screenOrientation="portrait"
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
<activity
android:name=".ui.document.pdf.PdfActivity"
android:exported="false"
......
package com.artifex.mupdf.viewer
import android.net.Uri
import android.util.DisplayMetrics
import android.view.View
import android.view.inputmethod.EditorInfo
import android.view.inputmethod.InputMethodManager
import androidx.activity.addCallback
import androidx.core.view.isVisible
import androidx.core.widget.addTextChangedListener
import com.base.pdfviewerscannerwhite.databinding.ActivityPdfTestBinding
import com.base.pdfviewerscannerwhite.helper.BaseActivity
/**
* [com.artifex.mupdf.viewer.DocumentActivity]
*/
class PdfTestActivity : BaseActivity<ActivityPdfTestBinding>() {
private var core: MuPDFCore? = null
private lateinit var readerView: ReaderView
private var searchTask: SearchTask? = null
//居然是这样实现的
private var mFlatOutline: ArrayList<OutlineActivity.Item>? = null
private var mLayoutW = 312
private var mLayoutH = 504
private var mDisplayDPI = 0
private val mLayoutEM = 10
override val binding: ActivityPdfTestBinding by lazy {
ActivityPdfTestBinding.inflate(layoutInflater)
}
private var uri: String = ""
private var size = -1L
override fun initView() {
val metrics = DisplayMetrics()
windowManager.defaultDisplay.getMetrics(metrics)
mDisplayDPI = metrics.densityDpi
uri = intent.extras?.getString("uri") ?: ""
size = intent.extras?.getLong("size") ?: -1L
core = openCore()
initSearchTask()
if (core?.needsPassword() == true) {
} else {
initReaderView()
}
}
override fun initListener() {
super.initListener()
onBackPressedDispatcher.addCallback {
if (binding.editSearch.isVisible) {
noSearchUI()
} else {
finishToMain()
}
}
binding.flFanhui.setOnClickListener {
onBackPressedDispatcher.onBackPressed()
}
binding.ivSearch.setOnClickListener {
searchUi()
}
binding.editSearch.addTextChangedListener {
if (SearchTaskResult.get() != null && it.toString() != SearchTaskResult.get().txt) {
SearchTaskResult.set(null as SearchTaskResult?)
readerView.resetupChildren()
}
}
binding.editSearch.setOnEditorActionListener { v, actionId, event ->
if (actionId == EditorInfo.IME_ACTION_DONE) {
search(1)
}
false
}
}
private fun initSearchTask() {
searchTask = object : SearchTask(this, core) {
override fun onTextFound(result: SearchTaskResult) {
SearchTaskResult.set(result)
readerView.displayedViewIndex = result.pageNumber
readerView.resetupChildren()
}
}
SearchTaskResult.set(null)
}
private fun hideKeyboard() {
val imm = this.getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager
imm.hideSoftInputFromWindow(binding.editSearch.windowToken, 0)
}
private fun search(direction: Int) {
this.hideKeyboard()
val displayPage: Int = readerView.displayedViewIndex
val r = SearchTaskResult.get()
val searchPage = r?.pageNumber ?: -1
searchTask?.go(binding.editSearch.text.toString(), direction, displayPage, searchPage)
}
fun noSearchUI() {
binding.editSearch.visibility = View.GONE
binding.tvPdfName.visibility = View.VISIBLE
binding.ivXuanzhuan.visibility = View.VISIBLE
binding.ivMore.visibility = View.VISIBLE
}
private fun searchUi() {
binding.tvPdfName.visibility = View.GONE
binding.ivXuanzhuan.visibility = View.GONE
binding.ivMore.visibility = View.GONE
binding.editSearch.visibility = View.VISIBLE
binding.editSearch.requestFocus()
}
/**
* need size
*/
private fun openCore(): MuPDFCore {
return MuPDFCore(ContentInputStream(this.contentResolver, Uri.parse(uri), size), "application/pdf")
}
private fun initReaderView() {
readerView = object : ReaderView(this) {
override fun onTapMainDocArea() {
super.onTapMainDocArea()
}
override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
//文档内容能够根据不同的屏幕尺寸或布局自动重新排列的特性
if (core?.isReflowable == true) {
mLayoutW = w * 72 / mDisplayDPI
mLayoutH = h * 72 / mDisplayDPI
relayoutDocument()
} else {
refresh()
}
}
}
readerView.adapter = PageAdapter(this, core)
binding.rl.addView(readerView)
}
fun relayoutDocument() {
if (core != null) {
val loc = core?.layout(readerView.mCurrent, mLayoutW, mLayoutH, mLayoutEM) ?: 0
mFlatOutline = null
readerView.mHistory?.clear()
readerView.refresh()
readerView.displayedViewIndex = loc
}
}
override fun onPause() {
super.onPause()
searchTask?.stop()
}
override fun onResume() {
super.onResume()
}
}
\ No newline at end of file
package com.base.pdfviewerscannerwhite.bean
import android.net.Uri
data class DocumentBean(
val path: String = "",
var uri:Uri=Uri.EMPTY,
val type: String = "",
var isBookmarked: Boolean = false
) {
......
......@@ -19,7 +19,7 @@ class DocumentAdapter : BaseQuickAdapter<DocumentBean, DocumentAdapter.DocumentV
inner class DocumentViewHolder(view: View) : ViewHolder(view)
var itemClick: ((path: String) -> Unit)? = null
var itemClick: ((item: DocumentBean) -> Unit)? = null
var bookmarkAction: ((addRemove: Boolean, path: String) -> Unit)? = null
var moreAction: ((item: DocumentBean) -> Unit)? = null
......@@ -52,7 +52,7 @@ class DocumentAdapter : BaseQuickAdapter<DocumentBean, DocumentAdapter.DocumentV
moreAction?.invoke(item)
}
binding.root.setOnClickListener {
itemClick?.invoke(item.path)
itemClick?.invoke(item)
}
}
......
......@@ -69,6 +69,8 @@ class PdfActivity : BaseActivity<ActivityPdfBinding>(), PdfView {
}
}
private fun initAdapter() {
......@@ -108,6 +110,7 @@ class PdfActivity : BaseActivity<ActivityPdfBinding>(), PdfView {
.onPageError { page, t ->
}.password(password).load()
binding.pdfview
}
override fun onAttachedToWindow() {
......
......@@ -2,7 +2,6 @@ package com.base.pdfviewerscannerwhite.ui.document.pdf
import android.annotation.SuppressLint
import android.content.Context
import android.os.Handler
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
......
package com.base.pdfviewerscannerwhite.ui.document
package com.base.pdfviewerscannerwhite.ui.main
import android.app.Dialog
import android.content.Intent
......@@ -7,6 +7,7 @@ import com.base.pdfviewerscannerwhite.bean.DocumentBean
import com.base.pdfviewerscannerwhite.bean.DocumentBean.Companion.TYPE_PDF
import com.base.pdfviewerscannerwhite.databinding.FragmentDocumentBinding
import com.base.pdfviewerscannerwhite.helper.BaseFragment
import com.artifex.mupdf.viewer.PdfTestActivity
import com.base.pdfviewerscannerwhite.ui.adapter.DocumentAdapter
import com.base.pdfviewerscannerwhite.ui.document.pdf.PdfActivity
import com.base.pdfviewerscannerwhite.ui.document.pdf.PdfSplitActivity
......@@ -49,10 +50,16 @@ class DocumentFragment() : BaseFragment<FragmentDocumentBinding>(), DocumentView
adapter.bookmarkAction = { addRemove, path ->
documentPresenter.saveBookmarkChange(addRemove, path)
}
adapter.itemClick = { path ->
startActivity(Intent(requireContext(), PdfActivity::class.java).apply {
putExtra("path", path)
})
adapter.itemClick = { item ->
PdfActivity::class.java
// startActivity(Intent(requireContext(), PdfActivity::class.java).apply {
// putExtra("path", path)
// })
val intent: Intent = Intent(requireContext(), PdfTestActivity::class.java)
intent.putExtra("uri", item.uri.toString())
val size = File(item.path).length()
intent.putExtra("size", size)
startActivity(intent)
}
adapter.moreAction = { item ->
if (item.type == TYPE_PDF) {
......@@ -73,6 +80,13 @@ class DocumentFragment() : BaseFragment<FragmentDocumentBinding>(), DocumentView
})
}
override fun deleteDocument(item: DocumentBean) {
val list = documentList?.toMutableList()
documentPresenter.deleteDocumentBean(item)
list?.remove(item)
adapter.submitList(list)
}
fun setRecentList() {
val recentList = documentList?.filter {
(System.currentTimeMillis() - File(it.path).lastModified()) < 300L * 24 * 60 * 60 * 1000
......
package com.base.pdfviewerscannerwhite.ui.document
package com.base.pdfviewerscannerwhite.ui.main
import android.content.Context
import androidx.lifecycle.LifecycleCoroutineScope
......@@ -25,7 +25,7 @@ class DocumentPresenter(
val list = context.getMediaFile(selectionArgs = selectionArgs)
val documentList = list.map {
DocumentBean(it.path, type, bookmarkList.contains(it.path))
DocumentBean(it.path, uri = it.uri, type, bookmarkList.contains(it.path))
}
return documentList
}
......@@ -57,5 +57,12 @@ class DocumentPresenter(
}
}
fun deleteDocumentBean(item: DocumentBean) {
runCatching {
val file = File(item.path)
file.delete()
}
}
}
\ No newline at end of file
package com.base.pdfviewerscannerwhite.ui.document
package com.base.pdfviewerscannerwhite.ui.main
import com.base.pdfviewerscannerwhite.bean.DocumentBean
......@@ -8,4 +8,5 @@ interface DocumentView {
fun refreshDocumentRv(documentList: List<DocumentBean>)
fun splitPdf(path: String)
fun deleteDocument(item: DocumentBean)
}
\ No newline at end of file
......@@ -11,7 +11,6 @@ import com.base.pdfviewerscannerwhite.BuildConfig
import com.base.pdfviewerscannerwhite.R
import com.base.pdfviewerscannerwhite.databinding.ActivityMainBinding
import com.base.pdfviewerscannerwhite.helper.BaseActivity
import com.base.pdfviewerscannerwhite.ui.document.DocumentFragment
import com.base.pdfviewerscannerwhite.utils.PermissionUtils.requestStorePermission
import com.base.pdfviewerscannerwhite.utils.ToastUtils.toast
......@@ -28,10 +27,13 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), MainView {
private val pdfFragment: DocumentFragment by lazy {
DocumentFragment()
}
private val toolFragment: ToolFragment by lazy {
ToolFragment()
}
private var currentFragment = pdfFragment
private var currentFragment: Fragment = pdfFragment
private val fragments by lazy {
mutableListOf(pdfFragment)
mutableListOf(pdfFragment, toolFragment)
}
override fun initView() {
......@@ -63,27 +65,49 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), MainView {
}
@SuppressLint("ClickableViewAccessibility")
@SuppressLint("ClickableViewAccessibility", "SetTextI18n")
override fun initListener() {
super.initListener()
binding.llDocument.setOnClickListener {
binding.tvTittle.text = "Document"
changeTabSelect(it)
binding.ivScan.visibility = View.VISIBLE
binding.clAction.visibility = View.VISIBLE
binding.ivPaixu.visibility = View.VISIBLE
currentFragment.setAllList()
binding.viewPager2.currentItem = 0
if (currentFragment is DocumentFragment) {
(currentFragment as DocumentFragment).setAllList()
}
}
binding.llRecent.setOnClickListener {
changeTabSelect(it)
binding.tvTittle.text = "Document"
binding.ivScan.visibility = View.VISIBLE
binding.clAction.visibility = View.VISIBLE
binding.ivPaixu.visibility = View.GONE
currentFragment.setRecentList()
changeTabSelect(it)
binding.viewPager2.currentItem = 0
if (currentFragment is DocumentFragment) {
(currentFragment as DocumentFragment).setRecentList()
}
}
binding.llBookmark.setOnClickListener {
binding.tvTittle.text = "Document"
binding.ivScan.visibility = View.VISIBLE
binding.clAction.visibility = View.VISIBLE
changeTabSelect(it)
currentFragment.setBookmarkList()
binding.viewPager2.currentItem = 0
if (currentFragment is DocumentFragment) {
(currentFragment as DocumentFragment).setBookmarkList()
}
}
binding.llTool.setOnClickListener {
binding.tvTittle.text = "Tool"
binding.ivScan.visibility = View.GONE
changeTabSelect(it)
binding.viewPager2.currentItem = 1
binding.clAction.visibility = View.GONE
}
binding.ivScan.setOnClickListener {
......
package com.base.pdfviewerscannerwhite.ui.main
import androidx.recyclerview.widget.RecyclerView
import com.base.pdfviewerscannerwhite.databinding.FragmentToolBinding
import com.base.pdfviewerscannerwhite.helper.BaseFragment
class ToolFragment : BaseFragment<FragmentToolBinding>() {
override val binding: FragmentToolBinding by lazy {
FragmentToolBinding.inflate(layoutInflater)
}
override fun setView() {
}
}
\ No newline at end of file
package com.base.pdfviewerscannerwhite.ui.view
import android.annotation.SuppressLint
import android.app.Activity
import android.app.Dialog
import android.content.Context
import android.content.Intent
import android.view.LayoutInflater
import android.view.View
import android.view.WindowManager
import androidx.core.content.FileProvider
import androidx.core.widget.addTextChangedListener
import com.base.pdfviewerscannerwhite.R
import com.base.pdfviewerscannerwhite.bean.DocumentBean
import com.base.pdfviewerscannerwhite.databinding.DialogDeleteBinding
import com.base.pdfviewerscannerwhite.databinding.DialogDocumentDetailBinding
import com.base.pdfviewerscannerwhite.databinding.DialogDocumentRenameBinding
import com.base.pdfviewerscannerwhite.databinding.DialogPageNumberBinding
import com.base.pdfviewerscannerwhite.databinding.DialogPdfDetailBinding
import com.base.pdfviewerscannerwhite.databinding.DialogPdfMoreBinding
import com.base.pdfviewerscannerwhite.ui.adapter.DocumentAdapter
import com.base.pdfviewerscannerwhite.ui.document.DocumentView
import com.base.pdfviewerscannerwhite.ui.main.DocumentView
import com.base.pdfviewerscannerwhite.ui.document.pdf.PdfView
import com.base.pdfviewerscannerwhite.utils.IntentShareUtils.sharePdfIntent
import com.base.pdfviewerscannerwhite.utils.IntentShareUtils.sharePdfPrintIntent
import com.base.pdfviewerscannerwhite.utils.KotlinExt.toFormatSize
import com.base.pdfviewerscannerwhite.utils.KotlinExt.toFormatTime
import com.base.pdfviewerscannerwhite.utils.KotlinExt.toFormatTime2
import com.base.pdfviewerscannerwhite.utils.KotlinExt.toFormatTime3
import com.base.pdfviewerscannerwhite.utils.LogEx
import com.base.pdfviewerscannerwhite.utils.SpStringUtils
import com.base.pdfviewerscannerwhite.utils.SpStringUtils.LAST_VIEW_KEY
import com.base.pdfviewerscannerwhite.utils.ToastUtils.toast
......@@ -105,13 +112,19 @@ object DialogView {
dialog.dismiss()
documentView.splitPdf(item.path)
}
binding.llDelete.setOnClickListener {
dialog.dismiss()
showDeleteDialog{
documentView.deleteDocument(item)
}
}
dialog.setOnDismissListener {
dismissAction.invoke()
}
return dialog
}
fun Context.showPdfMoreDialog(
fun Activity.showPdfMoreDialog(
pdfView: PdfView,
pageNumber: Int,
pafPath: String,
......@@ -141,6 +154,21 @@ object DialogView {
binding.llDetail.setOnClickListener {
showDocumentDetail(pafPath)
}
binding.llShare.setOnClickListener {
dialog.dismiss()
val pkg = this.packageName
LogEx.logDebug("showPdfMoreDialog", "pkg=$pkg")
val uri = FileProvider.getUriForFile(
this, this.packageName + ".provider", File(pafPath)
)
startActivity(Intent.createChooser(sharePdfIntent(uri), "Share PDF"))
}
binding.llPrint.setOnClickListener {
val uri = FileProvider.getUriForFile(
this, this.packageName + ".provider", File(pafPath)
)
startActivity(Intent.createChooser(sharePdfPrintIntent(uri), "Print PDF"))
}
}
......@@ -221,4 +249,26 @@ object DialogView {
firstDialog?.dismiss()
}
}
fun Context.showDeleteDialog(deleteAction: () -> Unit) {
val dialog = BottomSheetDialog(this, R.style.BottomSheetDialog)
val binding = DialogDeleteBinding.inflate(LayoutInflater.from(this))
dialog.setContentView(binding.root)
dialog.setCanceledOnTouchOutside(false)
dialog.show()
val parentView = binding.root.parent as View
val behavior = BottomSheetBehavior.from(parentView)
//展开
behavior.state = BottomSheetBehavior.STATE_EXPANDED
binding.tvCancel.setOnClickListener {
dialog.dismiss()
}
binding.tvDelete.setOnClickListener {
dialog.dismiss()
deleteAction.invoke()
}
}
}
\ No newline at end of file
package com.base.pdfviewerscannerwhite.utils
//noinspection SuspiciousImport
import android.app.Activity
import android.content.Context
import android.content.res.Resources
import android.graphics.Color
import android.os.Build
import android.view.View
import android.view.ViewGroup
import android.view.Window
import android.view.WindowManager
import androidx.annotation.ColorInt
object BarUtils {
fun setStatusBarLightMode(activity: Activity, isLightMode: Boolean) {
setStatusBarLightMode(activity.window, isLightMode)
}
private fun setStatusBarLightMode(window: Window, isLightMode: Boolean) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
val decorView = window.decorView
var vis = decorView.systemUiVisibility
vis = if (isLightMode) {
vis or View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR
} else {
vis and View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR.inv()
}
decorView.systemUiVisibility = vis
}
}
fun setStatusBarColor(activity: Activity, @ColorInt color: Int): View? {
return setStatusBarColor(activity, color, false)
}
private fun setStatusBarColor(activity: Activity, @ColorInt color: Int, isDecor: Boolean): View? {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) return null
transparentStatusBar(activity)
return applyStatusBarColor(activity, color, isDecor)
}
private fun applyStatusBarColor(activity: Activity, color: Int, isDecor: Boolean): View {
return applyStatusBarColor(activity.window, color, isDecor)
}
private fun transparentStatusBar(activity: Activity) {
transparentStatusBar(activity.window)
}
private fun transparentStatusBar(window: Window) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) return
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS)
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS)
val option = View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
val vis = window.decorView.systemUiVisibility
window.decorView.systemUiVisibility = option or vis
window.statusBarColor = Color.TRANSPARENT
} else {
window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS)
}
}
private fun applyStatusBarColor(window: Window, color: Int, isDecor: Boolean): View {
val parent =
if (isDecor) window.decorView as ViewGroup else (window.findViewById<View>(android.R.id.content) as ViewGroup)!!
var fakeStatusBarView =
parent.findViewWithTag<View>(TAG_STATUS_BAR)
if (fakeStatusBarView != null) {
if (fakeStatusBarView.visibility == View.GONE) {
fakeStatusBarView.visibility = View.VISIBLE
}
fakeStatusBarView.setBackgroundColor(color)
} else {
fakeStatusBarView = createStatusBarView(window.context, color)
parent.addView(fakeStatusBarView)
}
return fakeStatusBarView
}
private fun createStatusBarView(context: Context, color: Int): View {
val statusBarView = View(context)
statusBarView.layoutParams = ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, getStatusBarHeight()
)
statusBarView.setBackgroundColor(color)
statusBarView.tag = TAG_STATUS_BAR
return statusBarView
}
///////////////////////////////////////////////////////////////////////////
// status bar
///////////////////////////////////////////////////////////////////////////
private const val TAG_STATUS_BAR = "TAG_STATUS_BAR"
fun getStatusBarHeight(): Int {
val resources = Resources.getSystem()
val resourceId = resources.getIdentifier("status_bar_height", "dimen", "android")
return resources.getDimensionPixelSize(resourceId)
}
}
\ No newline at end of file
package com.base.pdfviewerscannerwhite.utils
import android.content.Intent
import android.net.Uri
import android.print.PrintDocumentAdapter
import android.view.ActionMode
object IntentShareUtils {
fun sharePdfIntent(uri: Uri): Intent {
val shareIntent = Intent().apply {
action = Intent.ACTION_SEND
putExtra(Intent.EXTRA_STREAM, uri)
type = "application/pdf"
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) // 授权临时权限
}
return shareIntent
}
fun sharePdfPrintIntent(uri: Uri): Intent {
// 创建打印的 Intent
val intent = Intent(Intent.ACTION_SEND)
intent.setDataAndType(uri, "application/pdf")
// 启动打印服务
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION)
return intent
}
}
\ No newline at end of file
......@@ -6,7 +6,8 @@ import com.base.pdfviewerscannerwhite.BuildConfig
object LogEx {
val isOpen = true
val filterTAG = arrayOf(
"MediaStoreUtils",
"",
// "MediaStoreUtils",
)
fun logDebug(tag: String, content: String, isMust: Boolean = false) {
......
......@@ -99,7 +99,7 @@ fun Context.getMediaFile(selectionArgs: Array<String>? = null): ArrayList<MediaB
val mimeType = cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Files.FileColumns.MIME_TYPE))
// val size = cursor.getLong(cursor.getColumnIndexOrThrow(MediaStore.Files.FileColumns.SIZE))
LogEx.logDebug(TAG, "path=$path mimeType=$mimeType")
LogEx.logDebug(TAG, "path=$path uri=$uri mimeType=$mimeType")
list.add(
MediaBean(path = path, uri = uri, mimeType = mimeType)
)
......
......@@ -8,7 +8,10 @@ import com.tom_roush.pdfbox.pdmodel.PDDocument
import com.tom_roush.pdfbox.rendering.ImageType
import com.tom_roush.pdfbox.rendering.PDFRenderer
import com.tom_roush.pdfbox.rendering.RenderDestination
import com.tom_roush.pdfbox.text.PDFTextStripper
import com.tom_roush.pdfbox.text.TextPosition
import java.io.File
import java.io.Writer
object PdfUtils {
......@@ -58,4 +61,19 @@ object PdfUtils {
return drawable
}
fun getPdfTextLocation(filePath: String) {
// val document = PDDocument.load(File(filePath))
// val stripper = object : PDFTextStripper() {
// override fun writeString(text: String?, textPositions: MutableList<TextPosition>?) {
// super.writeString(text, textPositions)
// }
// }
// stripper.sortByPosition = true
// stripper.startPage = 0
// stripper.endPage = document.numberOfPages
// stripper.writeText(document,)
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="10dp" />
<solid android:color="#F8F9FE" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#FB2B39" />
<corners android:radius="10dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#FBFBFB" />
<corners android:radius="15dp" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<stroke
android:width="1dp"
android:color="#FB2B39" />
<corners android:radius="10dp" />
</shape>
\ No newline at end of file
......@@ -5,6 +5,7 @@
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
tools:context=".ui.main.MainActivity">
<androidx.constraintlayout.widget.ConstraintLayout
......@@ -27,38 +28,48 @@
app:layout_constraintTop_toTopOf="parent"
tools:ignore="HardcodedText" />
<ImageView
android:id="@+id/iv_paixu"
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_action"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:src="@mipmap/h_paixu"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/iv_xuanze"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="ContentDescription" />
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/iv_xuanze"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:src="@mipmap/h_xuanze"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/iv_search"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="ContentDescription" />
<ImageView
android:id="@+id/iv_paixu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:src="@mipmap/h_paixu"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/iv_xuanze"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="ContentDescription" />
<ImageView
android:id="@+id/iv_xuanze"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:src="@mipmap/h_xuanze"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/iv_search"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="ContentDescription" />
<ImageView
android:id="@+id/iv_search"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:src="@mipmap/h_sousuo"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="ContentDescription" />
</androidx.constraintlayout.widget.ConstraintLayout>
<ImageView
android:id="@+id/iv_search"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:src="@mipmap/h_sousuo"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="ContentDescription" />
</androidx.constraintlayout.widget.ConstraintLayout>
......@@ -218,7 +229,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="9dp"
android:src="@drawable/bg_selector_bookmark"
android:src="@drawable/bg_selector_tool"
tools:ignore="ContentDescription" />
......@@ -227,7 +238,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="2.5dp"
android:text="Bookmark"
android:text="Tool"
android:textColor="@color/color_tab_selector"
android:textSize="11sp"
tools:ignore="HardcodedText" />
......
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
tools:context="com.artifex.mupdf.viewer.PdfTestActivity">
<RelativeLayout
android:id="@+id/rl"
android:layout_width="match_parent"
android:layout_height="match_parent">
</RelativeLayout>
<ViewAnimator
android:layout_width="match_parent"
android:layout_height="60dp"
app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_top"
android:layout_width="match_parent"
android:layout_height="60dp"
app:layout_constraintBottom_toTopOf="@id/pdfview"
app:layout_constraintTop_toTopOf="parent">
<FrameLayout
android:id="@+id/fl_fanhui"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/tv_pdf_name"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:padding="15dp"
android:src="@mipmap/fanhui_b"
tools:ignore="ContentDescription" />
</FrameLayout>
<TextView
android:id="@+id/tv_pdf_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/black"
android:textSize="19sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@id/fl_fanhui"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="HardcodedText"
tools:text="DEMO.pdf" />
<ImageView
android:id="@+id/iv_xuanzhuan"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:src="@mipmap/hengping"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/iv_search"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="ContentDescription" />
<ImageView
android:id="@+id/iv_search"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:src="@mipmap/h_sousuo"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/iv_more"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="ContentDescription" />
<ImageView
android:id="@+id/iv_more"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="16dp"
android:src="@mipmap/x_genduo"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="ContentDescription" />
<EditText
android:id="@+id/edit_search"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginStart="5dp"
android:layout_marginEnd="20dp"
android:background="@drawable/bg_f8f9fe_10"
android:hint="input..."
android:paddingHorizontal="18dp"
android:singleLine="true"
android:textColor="@color/black"
android:textColorHint="#B8B9BD"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/iv_search"
app:layout_constraintStart_toEndOf="@id/fl_fanhui"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="Autofill,HardcodedText,TextFields" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ViewAnimator>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg_f3f3f3_tlr25"
android:orientation="vertical">
<FrameLayout
android:id="@+id/fl"
android:layout_width="match_parent"
android:layout_height="65dp"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="16dp"
android:includeFontPadding="false"
android:text="Delete"
android:textColor="#333333"
android:textSize="17sp"
android:textStyle="bold"
tools:ignore="HardcodedText" />
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/fl">
<TextView
android:layout_width="match_parent"
android:layout_height="55dp"
android:layout_marginHorizontal="16dp"
android:layout_marginTop="32dp"
android:ellipsize="end"
android:gravity="center_vertical"
android:paddingHorizontal="20dp"
android:singleLine="true"
android:text="Are you sure you want to delete it?"
android:textColor="#333333"
android:textSize="18sp"
tools:ignore="Autofill,HardcodedText,LabelFor,TextFields" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="26dp"
android:layout_marginBottom="20dp">
<TextView
android:id="@+id/tv_cancel"
android:layout_width="163dp"
android:layout_height="48dp"
android:background="@drawable/bg_f1f2f6_10"
android:gravity="center"
android:text="Cancel"
android:textColor="#505050"
android:textSize="18sp"
tools:ignore="HardcodedText" />
<TextView
android:id="@+id/tv_delete"
android:layout_width="163dp"
android:layout_height="48dp"
android:layout_marginStart="14dp"
android:background="@drawable/bg_fb2b39_10"
android:gravity="center"
android:text="Delete"
android:textColor="@color/white"
android:textSize="18sp"
tools:ignore="HardcodedText" />
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......@@ -308,6 +308,7 @@
</LinearLayout>
<LinearLayout
android:id="@+id/ll_delete"
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginBottom="20dp"
......
......@@ -60,7 +60,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="13dp"
android:src="@mipmap/merge"
android:src="@mipmap/merge_tool"
tools:ignore="ContentDescription" />
<TextView
......@@ -128,7 +128,7 @@
<LinearLayout
android:id="@+id/ll_detail"
android:id="@+id/ll_jump"
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="?android:selectableItemBackground"
......@@ -139,7 +139,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="13dp"
android:src="@mipmap/particulars"
android:src="@mipmap/jump"
tools:ignore="ContentDescription" />
<TextView
......@@ -151,7 +151,7 @@
android:ellipsize="end"
android:includeFontPadding="false"
android:singleLine="true"
android:text="Detail"
android:text="Jump to the specified page"
android:textColor="#333333"
android:textSize="16sp"
tools:ignore="HardcodedText" />
......@@ -167,7 +167,7 @@
</LinearLayout>
<LinearLayout
android:id="@+id/ll_jump"
android:id="@+id/ll_detail"
android:layout_width="match_parent"
android:layout_height="60dp"
android:background="?android:selectableItemBackground"
......@@ -178,7 +178,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="13dp"
android:src="@mipmap/jump"
android:src="@mipmap/particulars"
tools:ignore="ContentDescription" />
<TextView
......@@ -190,7 +190,7 @@
android:ellipsize="end"
android:includeFontPadding="false"
android:singleLine="true"
android:text="Jump to the specified page"
android:text="Detail"
android:textColor="#333333"
android:textSize="16sp"
tools:ignore="HardcodedText" />
......@@ -205,6 +205,7 @@
</LinearLayout>
<LinearLayout
android:id="@+id/ll_share"
android:layout_width="match_parent"
......@@ -269,7 +270,7 @@
android:ellipsize="end"
android:includeFontPadding="false"
android:singleLine="true"
android:text="Delete"
android:text="Print"
android:textColor="#333333"
android:textSize="16sp"
tools:ignore="HardcodedText" />
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:keepScreenOn="true">
<ViewAnimator
android:id="@+id/switcher"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true">
<LinearLayout
android:id="@+id/mainBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:orientation="horizontal">
<FrameLayout
android:id="@+id/fl_fanhui"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:padding="15dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@mipmap/fanhui_b"
tools:ignore="ContentDescription" />
</FrameLayout>
<TextView
android:id="@+id/docNameText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:ellipsize="end"
android:singleLine="true"
android:textColor="@color/black"
android:textSize="19sp" />
<ImageButton
android:id="@+id/linkButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:background="@drawable/button"
android:src="@drawable/ic_link_white_24dp"
android:visibility="gone"
tools:ignore="ContentDescription" />
<ImageButton
android:id="@+id/searchButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:background="@drawable/button"
android:src="@mipmap/h_sousuo"
tools:ignore="ContentDescription" />
<ImageButton
android:id="@+id/layoutButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/button"
android:src="@drawable/ic_format_size_white_24dp"
android:visibility="gone"
tools:ignore="ContentDescription" />
<ImageButton
android:id="@+id/outlineButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/button"
android:src="@drawable/ic_toc_white_24dp"
android:visibility="gone"
tools:ignore="ContentDescription" />
</LinearLayout>
<LinearLayout
android:id="@+id/searchBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/toolbar"
android:orientation="horizontal">
<ImageButton
android:id="@+id/searchClose"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/button"
android:src="@drawable/ic_close_white_24dp" />
<EditText
android:id="@+id/searchText"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:background="@android:color/transparent"
android:hint="@string/search"
android:imeOptions="actionSearch"
android:inputType="text"
android:singleLine="true"
android:textColor="@android:color/white"
android:textColorHighlight="#a0a0a0"
android:textColorHint="#a0a0a0"
android:textSize="16sp" />
<ImageButton
android:id="@+id/searchBack"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/button"
android:src="@drawable/ic_chevron_left_white_24dp" />
<ImageButton
android:id="@+id/searchForward"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/button"
android:src="@drawable/ic_chevron_right_white_24dp" />
</LinearLayout>
</ViewAnimator>
<RelativeLayout
android:id="@+id/lowerButtons"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true">
<SeekBar
android:id="@+id/pageSlider"
android:layout_width="match_parent"
android:layout_height="36dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_margin="0dp"
android:background="@color/toolbar"
android:paddingLeft="16dp"
android:paddingTop="12dp"
android:paddingRight="16dp"
android:paddingBottom="8dp"
android:progressDrawable="@drawable/seek_line"
android:thumb="@drawable/seek_thumb" />
<TextView
android:id="@+id/pageNumber"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/pageSlider"
android:layout_centerHorizontal="true"
android:layout_marginBottom="16dp"
android:background="@drawable/page_indicator"
android:textColor="@android:color/white"
android:textSize="16sp" />
</RelativeLayout>
</RelativeLayout>
......@@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.document.DocumentFragment">
tools:context=".ui.main.DocumentFragment">
<androidx.recyclerview.widget.RecyclerView
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".ui.main.ToolFragment">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="42dp">
<LinearLayout
android:id="@+id/ll_merge"
android:layout_width="110dp"
android:layout_height="86dp"
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="UseCompoundDrawables">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="12dp"
android:src="@mipmap/merge_tool"
tools:ignore="ContentDescription" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
android:includeFontPadding="false"
android:text="Merge PDF"
android:textColor="#333333"
android:textSize="14sp"
tools:ignore="HardcodedText" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_manager"
android:layout_width="110dp"
android:layout_height="86dp"
android:layout_marginEnd="8dp"
android:orientation="vertical"
app:layout_constraintEnd_toStartOf="@id/ll_merge"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="UseCompoundDrawables">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="12dp"
android:src="@mipmap/manager_tool"
tools:ignore="ContentDescription" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
android:includeFontPadding="false"
android:text="File Manager"
android:textColor="#333333"
android:textSize="14sp"
tools:ignore="HardcodedText" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_split"
android:layout_width="110dp"
android:layout_height="86dp"
android:layout_marginStart="8dp"
android:orientation="vertical"
app:layout_constraintStart_toEndOf="@id/ll_merge"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="UseCompoundDrawables">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="12dp"
android:src="@mipmap/split_tool"
tools:ignore="ContentDescription" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
android:includeFontPadding="false"
android:text="Split PDF"
android:textColor="#333333"
android:textSize="14sp"
tools:ignore="HardcodedText" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp">
<LinearLayout
android:id="@+id/ll_lock"
android:layout_width="110dp"
android:layout_height="86dp"
android:orientation="vertical"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="UseCompoundDrawables">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="12dp"
android:src="@mipmap/lock_tool"
tools:ignore="ContentDescription" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
android:includeFontPadding="false"
android:text="Lock PDF"
android:textColor="#333333"
android:textSize="14sp"
tools:ignore="HardcodedText" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_scan"
android:layout_width="110dp"
android:layout_height="86dp"
android:layout_marginEnd="8dp"
android:orientation="vertical"
app:layout_constraintEnd_toStartOf="@id/ll_lock"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="UseCompoundDrawables">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="12dp"
android:src="@mipmap/scan_tool"
tools:ignore="ContentDescription" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
android:includeFontPadding="false"
android:text="Scan PDF"
android:textColor="#333333"
android:textSize="14sp"
tools:ignore="HardcodedText" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_unlock"
android:layout_width="110dp"
android:layout_height="86dp"
android:layout_marginStart="8dp"
android:orientation="vertical"
app:layout_constraintStart_toEndOf="@id/ll_lock"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="UseCompoundDrawables">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="12dp"
android:src="@mipmap/unlock_tool"
tools:ignore="ContentDescription" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
android:includeFontPadding="false"
android:text="Unlock PDF"
android:textColor="#333333"
android:textSize="14sp"
tools:ignore="HardcodedText" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<LinearLayout
android:id="@+id/ll_set"
android:layout_width="match_parent"
android:layout_height="61dp"
android:layout_marginHorizontal="15dp"
android:layout_marginTop="40dp"
android:background="@drawable/bg_fbfbfb_15">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="15dp"
android:src="@mipmap/set"
tools:ignore="ContentDescription" />
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="10dp"
android:layout_weight="1"
android:includeFontPadding="false"
android:text="Set"
android:textSize="16sp"
android:textStyle="bold"
tools:ignore="HardcodedText" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginEnd="24dp"
android:src="@mipmap/jianotou"
tools:ignore="ContentDescription" />
</LinearLayout>
</LinearLayout>
\ No newline at end of file
<resources>
<string name="app_name">PDF Viewer Scanner White</string>
<string name="app_name">PDF Viewer &amp; Scanner</string>
<!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</string>
<!-- Strings used for fragments for navigation -->
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<cache-path name="cache_files" path="."/>
<cache-path
name="cache_files"
path="." />
<external-path
name="extern_files"
path="." />
</paths>
/build
\ No newline at end of file
plugins {
alias(libs.plugins.androidLibrary)
alias(libs.plugins.jetbrainsKotlinAndroid)
}
android {
namespace = "com.base.mupdf"
compileSdk = 34
defaultConfig {
minSdk = 24
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles("consumer-rules.pro")
}
buildTypes {
release {
isMinifyEnabled = false
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
}
dependencies {
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.appcompat)
implementation(libs.material)
testImplementation(libs.junit)
androidTestImplementation(libs.androidx.junit)
androidTestImplementation(libs.androidx.espresso.core)
}
\ No newline at end of file
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
\ No newline at end of file
package com.base.mupdf
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.base.mupdf.test", appContext.packageName)
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
</manifest>
\ No newline at end of file
package com.base.mupdf
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
}
\ No newline at end of file
......@@ -7,6 +7,7 @@ pluginManagement {
maven("https://maven.aliyun.com/repository/google")
maven("https://maven.aliyun.com/repository/gradle-plugin")
maven("https://www.jitpack.io")
maven("https://maven.ghostscript.com/")
google {
......@@ -38,6 +39,7 @@ dependencyResolutionManagement {
maven("https://maven.aliyun.com/repository/google")
maven("https://maven.aliyun.com/repository/gradle-plugin")
maven("https://www.jitpack.io")
maven("https://maven.ghostscript.com/")
google()
mavenCentral()
......@@ -56,3 +58,4 @@ rootProject.name = "PDF Viewer Scanner White"
include(":app")
include(":android-pdf-viewer")
include(":PdfiumAndroid")
include(":mupdf")
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