Commit d9262a71 authored by leichao.gao's avatar leichao.gao

update

parent 52585616
...@@ -139,7 +139,6 @@ class WebViewFragment : BaseFragment<FragmentWebViewBinding>() { ...@@ -139,7 +139,6 @@ class WebViewFragment : BaseFragment<FragmentWebViewBinding>() {
animator.interpolator = AccelerateDecelerateInterpolator() animator.interpolator = AccelerateDecelerateInterpolator()
animator.duration = 1000 animator.duration = 1000
animator.addUpdateListener { animation -> animator.addUpdateListener { animation ->
Log.d("glc","animation:"+animation)
// 更新按钮的位置 // 更新按钮的位置
button.translationY = animation.animatedValue as Float button.translationY = animation.animatedValue as Float
} }
...@@ -197,6 +196,7 @@ class WebViewFragment : BaseFragment<FragmentWebViewBinding>() { ...@@ -197,6 +196,7 @@ class WebViewFragment : BaseFragment<FragmentWebViewBinding>() {
//网页使用localStorage等Web存储API,需要启用DOM存储 //网页使用localStorage等Web存储API,需要启用DOM存储
webSettings.domStorageEnabled = true webSettings.domStorageEnabled = true
webSettings.setUseWideViewPort(false);
//设置WebChromeClient //设置WebChromeClient
......
...@@ -274,7 +274,14 @@ class FileFragment : BaseFragment<FragmentFileBinding>() { ...@@ -274,7 +274,14 @@ class FileFragment : BaseFragment<FragmentFileBinding>() {
} }
private fun initMediaData() = Thread { private fun initMediaData() {
// 确保 Fragment 已经附加到 Activity
if (!isAdded) {
return
}
// 在新的线程中加载媒体文件列表
Thread {
val list = requireContext().getMediaFile().filter { val list = requireContext().getMediaFile().filter {
val file = File(it.path) val file = File(it.path)
if (BuildConfig.DEBUG) { if (BuildConfig.DEBUG) {
...@@ -283,13 +290,15 @@ class FileFragment : BaseFragment<FragmentFileBinding>() { ...@@ -283,13 +290,15 @@ class FileFragment : BaseFragment<FragmentFileBinding>() {
System.currentTimeMillis() - file.lastModified() <= 15L * 24 * 60 * 60 * 1000 System.currentTimeMillis() - file.lastModified() <= 15L * 24 * 60 * 60 * 1000
} }
} }
binding.root.post {
// 回到主线程更新 UI
activity?.runOnUiThread {
if (list.isEmpty()) { if (list.isEmpty()) {
binding.tvTitleRecent.visibility = View.GONE binding.tvTitleRecent.visibility = View.GONE
} }
adapter.setData(list) adapter.setData(list)
} }
}.start() }.start()
}
} }
\ No newline at end of file
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