Commit 79a385cd authored by wanglei's avatar wanglei

...

parent 2b0fe71a
...@@ -44,7 +44,7 @@ class DocumentAdapter(val activity: Activity) : BaseQuickAdapter<DocumentBean, D ...@@ -44,7 +44,7 @@ class DocumentAdapter(val activity: Activity) : BaseQuickAdapter<DocumentBean, D
val file = File(item.path) val file = File(item.path)
runCatching { runCatching {
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()
} }
when (item.uiType) { when (item.uiType) {
0 -> {//首页 0 -> {//首页
......
...@@ -29,6 +29,7 @@ import com.base.pdfviewerscannerwhite.ui.view.DialogView.showDocumentHomeMoreDia ...@@ -29,6 +29,7 @@ import com.base.pdfviewerscannerwhite.ui.view.DialogView.showDocumentHomeMoreDia
import com.base.pdfviewerscannerwhite.ui.view.PdfDialog.showPdfHomeMoreDialog import com.base.pdfviewerscannerwhite.ui.view.PdfDialog.showPdfHomeMoreDialog
import com.base.pdfviewerscannerwhite.utils.LogEx import com.base.pdfviewerscannerwhite.utils.LogEx
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import java.io.File import java.io.File
import java.util.Locale import java.util.Locale
...@@ -56,6 +57,19 @@ class DocumentPageFragment() : BaseFragment<FragmentDocumentPageBinding>(), Docu ...@@ -56,6 +57,19 @@ class DocumentPageFragment() : BaseFragment<FragmentDocumentPageBinding>(), Docu
isInitialized = true isInitialized = true
} }
override fun setListener() {
super.setListener()
binding.swipeRefreshLayout.setOnRefreshListener {
binding.swipeRefreshLayout.isRefreshing = true
refreshData()
lifecycleScope.launch(Dispatchers.Main) {
delay(1500)
binding.swipeRefreshLayout.isRefreshing = false
}
}
}
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
refreshData() refreshData()
......
...@@ -16,12 +16,20 @@ ...@@ -16,12 +16,20 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
<androidx.recyclerview.widget.RecyclerView <androidx.swiperefreshlayout.widget.SwipeRefreshLayout
android:id="@+id/rv" android:id="@+id/swipeRefreshLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent">
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:listitem="@layout/item_document" /> <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_document" />
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
</LinearLayout> </LinearLayout>
......
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