diff --git a/app/src/main/kotlin/bums/lunatic/launcher/LauncherActivity.kt b/app/src/main/kotlin/bums/lunatic/launcher/LauncherActivity.kt index 5b6cc2c3..0a9c62f8 100644 --- a/app/src/main/kotlin/bums/lunatic/launcher/LauncherActivity.kt +++ b/app/src/main/kotlin/bums/lunatic/launcher/LauncherActivity.kt @@ -243,7 +243,7 @@ open class LauncherActivity : CommonActivity() { // ๐Ÿ’ก URI๋กœ๋ถ€ํ„ฐ ํŒŒ์ผ์„ ์ฝ์–ด์„œ ํ”„๋ผ์ด๋น— ํด๋”๋กœ ๋ณต์‚ฌํ•˜๋Š” ํ•จ์ˆ˜ private fun saveToPrivateVault(uri: Uri) { var fileName = "shared_${System.currentTimeMillis()}" - CoroutineScope(Dispatchers.IO).launch { + lifecycleScope.launch(Dispatchers.IO) { try { // 1. ์›๋ณธ ํŒŒ์ผ๋ช… ๋ฐ ์ด ํŒŒ์ผ ํฌ๊ธฐ(์šฉ๋Ÿ‰) ์•Œ์•„๋‚ด๊ธฐ var totalFileSize = 0L // ๐Ÿ’ก ํŒŒ์ผ ํฌ๊ธฐ๋ฅผ ๋‹ด์„ ๋ณ€์ˆ˜ ์ถ”๊ฐ€ diff --git a/app/src/main/kotlin/bums/lunatic/launcher/home/SystemStatusFragment.kt b/app/src/main/kotlin/bums/lunatic/launcher/home/SystemStatusFragment.kt index 067af0ba..e00b8b51 100644 --- a/app/src/main/kotlin/bums/lunatic/launcher/home/SystemStatusFragment.kt +++ b/app/src/main/kotlin/bums/lunatic/launcher/home/SystemStatusFragment.kt @@ -28,6 +28,7 @@ import android.provider.Settings import android.util.TypedValue import android.view.LayoutInflater import android.view.View +import androidx.lifecycle.lifecycleScope import android.view.ViewGroup import android.widget.LinearLayout import android.widget.SeekBar @@ -230,7 +231,7 @@ class SystemStatusFragment : Fragment() { binding.btnQuickFlash.setTextColor(Color.YELLOW) // 30์ดˆ ์นด์šดํŠธ๋‹ค์šด ์‹œ์ž‘ - flashTimerJob = CoroutineScope(Dispatchers.Main).launch { + flashTimerJob = viewLifecycleOwner.lifecycleScope.launch { for (i in time downTo 1) { binding.btnQuickFlash.text = "flashlight_off" delay(1000L) @@ -307,7 +308,7 @@ class SystemStatusFragment : Fragment() { Blog.LOGE("๊ฑฐ์šธ ์‹คํ–‰ ์‹คํŒจ: ${e.message}") } }, androidx.core.content.ContextCompat.getMainExecutor(requireContext())) - CoroutineScope(Dispatchers.Main).launch { + viewLifecycleOwner.lifecycleScope.launch { for (i in 30 downTo 1) { if (!mirrorDialog.isShowing) break timerText.text = "๊ฑฐ์šธ ๋ชจ๋“œ ์ข…๋ฃŒ๊นŒ์ง€ $i" + "์ดˆ" @@ -392,7 +393,7 @@ class SystemStatusFragment : Fragment() { private fun startMonitoring() { if (monitorJob?.isActive == true) return - monitorJob = CoroutineScope(Dispatchers.Main).launch { + monitorJob = viewLifecycleOwner.lifecycleScope.launch { while (isActive) { updateSystemInfo() updateNetworkSpeed() @@ -580,7 +581,7 @@ class SystemStatusFragment : Fragment() { return } - CoroutineScope(Dispatchers.IO).launch { + viewLifecycleOwner.lifecycleScope.launch(Dispatchers.IO) { try { val networkStatsManager = requireContext().getSystemService(Context.NETWORK_STATS_SERVICE) as NetworkStatsManager val calendar = Calendar.getInstance()