Commit 29c77e67 authored by wanglei's avatar wanglei

...

parent 292bf500
...@@ -131,6 +131,7 @@ class DocumentFragment() : BaseFragment<FragmentDocumentBinding>(), DocumentView ...@@ -131,6 +131,7 @@ class DocumentFragment() : BaseFragment<FragmentDocumentBinding>(), DocumentView
fun setAllList() { fun setAllList() {
if (isVisible) { if (isVisible) {
adapter.submitList(documentList) adapter.submitList(documentList)
binding.llEmpty.isVisible = documentList.isEmpty()
} }
} }
......
...@@ -32,6 +32,7 @@ import com.base.pdfviewerscannerwhite.utils.LogEx ...@@ -32,6 +32,7 @@ import com.base.pdfviewerscannerwhite.utils.LogEx
import com.base.pdfviewerscannerwhite.utils.PermissionUtils.checkStorePermission import com.base.pdfviewerscannerwhite.utils.PermissionUtils.checkStorePermission
import com.base.pdfviewerscannerwhite.utils.ToastUtils.toast import com.base.pdfviewerscannerwhite.utils.ToastUtils.toast
import com.base.pdfviewerscannerwhite.utils.updateMediaStore import com.base.pdfviewerscannerwhite.utils.updateMediaStore
import com.cherry.lib.doc.office.fc.ss.usermodel.charts.AxisPosition
@SuppressLint("SetTextI18n") @SuppressLint("SetTextI18n")
class MainActivity : BaseActivity<ActivityMainBinding>(), MainView { class MainActivity : BaseActivity<ActivityMainBinding>(), MainView {
...@@ -303,11 +304,11 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), MainView { ...@@ -303,11 +304,11 @@ class MainActivity : BaseActivity<ActivityMainBinding>(), MainView {
} }
private fun changeTabSelect(selectView: View) { private fun changeTabSelect(selectView: View) {
binding.llDocument.isSelected = selectView == binding.llDocument binding.llDocument.isSelected = selectView == binding.llDocument
binding.llRecent.isSelected = selectView == binding.llRecent binding.llRecent.isSelected = selectView == binding.llRecent
binding.llBookmark.isSelected = selectView == binding.llBookmark binding.llBookmark.isSelected = selectView == binding.llBookmark
binding.llTool.isSelected = selectView == binding.llTool binding.llTool.isSelected = selectView == binding.llTool
} }
fun changeRipple() = binding.root.postDelayed({ fun changeRipple() = binding.root.postDelayed({
......
...@@ -20,6 +20,7 @@ import com.base.pdfviewerscannerwhite.databinding.DialogDocumentMoreBinding ...@@ -20,6 +20,7 @@ import com.base.pdfviewerscannerwhite.databinding.DialogDocumentMoreBinding
import com.base.pdfviewerscannerwhite.databinding.DialogDocumentRenameBinding import com.base.pdfviewerscannerwhite.databinding.DialogDocumentRenameBinding
import com.base.pdfviewerscannerwhite.databinding.DialogPageNumberBinding import com.base.pdfviewerscannerwhite.databinding.DialogPageNumberBinding
import com.base.pdfviewerscannerwhite.databinding.DialogStoragePermissionBinding import com.base.pdfviewerscannerwhite.databinding.DialogStoragePermissionBinding
import com.base.pdfviewerscannerwhite.ui.main.DocumentFragment
import com.base.pdfviewerscannerwhite.ui.main.DocumentView import com.base.pdfviewerscannerwhite.ui.main.DocumentView
import com.base.pdfviewerscannerwhite.ui.main.MainActivity import com.base.pdfviewerscannerwhite.ui.main.MainActivity
import com.base.pdfviewerscannerwhite.utils.ActivityLauncher import com.base.pdfviewerscannerwhite.utils.ActivityLauncher
...@@ -98,10 +99,10 @@ object DialogView { ...@@ -98,10 +99,10 @@ object DialogView {
} }
@SuppressLint("SetTextI18n") @SuppressLint("SetTextI18n", "NotifyDataSetChanged")
fun Context.showDocumentHomeMoreDialog( fun Context.showDocumentHomeMoreDialog(
item: DocumentBean, item: DocumentBean,
documentView: DocumentView, documentFragment: DocumentFragment,
mainActivity: MainActivity, mainActivity: MainActivity,
): BottomSheetDialog { ): BottomSheetDialog {
val dialog = BottomSheetDialog(this, R.style.BottomSheetDialog) val dialog = BottomSheetDialog(this, R.style.BottomSheetDialog)
...@@ -138,7 +139,16 @@ object DialogView { ...@@ -138,7 +139,16 @@ object DialogView {
} }
} }
binding.llRename.setOnClickListener { binding.llRename.setOnClickListener {
showDocumentRenameDialog(file.name) { newName ->
dialog.dismiss()
documentFragment.documentPresenter.renameDocumentBean(file, newName) { newPath ->
if (newPath.isNotEmpty()) {
item.path = newPath
documentFragment.adapter.notifyDataSetChanged()
mainActivity.refreshSearchRv()
}
}
}
} }
binding.llDetail.setOnClickListener { binding.llDetail.setOnClickListener {
showDocumentDetail(item.path) showDocumentDetail(item.path)
...@@ -150,9 +160,13 @@ object DialogView { ...@@ -150,9 +160,13 @@ object DialogView {
dialog.dismiss() dialog.dismiss()
showDeleteDialog { showDeleteDialog {
runCatching { runCatching {
File(item.path).delete() val flag = File(item.path).delete()
if (flag){
documentFragment.deleteDocument(item)
mainActivity.deleteDocument(item)
}
} }
documentView.deleteDocument(item)
} }
} }
return dialog return dialog
......
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