Commit 2ff920a0 authored by wanglei's avatar wanglei

...

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