Android: Remove deprecated use of launchWhenStarted/Resumed
This commit is contained in:
parent
4ae4a28465
commit
cf0706c239
|
@ -17,6 +17,7 @@ import org.dolphinemu.dolphinemu.activities.EmulationActivity
|
||||||
import androidx.fragment.app.FragmentActivity
|
import androidx.fragment.app.FragmentActivity
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import org.dolphinemu.dolphinemu.databinding.CardGameBinding
|
import org.dolphinemu.dolphinemu.databinding.CardGameBinding
|
||||||
import org.dolphinemu.dolphinemu.dialogs.GamePropertiesDialog
|
import org.dolphinemu.dolphinemu.dialogs.GamePropertiesDialog
|
||||||
|
@ -72,7 +73,7 @@ class GameAdapter(private val mActivity: FragmentActivity) : RecyclerView.Adapte
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mActivity.lifecycleScope.launchWhenStarted {
|
mActivity.lifecycleScope.launch {
|
||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
val customCoverUri = CoilUtils.findCustomCover(gameFile)
|
val customCoverUri = CoilUtils.findCustomCover(gameFile)
|
||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
|
|
|
@ -15,6 +15,7 @@ import android.widget.ImageView
|
||||||
import androidx.fragment.app.FragmentActivity
|
import androidx.fragment.app.FragmentActivity
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import org.dolphinemu.dolphinemu.dialogs.GamePropertiesDialog
|
import org.dolphinemu.dolphinemu.dialogs.GamePropertiesDialog
|
||||||
import org.dolphinemu.dolphinemu.utils.CoilUtils
|
import org.dolphinemu.dolphinemu.utils.CoilUtils
|
||||||
|
@ -68,7 +69,7 @@ class GameRowPresenter(private val mActivity: FragmentActivity) : Presenter() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mActivity.lifecycleScope.launchWhenStarted {
|
mActivity.lifecycleScope.launch {
|
||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
val customCoverUri = CoilUtils.findCustomCover(gameFile)
|
val customCoverUri = CoilUtils.findCustomCover(gameFile)
|
||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
|
|
|
@ -24,6 +24,7 @@ import com.google.android.material.color.MaterialColors
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
import com.google.android.material.elevation.ElevationOverlayProvider
|
import com.google.android.material.elevation.ElevationOverlayProvider
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import org.dolphinemu.dolphinemu.R
|
import org.dolphinemu.dolphinemu.R
|
||||||
import org.dolphinemu.dolphinemu.databinding.ActivityCheatsBinding
|
import org.dolphinemu.dolphinemu.databinding.ActivityCheatsBinding
|
||||||
|
@ -171,7 +172,7 @@ class CheatsActivity : AppCompatActivity(), PanelSlideListener {
|
||||||
.setCancelable(false)
|
.setCancelable(false)
|
||||||
.show()
|
.show()
|
||||||
|
|
||||||
lifecycleScope.launchWhenResumed {
|
lifecycleScope.launch {
|
||||||
withContext(Dispatchers.IO) {
|
withContext(Dispatchers.IO) {
|
||||||
val codes = downloadCodes(gameTdbId!!)
|
val codes = downloadCodes(gameTdbId!!)
|
||||||
withContext(Dispatchers.Main) {
|
withContext(Dispatchers.Main) {
|
||||||
|
|
Loading…
Reference in New Issue