Commit 2ff920a0 authored by wanglei's avatar wanglei

...

parent bbff540d
......@@ -15,7 +15,6 @@ import com.base.filerecoveryrecyclebin.databinding.FragmentRecycleBinBinding
import com.base.filerecoveryrecyclebin.help.BaseFragment
import com.base.filerecoveryrecyclebin.help.PermissionHelp.checkStorePermission
import com.base.filerecoveryrecyclebin.help.PermissionHelp.requestStorePermission
import com.base.filerecoveryrecyclebin.service.StayNotificationService
import com.base.filerecoveryrecyclebin.utils.LogEx
import com.base.filerecoveryrecyclebin.view.DialogViews.showGerPermission
import com.google.gson.Gson
......@@ -36,18 +35,18 @@ class RecycleBinFragment : BaseFragment<FragmentRecycleBinBinding>() {
@RequiresApi(Build.VERSION_CODES.Q)
override fun setView() {
handler = Handler(requireActivity().mainLooper) { message ->
if (message.what == 99) {
// LogEx.logDebug(TAG, "媒体库更新了")
initData()
}
if (message.what == 100) {
// LogEx.logDebug(TAG, "回收站数据更新了")
initData()
}
true
}
StayNotificationService.mainHandler = handler
// handler = Handler(requireActivity().mainLooper) { message ->
// if (message.what == 99) {
//// LogEx.logDebug(TAG, "媒体库更新了")
// initData()
// }
// if (message.what == 100) {
//// LogEx.logDebug(TAG, "回收站数据更新了")
// initData()
// }
// true
// }
// StayNotificationService.mainHandler = handler
recycleBinAdapter = RecycleBinAdapter { bean ->
......@@ -58,9 +57,7 @@ class RecycleBinFragment : BaseFragment<FragmentRecycleBinBinding>() {
binding.rv.adapter = recycleBinAdapter
val launcher = (requireActivity() as MainActivity).launcher
if (requireActivity().checkStorePermission()) {
initData()
} else {
if (!requireActivity().checkStorePermission()) {
requireContext().showGerPermission(allow = {
requireContext().requestStorePermission(launcher, result = { flag ->
if (flag) {
......@@ -109,5 +106,18 @@ class RecycleBinFragment : BaseFragment<FragmentRecycleBinBinding>() {
}
}
override fun onResume() {
super.onResume()
LogEx.logDebug(TAG, "onResume")
if (requireContext().checkStorePermission()) {
initData()
}
}
override fun onPause() {
super.onPause()
LogEx.logDebug(TAG, "onPause")
}
}
\ 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