Commit 3d1596c7 authored by wanglei's avatar wanglei

...

parent c30c7593
...@@ -45,21 +45,24 @@ ...@@ -45,21 +45,24 @@
android:launchMode="singleTop" android:launchMode="singleTop"
android:screenOrientation="portrait" android:screenOrientation="portrait"
tools:ignore="DiscouragedApi,LockedOrientationActivity" /> tools:ignore="DiscouragedApi,LockedOrientationActivity" />
<activity
<!-- <activity --> android:name=".ui.document.pdf.PdfMergeActivity"
<!-- android:name="com.artifex.mupdf.viewer.PdfTestActivity" --> android:exported="false"
<!-- android:exported="false" --> android:launchMode="singleTop"
<!-- android:launchMode="singleTop" --> android:screenOrientation="portrait"
<!-- android:screenOrientation="portrait" --> tools:ignore="DiscouragedApi,LockedOrientationActivity" />
<!-- tools:ignore="DiscouragedApi,LockedOrientationActivity" /> --> <activity
android:name=".ui.document.pdf.PdfSelectActivity"
android:exported="false"
android:launchMode="singleTop"
android:screenOrientation="portrait"
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
<activity <activity
android:name=".ui.document.pdf.PdfActivity" android:name=".ui.document.pdf.PdfActivity"
android:exported="false" android:exported="false"
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:theme="@style/Theme.PDFViewerScannerWhite" android:theme="@style/Theme.PDFViewerScannerWhite"
tools:ignore="DiscouragedApi,LockedOrientationActivity" /> tools:ignore="DiscouragedApi,LockedOrientationActivity" />
<activity <activity
android:name=".ui.document.pdf.PdfLoadingActivity" android:name=".ui.document.pdf.PdfLoadingActivity"
android:exported="false" android:exported="false"
......
...@@ -4,12 +4,14 @@ import android.net.Uri ...@@ -4,12 +4,14 @@ import android.net.Uri
data class DocumentBean( data class DocumentBean(
val path: String = "", val path: String = "",
var uri:Uri=Uri.EMPTY, var uri: Uri = Uri.EMPTY,
val type: String = "", val type: String = "",
var isBookmarked: Boolean = false var isBookmarked: Boolean = false
) { ) {
companion object { var showSelect: Boolean = false
var isSelect: Boolean = false
companion object {
const val TYPE_PDF = "type_pdf" const val TYPE_PDF = "type_pdf"
} }
} }
...@@ -22,6 +22,7 @@ class DocumentAdapter : BaseQuickAdapter<DocumentBean, DocumentAdapter.DocumentV ...@@ -22,6 +22,7 @@ class DocumentAdapter : BaseQuickAdapter<DocumentBean, DocumentAdapter.DocumentV
var itemClick: ((item: DocumentBean) -> Unit)? = null var itemClick: ((item: DocumentBean) -> Unit)? = null
var bookmarkAction: ((addRemove: Boolean, path: String) -> Unit)? = null var bookmarkAction: ((addRemove: Boolean, path: String) -> Unit)? = null
var moreAction: ((item: DocumentBean) -> Unit)? = null var moreAction: ((item: DocumentBean) -> Unit)? = null
var selectAction: ((size: Int) -> Unit)? = null
@SuppressLint("SetTextI18n") @SuppressLint("SetTextI18n")
override fun onBindViewHolder(holder: DocumentViewHolder, position: Int, item: DocumentBean?) { override fun onBindViewHolder(holder: DocumentViewHolder, position: Int, item: DocumentBean?) {
...@@ -33,6 +34,22 @@ class DocumentAdapter : BaseQuickAdapter<DocumentBean, DocumentAdapter.DocumentV ...@@ -33,6 +34,22 @@ class DocumentAdapter : BaseQuickAdapter<DocumentBean, DocumentAdapter.DocumentV
val file = File(item.path) val file = File(item.path)
binding.tvName.text = file.name binding.tvName.text = file.name
binding.tvInfo.text = file.lastModified().toFormatTime() + " " + file.length().toFormatSize() binding.tvInfo.text = file.lastModified().toFormatTime() + " " + file.length().toFormatSize()
if (item.showSelect) {
binding.flMore.visibility = View.INVISIBLE
binding.flBookmark.visibility = View.INVISIBLE
binding.flSelect.visibility = View.VISIBLE
binding.ivSelector.isSelected = item.isSelect
binding.flSelect.setOnClickListener {
item.isSelect = !item.isSelect
notifyItemChanged(position, "aaa")
selectAction?.invoke(items.filter { it.isSelect }.size)
}
} else {
binding.flSelect.visibility = View.GONE
binding.flMore.visibility = View.VISIBLE
binding.flBookmark.visibility = View.VISIBLE
if (item.isBookmarked) { if (item.isBookmarked) {
binding.ivBookmark.setImageResource(R.mipmap.h_soucang_s) binding.ivBookmark.setImageResource(R.mipmap.h_soucang_s)
} else { } else {
...@@ -51,6 +68,9 @@ class DocumentAdapter : BaseQuickAdapter<DocumentBean, DocumentAdapter.DocumentV ...@@ -51,6 +68,9 @@ class DocumentAdapter : BaseQuickAdapter<DocumentBean, DocumentAdapter.DocumentV
binding.flMore.setOnClickListener { binding.flMore.setOnClickListener {
moreAction?.invoke(item) moreAction?.invoke(item)
} }
}
binding.root.setOnClickListener { binding.root.setOnClickListener {
itemClick?.invoke(item) itemClick?.invoke(item)
} }
......
...@@ -11,7 +11,6 @@ import android.view.View ...@@ -11,7 +11,6 @@ import android.view.View
import android.view.animation.Animation import android.view.animation.Animation
import android.view.animation.TranslateAnimation import android.view.animation.TranslateAnimation
import android.view.inputmethod.EditorInfo import android.view.inputmethod.EditorInfo
import android.view.inputmethod.InputMethodManager
import androidx.activity.addCallback import androidx.activity.addCallback
import androidx.core.widget.addTextChangedListener import androidx.core.widget.addTextChangedListener
import com.artifex.mupdfdemo.Annotation import com.artifex.mupdfdemo.Annotation
...@@ -27,6 +26,8 @@ import com.base.pdfviewerscannerwhite.bean.PdfPageBean ...@@ -27,6 +26,8 @@ import com.base.pdfviewerscannerwhite.bean.PdfPageBean
import com.base.pdfviewerscannerwhite.databinding.ActivityPdfBinding import com.base.pdfviewerscannerwhite.databinding.ActivityPdfBinding
import com.base.pdfviewerscannerwhite.helper.BaseActivity import com.base.pdfviewerscannerwhite.helper.BaseActivity
import com.base.pdfviewerscannerwhite.ui.document.pdf.PdfLoadingActivity.Companion.DO_SAVE_PDF import com.base.pdfviewerscannerwhite.ui.document.pdf.PdfLoadingActivity.Companion.DO_SAVE_PDF
import com.base.pdfviewerscannerwhite.utils.KeyBoardUtils.hideKeyboard
import com.base.pdfviewerscannerwhite.utils.KeyBoardUtils.showKeyBoard
import com.base.pdfviewerscannerwhite.utils.ToastUtils.toast import com.base.pdfviewerscannerwhite.utils.ToastUtils.toast
import java.io.File import java.io.File
...@@ -71,20 +72,34 @@ class PdfActivity : BaseActivity<ActivityPdfBinding>(), PdfView { ...@@ -71,20 +72,34 @@ class PdfActivity : BaseActivity<ActivityPdfBinding>(), PdfView {
if (muPDFCore == null) { if (muPDFCore == null) {
toast("can't open pdf") toast("can't open pdf")
} else { } else {
pdfPresenter.iniPdfPage(path)
createPdfUI() createPdfUI()
binding.root.postDelayed({
pdfPresenter.iniPdfPage(path)
}, 500)
} }
} }
override fun initListener() { override fun initListener() {
onBackPressedDispatcher.addCallback { onBackPressedDispatcher.addCallback {
hideKeyboard(binding.editSearch)
if (uiMode == UI_MODE_SEARCH) { if (uiMode == UI_MODE_SEARCH) {
changeNormalUI() changeNormalUI()
cancelSearch()
return@addCallback
}
if (uiMode == UI_MODE_EDITE_SELECT) {
changeNormalUI()
cancelOperation()
return@addCallback
}
if (uiMode == UI_MODE_EDITE_SAVE) {
changeNormalUI()
resetPdfView()
return@addCallback return@addCallback
} }
finishToMain()
} }
binding.flFanhui.setOnClickListener { binding.flFanhui.setOnClickListener {
onBackPressedDispatcher.onBackPressed() onBackPressedDispatcher.onBackPressed()
...@@ -145,7 +160,7 @@ class PdfActivity : BaseActivity<ActivityPdfBinding>(), PdfView { ...@@ -145,7 +160,7 @@ class PdfActivity : BaseActivity<ActivityPdfBinding>(), PdfView {
binding.ivSearch.setOnClickListener { binding.ivSearch.setOnClickListener {
bianJiScaleXiao { bianJiScaleXiao {
changeSearchUI() changeSearchUI()
binding.editSearch.requestFocus() showKeyBoard(binding.editSearch)
} }
} }
binding.editSearch.addTextChangedListener { binding.editSearch.addTextChangedListener {
...@@ -172,11 +187,31 @@ class PdfActivity : BaseActivity<ActivityPdfBinding>(), PdfView { ...@@ -172,11 +187,31 @@ class PdfActivity : BaseActivity<ActivityPdfBinding>(), PdfView {
} }
} }
private fun resetPdfView() {
val pageView = binding.mupdfReaderView.displayedView as MuPDFView?
binding.mupdfReaderView.refresh(true)
}
private fun cancelOperation() {
val pageView = binding.mupdfReaderView.displayedView as MuPDFView?
if (pageView != null) {
pageView.deselectAnnotation()
pageView.deleteSelectedAnnotation()
pageView.deselectText()
pageView.cancelDraw()
}
}
private fun cancelSearch() {
SearchTaskResult.set(null)
binding.mupdfReaderView.resetupChildren()
}
/** /**
* 有个问题,一旦pdf某页编辑后加个蒙层,搜索功能就是失效了 * 有个问题,一旦pdf某页编辑后加个蒙层,搜索功能就是失效了
*/ */
private fun search(direction: Int) { private fun search(direction: Int) {
this.hideKeyboard() this.hideKeyboard(binding.editSearch)
val displayPage: Int = binding.mupdfReaderView.displayedViewIndex val displayPage: Int = binding.mupdfReaderView.displayedViewIndex
val r = SearchTaskResult.get() val r = SearchTaskResult.get()
val searchPage = r?.pageNumber ?: -1 val searchPage = r?.pageNumber ?: -1
...@@ -192,18 +227,12 @@ class PdfActivity : BaseActivity<ActivityPdfBinding>(), PdfView { ...@@ -192,18 +227,12 @@ class PdfActivity : BaseActivity<ActivityPdfBinding>(), PdfView {
} }
@SuppressLint("ServiceCast")
private fun hideKeyboard() {
val imm = this.getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager
imm.hideSoftInputFromWindow(binding.editSearch.windowToken, 0)
}
private var isShowTopBottomLayout = true private var isShowTopBottomLayout = true
private fun hideTopBottomLayout() { private fun hideTopBottomLayout() {
if (isShowTopBottomLayout) { if (isShowTopBottomLayout) {
isShowTopBottomLayout = false isShowTopBottomLayout = false
hideKeyboard() hideKeyboard(binding.editSearch)
val topAnim: Animation = TranslateAnimation(0f, 0f, 0f, -binding.vAnimatorTop.height.toFloat()) val topAnim: Animation = TranslateAnimation(0f, 0f, 0f, -binding.vAnimatorTop.height.toFloat())
topAnim.setDuration(200) topAnim.setDuration(200)
topAnim.setAnimationListener(object : Animation.AnimationListener { topAnim.setAnimationListener(object : Animation.AnimationListener {
...@@ -267,6 +296,7 @@ class PdfActivity : BaseActivity<ActivityPdfBinding>(), PdfView { ...@@ -267,6 +296,7 @@ class PdfActivity : BaseActivity<ActivityPdfBinding>(), PdfView {
} }
private fun bianJiScaleDa() { private fun bianJiScaleDa() {
if (binding.ivBianji.scaleX == 0f) {
val scaleXAnimator = ObjectAnimator.ofFloat(binding.ivBianji, "scaleX", 0f, 1.0f) val scaleXAnimator = ObjectAnimator.ofFloat(binding.ivBianji, "scaleX", 0f, 1.0f)
scaleXAnimator.duration = 200 scaleXAnimator.duration = 200
val scaleYAnimator = ObjectAnimator.ofFloat(binding.ivBianji, "scaleY", 0f, 1.0f) val scaleYAnimator = ObjectAnimator.ofFloat(binding.ivBianji, "scaleY", 0f, 1.0f)
...@@ -277,7 +307,10 @@ class PdfActivity : BaseActivity<ActivityPdfBinding>(), PdfView { ...@@ -277,7 +307,10 @@ class PdfActivity : BaseActivity<ActivityPdfBinding>(), PdfView {
animatorSet.start() animatorSet.start()
} }
}
private fun bianJiScaleXiao(endAction: (() -> Unit)? = null) { private fun bianJiScaleXiao(endAction: (() -> Unit)? = null) {
if (binding.ivBianji.scaleX == 1f) {
val scaleXAnimator = ObjectAnimator.ofFloat(binding.ivBianji, "scaleX", 1.0f, 0f) val scaleXAnimator = ObjectAnimator.ofFloat(binding.ivBianji, "scaleX", 1.0f, 0f)
scaleXAnimator.duration = 200 scaleXAnimator.duration = 200
val scaleYAnimator = ObjectAnimator.ofFloat(binding.ivBianji, "scaleY", 1.0f, 0f) val scaleYAnimator = ObjectAnimator.ofFloat(binding.ivBianji, "scaleY", 1.0f, 0f)
...@@ -296,6 +329,7 @@ class PdfActivity : BaseActivity<ActivityPdfBinding>(), PdfView { ...@@ -296,6 +329,7 @@ class PdfActivity : BaseActivity<ActivityPdfBinding>(), PdfView {
animatorSet.playTogether(scaleXAnimator, scaleYAnimator) animatorSet.playTogether(scaleXAnimator, scaleYAnimator)
animatorSet.start() animatorSet.start()
} }
}
/** /**
* 构建pdf的ui * 构建pdf的ui
...@@ -347,13 +381,18 @@ class PdfActivity : BaseActivity<ActivityPdfBinding>(), PdfView { ...@@ -347,13 +381,18 @@ class PdfActivity : BaseActivity<ActivityPdfBinding>(), PdfView {
*/ */
private fun changeNormalUI() { private fun changeNormalUI() {
uiMode = UI_MODE_NORMAL uiMode = UI_MODE_NORMAL
binding.ivWancheng.visibility = View.GONE
binding.clOperation.visibility = View.GONE binding.clOperation.visibility = View.GONE
binding.tvBtnSave.visibility = View.GONE binding.tvBtnSave.visibility = View.GONE
binding.editSearch.visibility = View.INVISIBLE
binding.ivXuanzhuan.visibility = View.VISIBLE binding.ivXuanzhuan.visibility = View.VISIBLE
binding.ivSearch.visibility = View.VISIBLE binding.ivSearch.visibility = View.VISIBLE
binding.ivMore.visibility = View.VISIBLE binding.ivMore.visibility = View.VISIBLE
binding.rvPager.visibility = View.VISIBLE binding.rvPager.visibility = View.VISIBLE
binding.tvPdfName.visibility = View.VISIBLE
bianJiScaleDa()
} }
/** /**
...@@ -386,6 +425,8 @@ class PdfActivity : BaseActivity<ActivityPdfBinding>(), PdfView { ...@@ -386,6 +425,8 @@ class PdfActivity : BaseActivity<ActivityPdfBinding>(), PdfView {
binding.ivWancheng.visibility = View.VISIBLE binding.ivWancheng.visibility = View.VISIBLE
if (binding.llHighlight == view) { if (binding.llHighlight == view) {
binding.llHighlight.setBackgroundColor(Color.parseColor("#F5F5F5")) binding.llHighlight.setBackgroundColor(Color.parseColor("#F5F5F5"))
} else { } else {
...@@ -413,6 +454,7 @@ class PdfActivity : BaseActivity<ActivityPdfBinding>(), PdfView { ...@@ -413,6 +454,7 @@ class PdfActivity : BaseActivity<ActivityPdfBinding>(), PdfView {
* 编辑报错UI模式 * 编辑报错UI模式
*/ */
private fun changeEditSaveUI() { private fun changeEditSaveUI() {
uiMode = UI_MODE_EDITE_SAVE
binding.ivWancheng.visibility = View.INVISIBLE binding.ivWancheng.visibility = View.INVISIBLE
binding.ivMore.visibility = View.INVISIBLE binding.ivMore.visibility = View.INVISIBLE
binding.ivXuanzhuan.visibility = View.INVISIBLE binding.ivXuanzhuan.visibility = View.INVISIBLE
...@@ -437,8 +479,8 @@ class PdfActivity : BaseActivity<ActivityPdfBinding>(), PdfView { ...@@ -437,8 +479,8 @@ class PdfActivity : BaseActivity<ActivityPdfBinding>(), PdfView {
const val UI_MODE_NORMAL = 0 const val UI_MODE_NORMAL = 0
const val UI_MODE_SEARCH = 1 const val UI_MODE_SEARCH = 1
const val UI_MODE_EDITE_SAVE = 2 const val UI_MODE_EDITE_SELECT = 2
const val UI_MODE_EDITE_SELECT = 3 const val UI_MODE_EDITE_SAVE = 3
const val SAVE_MODE_HIGHLIGHT = "Highlight" const val SAVE_MODE_HIGHLIGHT = "Highlight"
const val SAVE_MODE_GLIDE_LINE = "Glide Line" const val SAVE_MODE_GLIDE_LINE = "Glide Line"
......
package com.base.pdfviewerscannerwhite.ui.document.pdf
import com.base.pdfviewerscannerwhite.databinding.ActivityPdfMergeBinding
import com.base.pdfviewerscannerwhite.helper.BaseActivity
class PdfMergeActivity : BaseActivity<ActivityPdfMergeBinding>() {
override val binding: ActivityPdfMergeBinding by lazy {
ActivityPdfMergeBinding.inflate(layoutInflater)
}
override fun initView() {
}
}
\ No newline at end of file
package com.base.pdfviewerscannerwhite.ui.document.pdf
import android.annotation.SuppressLint
import android.view.View
import androidx.lifecycle.lifecycleScope
import com.base.pdfviewerscannerwhite.bean.DocumentBean
import com.base.pdfviewerscannerwhite.databinding.ActivityPdfSelectBinding
import com.base.pdfviewerscannerwhite.helper.BaseActivity
import com.base.pdfviewerscannerwhite.ui.adapter.DocumentAdapter
import com.base.pdfviewerscannerwhite.ui.main.DocumentPresenter
import com.base.pdfviewerscannerwhite.ui.main.DocumentView
class PdfSelectActivity : BaseActivity<ActivityPdfSelectBinding>(), DocumentView {
private lateinit var documentPresenter: DocumentPresenter
private lateinit var adapter: DocumentAdapter
override val binding: ActivityPdfSelectBinding by lazy {
ActivityPdfSelectBinding.inflate(layoutInflater)
}
override fun initView() {
documentPresenter = DocumentPresenter(this, this, DocumentBean.TYPE_PDF, lifecycleScope)
initAdapter()
documentPresenter.initData()
}
@SuppressLint("SetTextI18n")
private fun initAdapter() {
adapter = DocumentAdapter()
adapter.selectAction = {
if (it == 0) {
binding.tvSelectTip.visibility = View.INVISIBLE
binding.tvBtnNext.isEnabled = false
} else {
binding.tvBtnNext.isEnabled = true
binding.tvSelectTip.visibility = View.VISIBLE
binding.tvSelectTip.text = "$it items has been selected"
}
}
binding.rv.adapter = adapter
}
override fun refreshDocumentRv(documentList: List<DocumentBean>) {
super.refreshDocumentRv(documentList)
documentList.map { it.showSelect = true }
adapter.submitList(documentList)
}
}
\ No newline at end of file
...@@ -32,14 +32,14 @@ class DocumentFragment() : BaseFragment<FragmentDocumentBinding>(), DocumentView ...@@ -32,14 +32,14 @@ class DocumentFragment() : BaseFragment<FragmentDocumentBinding>(), DocumentView
} }
override fun setView() { override fun setView() {
documentPresenter = DocumentPresenter(this, type, lifecycleScope) documentPresenter = DocumentPresenter(requireContext(), this, type, lifecycleScope)
initAdapter() initAdapter()
if (documentList != null) { if (documentList != null) {
adapter.submitList(documentList) adapter.submitList(documentList)
} else { } else {
if (requireContext().checkStorePermission()) { if (requireContext().checkStorePermission()) {
documentPresenter.initData(requireContext()) documentPresenter.initData()
} }
} }
} }
...@@ -99,7 +99,7 @@ class DocumentFragment() : BaseFragment<FragmentDocumentBinding>(), DocumentView ...@@ -99,7 +99,7 @@ class DocumentFragment() : BaseFragment<FragmentDocumentBinding>(), DocumentView
override fun dialogRename(item: DocumentBean) { override fun dialogRename(item: DocumentBean) {
val file = File(item.path) val file = File(item.path)
requireContext().showDocumentRenameDialog(file.name, firstDialog) { newName -> requireContext().showDocumentRenameDialog(file.name, firstDialog) { newName ->
documentPresenter.renameDocumentBean(requireContext(), file, newName) documentPresenter.renameDocumentBean(file, newName)
} }
} }
......
...@@ -11,12 +11,13 @@ import kotlinx.coroutines.launch ...@@ -11,12 +11,13 @@ import kotlinx.coroutines.launch
import java.io.File import java.io.File
class DocumentPresenter( class DocumentPresenter(
val context: Context,
val documentView: DocumentView, val documentView: DocumentView,
val type: String, val type: String,
val lifecycleScope: LifecycleCoroutineScope val lifecycleScope: LifecycleCoroutineScope
) { ) {
fun getDocumentBeanList(context: Context): List<DocumentBean> { private fun getDocumentBeanList(): List<DocumentBean> {
var selectionArgs = arrayOf(ConstObject.MIME_TYPE_PDF) var selectionArgs = arrayOf(ConstObject.MIME_TYPE_PDF)
if (type == DocumentBean.TYPE_PDF) { if (type == DocumentBean.TYPE_PDF) {
selectionArgs = arrayOf(ConstObject.MIME_TYPE_PDF) selectionArgs = arrayOf(ConstObject.MIME_TYPE_PDF)
...@@ -30,8 +31,8 @@ class DocumentPresenter( ...@@ -30,8 +31,8 @@ class DocumentPresenter(
return documentList return documentList
} }
fun initData(context: Context) = lifecycleScope.launch(Dispatchers.IO) { fun initData() = lifecycleScope.launch(Dispatchers.IO) {
val documentList = getDocumentBeanList(context) val documentList = getDocumentBeanList()
launch(Dispatchers.Main) { launch(Dispatchers.Main) {
documentView.refreshDocumentRv(documentList) documentView.refreshDocumentRv(documentList)
} }
...@@ -45,13 +46,13 @@ class DocumentPresenter( ...@@ -45,13 +46,13 @@ class DocumentPresenter(
} }
} }
fun renameDocumentBean(context: Context, file: File, newName: String) = lifecycleScope.launch(Dispatchers.IO) { fun renameDocumentBean(file: File, newName: String) = lifecycleScope.launch(Dispatchers.IO) {
runCatching { runCatching {
val nameFile = File(file.parentFile, newName) val nameFile = File(file.parentFile, newName)
file.renameTo(nameFile) file.renameTo(nameFile)
} }
val documentList = getDocumentBeanList(context) val documentList = getDocumentBeanList()
launch(Dispatchers.Main) { launch(Dispatchers.Main) {
documentView.refreshDocumentRv(documentList) documentView.refreshDocumentRv(documentList)
} }
......
...@@ -4,9 +4,9 @@ import com.base.pdfviewerscannerwhite.bean.DocumentBean ...@@ -4,9 +4,9 @@ import com.base.pdfviewerscannerwhite.bean.DocumentBean
interface DocumentView { interface DocumentView {
fun dialogRename(item: DocumentBean) fun dialogRename(item: DocumentBean) = Unit
fun refreshDocumentRv(documentList: List<DocumentBean>) fun refreshDocumentRv(documentList: List<DocumentBean>) = Unit
fun splitPdf(path: String) fun splitPdf(path: String) = Unit
fun deleteDocument(item: DocumentBean) fun deleteDocument(item: DocumentBean) = Unit
} }
\ No newline at end of file
package com.base.pdfviewerscannerwhite.ui.main package com.base.pdfviewerscannerwhite.ui.main
import androidx.recyclerview.widget.RecyclerView import android.content.Intent
import com.base.pdfviewerscannerwhite.databinding.FragmentToolBinding import com.base.pdfviewerscannerwhite.databinding.FragmentToolBinding
import com.base.pdfviewerscannerwhite.helper.BaseFragment import com.base.pdfviewerscannerwhite.helper.BaseFragment
import com.base.pdfviewerscannerwhite.ui.document.pdf.PdfSelectActivity
class ToolFragment : BaseFragment<FragmentToolBinding>() { class ToolFragment : BaseFragment<FragmentToolBinding>() {
...@@ -14,4 +15,11 @@ class ToolFragment : BaseFragment<FragmentToolBinding>() { ...@@ -14,4 +15,11 @@ class ToolFragment : BaseFragment<FragmentToolBinding>() {
override fun setView() { override fun setView() {
} }
override fun setListener() {
super.setListener()
binding.llMerge.setOnClickListener {
startActivity(Intent(requireContext(), PdfSelectActivity::class.java))
}
}
} }
\ No newline at end of file
package com.base.pdfviewerscannerwhite.utils
import android.annotation.SuppressLint
import android.content.Context
import android.content.Context.INPUT_METHOD_SERVICE
import android.view.inputmethod.InputMethodManager
import android.widget.EditText
object KeyBoardUtils {
@SuppressLint("ServiceCast")
fun Context.hideKeyboard(editText: EditText) {
editText.clearFocus()
val imm = this.getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager
imm.hideSoftInputFromWindow(editText.windowToken, 0)
}
@SuppressLint("ServiceCast")
fun Context.showKeyBoard(editText: EditText) {
editText.requestFocus()
val imm = this.getSystemService(INPUT_METHOD_SERVICE) as InputMethodManager?
imm?.showSoftInput(editText, InputMethodManager.SHOW_IMPLICIT)
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"> <shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#00B8DE"/> <solid android:color="#7FDCEE"/>
<corners android:radius="10dp"/> <corners android:radius="10dp"/>
</shape> </shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/bg_00b8de_10" android:state_enabled="false" /> <item android:drawable="@drawable/bg_00b8de_10" android:state_enabled="true" />
<item android:drawable="@drawable/bg_7fdcee_10" android:state_enabled="true" /> <item android:drawable="@drawable/bg_7fdcee_10" android:state_enabled="false" />
</selector> </selector>
\ No newline at end of file
...@@ -90,7 +90,7 @@ ...@@ -90,7 +90,7 @@
android:src="@mipmap/wancheng" android:src="@mipmap/wancheng"
android:visibility="gone" android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/iv_more" app:layout_constraintStart_toStartOf="@id/iv_more"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
tools:ignore="ContentDescription" /> tools:ignore="ContentDescription" />
...@@ -159,6 +159,17 @@ ...@@ -159,6 +159,17 @@
app:layout_constraintTop_toBottomOf="@id/v_animator_top" app:layout_constraintTop_toBottomOf="@id/v_animator_top"
tools:text="1/3" /> tools:text="1/3" />
<ImageView
android:id="@+id/iv_bianji"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="15dp"
android:layout_marginBottom="108dp"
android:src="@mipmap/bianji"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
tools:ignore="ContentDescription" />
<ViewAnimator <ViewAnimator
android:id="@+id/v_animator_bottom" android:id="@+id/v_animator_bottom"
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -182,7 +193,6 @@ ...@@ -182,7 +193,6 @@
android:visibility="gone" android:visibility="gone"
app:layout_constraintBottom_toTopOf="@id/v_animator_bottom"> app:layout_constraintBottom_toTopOf="@id/v_animator_bottom">
<LinearLayout <LinearLayout
android:id="@+id/ll_highlight" android:id="@+id/ll_highlight"
...@@ -245,7 +255,6 @@ ...@@ -245,7 +255,6 @@
<LinearLayout <LinearLayout
android:id="@+id/ll_strikethrough" android:id="@+id/ll_strikethrough"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground" android:background="?android:attr/selectableItemBackground"
...@@ -288,7 +297,7 @@ ...@@ -288,7 +297,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:src="@mipmap/strike" android:src="@mipmap/painting"
tools:ignore="ContentDescription" /> tools:ignore="ContentDescription" />
<TextView <TextView
...@@ -296,7 +305,7 @@ ...@@ -296,7 +305,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:layout_marginTop="6dp" android:layout_marginTop="6dp"
android:text="Strikethrough" android:text="Painting Brush"
android:textColor="#232323" android:textColor="#232323"
android:textSize="12sp" android:textSize="12sp"
tools:ignore="HardcodedText" /> tools:ignore="HardcodedText" />
...@@ -320,16 +329,5 @@ ...@@ -320,16 +329,5 @@
</ViewAnimator> </ViewAnimator>
<ImageView
android:id="@+id/iv_bianji"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="15dp"
android:layout_marginBottom="108dp"
android:src="@mipmap/bianji"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
tools:ignore="ContentDescription" />
</androidx.constraintlayout.widget.ConstraintLayout> </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:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.document.pdf.PdfMergeActivity">
</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:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.document.pdf.PdfSelectActivity">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/cl_top"
android:layout_width="match_parent"
android:layout_height="60dp"
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_select_tip"
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_select_tip"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:ellipsize="end"
android:singleLine="true"
android:textColor="@color/black"
android:textSize="19sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/fl_fanhui"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="HardcodedText"
tools:text="1 item has been selected" />
</androidx.constraintlayout.widget.ConstraintLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginBottom="8dp"
app:layout_constraintBottom_toTopOf="@id/tv_btn_next"
app:layout_constraintTop_toBottomOf="@id/cl_top">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:listitem="@layout/item_docment" />
</FrameLayout>
<TextView
android:id="@+id/tv_btn_next"
android:layout_width="338dp"
android:layout_height="48dp"
android:layout_marginBottom="24dp"
android:background="@drawable/bg_selector_btn"
android:enabled="false"
android:gravity="center"
android:text="Next"
android:textColor="@color/white"
android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:ignore="HardcodedText" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
...@@ -17,8 +17,8 @@ ...@@ -17,8 +17,8 @@
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
tools:src="@mipmap/h_pdfiocn" tools:ignore="ContentDescription"
tools:ignore="ContentDescription" /> tools:src="@mipmap/h_pdfiocn" />
<FrameLayout <FrameLayout
...@@ -42,6 +42,29 @@ ...@@ -42,6 +42,29 @@
tools:ignore="ContentDescription" /> tools:ignore="ContentDescription" />
</FrameLayout> </FrameLayout>
<FrameLayout
android:id="@+id/fl_select"
android:layout_width="45dp"
android:layout_height="45dp"
android:layout_marginEnd="5dp"
android:background="?android:attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:padding="15dp"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/iv_selector"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/bg_selector_select"
tools:ignore="ContentDescription" />
</FrameLayout>
<FrameLayout <FrameLayout
android:id="@+id/fl_bookmark" android:id="@+id/fl_bookmark"
android:layout_width="45dp" android:layout_width="45dp"
......
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