Commit 8759bdfd authored by wanglei's avatar wanglei

...

parent 60c336dc
......@@ -103,7 +103,7 @@ class ExcelActivity : BaseActivity<ActivityExcelBinding>() {
binding.mDocView.visibility = View.VISIBLE
haveSearchResult = false
hideBottomLayout()
getSpreadsheet().resetSearchResult()
getSpreadsheet()?.resetSearchResult()
}
binding.editSearch.setOnEditorActionListener { v, actionId, event ->
......@@ -115,10 +115,10 @@ class ExcelActivity : BaseActivity<ActivityExcelBinding>() {
false
}
binding.flPre.setOnClickListener {
getSpreadsheet().findBackward()
getSpreadsheet()?.findBackward()
}
binding.flNext.setOnClickListener {
getSpreadsheet().findForward()
getSpreadsheet()?.findForward()
}
lifecycleScope.launch {
delay(3000)
......@@ -128,9 +128,9 @@ class ExcelActivity : BaseActivity<ActivityExcelBinding>() {
}
}
private fun getSpreadsheet(): Spreadsheet {
val ssControl: SSControl = (binding.mDocView.iOffice?.control?.appControl as SSControl)
return (ssControl.find as Spreadsheet)
private fun getSpreadsheet(): Spreadsheet? {
val ssControl: SSControl? = (binding.mDocView.iOffice?.control?.appControl as SSControl?)
return (ssControl?.find as Spreadsheet?)
}
private fun searchExcel() {
......@@ -139,7 +139,7 @@ class ExcelActivity : BaseActivity<ActivityExcelBinding>() {
if (text.isNullOrEmpty()) {
return
}
val flag = getSpreadsheet().find(text.toString())
val flag = getSpreadsheet()?.find(text.toString()) ?: false
haveSearchResult = flag
if (flag) {
hideKeyboard(binding.editSearch)
......
......@@ -24,6 +24,8 @@ import com.base.pdfviewerscannerwhite.ui.view.DialogView.showDocumentHomeMoreDia
import com.base.pdfviewerscannerwhite.ui.view.PdfDialog.showPdfHomeMoreDialog
import com.base.pdfviewerscannerwhite.utils.KotlinExt.toFormatTime3
import com.base.pdfviewerscannerwhite.utils.LogEx
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import java.io.File
import java.util.Locale
......@@ -58,21 +60,24 @@ class DocumentPageFragment() : BaseFragment<FragmentDocumentPageBinding>(), Docu
refreshData()
}
fun refreshData() {
fun refreshData() = lifecycleScope.launch(Dispatchers.IO) {
if (isInitialized && !isHidden) {
val list =
(requireActivity() as MainActivity).mainPresenter.getDataByType(type, dataType)
val dataType = (parentFragment as DocumentFragment).dataType
if (dataType == ConstObject.RECENT_DATA_TYPE) {
adapter.submitList(list)
} else {
val sortList = sortByMode(list)
adapter.submitList(sortList)
launch(Dispatchers.Main) {
if (dataType == ConstObject.RECENT_DATA_TYPE) {
adapter.submitList(list)
} else {
val sortList = sortByMode(list)
adapter.submitList(sortList)
}
binding.llEmpty.isVisible = list.isEmpty()
}
binding.llEmpty.isVisible = list.isEmpty()
Log.d("glc", "加载数据成功:" + type + " list:" + list.size)
// Log.d("glc", "加载数据成功:" + type + " list:" + list.size)
} else {
Log.d("glc", "加载数据失败:" + type)
// Log.d("glc", "加载数据失败:" + type)
}
}
......
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