Commit 33208aac authored by wanglei's avatar wanglei

Merge remote-tracking branch 'origin/master'

parents 75e0cf8d 9fd2497f
......@@ -139,7 +139,6 @@ class WebViewFragment : BaseFragment<FragmentWebViewBinding>() {
animator.interpolator = AccelerateDecelerateInterpolator()
animator.duration = 1000
animator.addUpdateListener { animation ->
Log.d("glc","animation:"+animation)
// 更新按钮的位置
button.translationY = animation.animatedValue as Float
}
......@@ -197,6 +196,7 @@ class WebViewFragment : BaseFragment<FragmentWebViewBinding>() {
//网页使用localStorage等Web存储API,需要启用DOM存储
webSettings.domStorageEnabled = true
webSettings.setUseWideViewPort(false);
//设置WebChromeClient
......
......@@ -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 file = File(it.path)
if (BuildConfig.DEBUG) {
......@@ -283,13 +290,15 @@ class FileFragment : BaseFragment<FragmentFileBinding>() {
System.currentTimeMillis() - file.lastModified() <= 15L * 24 * 60 * 60 * 1000
}
}
binding.root.post {
// 回到主线程更新 UI
activity?.runOnUiThread {
if (list.isEmpty()) {
binding.tvTitleRecent.visibility = View.GONE
}
adapter.setData(list)
}
}.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