Commit ad0675a6 authored by wanglei's avatar wanglei Committed by wanglei

...

parent 581efd02
......@@ -4,6 +4,7 @@ import android.annotation.SuppressLint
import android.app.Activity
import android.app.Dialog
import android.content.Intent
import androidx.core.view.isEmpty
import androidx.core.view.isVisible
import androidx.lifecycle.lifecycleScope
import com.base.pdfviewerscannerwhite.bean.ConstObject
......@@ -24,12 +25,14 @@ import com.base.pdfviewerscannerwhite.ui.document.word.WordActivity
import com.base.pdfviewerscannerwhite.ui.view.DialogView.showDocumentHomeMoreDialog
import com.base.pdfviewerscannerwhite.ui.view.PdfDialog.showPdfHomeMoreDialog
import com.base.pdfviewerscannerwhite.ui.view.PdfDialog.showPdfPwdDialog
import com.base.pdfviewerscannerwhite.utils.LogEx
import com.base.pdfviewerscannerwhite.utils.PermissionUtils.checkStorePermission
import java.io.File
import java.util.Locale
class DocumentFragment() : BaseFragment<FragmentDocumentBinding>(), DocumentView {
private val TAG = "DocumentFragment"
var type = TYPE_PDF
private var documentList: ArrayList<DocumentBean> = arrayListOf()
lateinit var adapter: DocumentAdapter
......@@ -108,10 +111,10 @@ class DocumentFragment() : BaseFragment<FragmentDocumentBinding>(), DocumentView
}
override fun deleteDocument(item: DocumentBean) {
val list = documentList.toMutableList()
documentPresenter.deleteDocumentBean(item)
list.remove(item)
adapter.submitList(list)
val flag = documentList.removeIf { it.path == item.path }
LogEx.logDebug(TAG, "deleteDocument $item.path flag=$flag")
adapter.submitList(documentList)
binding.llEmpty.isVisible = adapter.items.isEmpty()
}
fun setRecentList() {
......
......@@ -96,9 +96,13 @@ object PdfDialog {
dialog.dismiss()
showDeleteDialog {
runCatching {
File(item.path).delete()
val flag = File(item.path).delete()
if (flag){
documentFragment.deleteDocument(item)
mainActivity.deleteDocument(item)
}
}
documentFragment.deleteDocument(item)
}
}
binding.llDetail.setOnClickListener {
......
......@@ -4,18 +4,17 @@
android:id="@+id/fl_border"
android:layout_width="103dp"
android:layout_height="145dp"
android:layout_marginHorizontal="12.5dp"
android:layout_marginVertical="7dp"
android:layout_marginHorizontal="5dp"
android:layout_marginVertical="5dp"
android:background="@drawable/bg_selector_pager_border">
<ImageView
android:id="@+id/iv_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="2dp"
android:importantForAccessibility="no"
android:scaleType="fitXY" />
android:scaleType="centerCrop" />
<ImageView
android:id="@+id/iv_selector"
......
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