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>() { ...@@ -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,22 +274,31 @@ class FileFragment : BaseFragment<FragmentFileBinding>() { ...@@ -274,22 +274,31 @@ class FileFragment : BaseFragment<FragmentFileBinding>() {
} }
private fun initMediaData() = Thread { private fun initMediaData() {
val list = requireContext().getMediaFile().filter { // 确保 Fragment 已经附加到 Activity
val file = File(it.path) if (!isAdded) {
if (BuildConfig.DEBUG) { return
true
} else {
System.currentTimeMillis() - file.lastModified() <= 15L * 24 * 60 * 60 * 1000
}
} }
binding.root.post {
if (list.isEmpty()) { // 在新的线程中加载媒体文件列表
binding.tvTitleRecent.visibility = View.GONE Thread {
val list = requireContext().getMediaFile().filter {
val file = File(it.path)
if (BuildConfig.DEBUG) {
true
} else {
System.currentTimeMillis() - file.lastModified() <= 15L * 24 * 60 * 60 * 1000
}
} }
adapter.setData(list)
}
}.start()
// 回到主线程更新 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