summaryrefslogtreecommitdiff
path: root/Source/Android/app/src/main/java
diff options
context:
space:
mode:
authorJosJuice <josjuice@gmail.com>2023-03-22 17:39:59 +0100
committerGitHub <noreply@github.com>2023-03-22 17:39:59 +0100
commit66e414133e4a64473ae06deafadc8b7242239e57 (patch)
treecb6782cc6d0c648d23e06b5afae4a655bedbf2d9 /Source/Android/app/src/main/java
parent4ae4a28465174a1bd0b7d496d74fc95be43ba009 (diff)
parentce66d5875f3d92b36e1faad9c035547786603a1b (diff)
Merge pull request #11680 from t895/long-press-fix
Android: Long press leanback game card fix
Diffstat (limited to 'Source/Android/app/src/main/java')
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/adapters/GameAdapter.kt3
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/adapters/GameRowPresenter.kt6
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/cheats/ui/CheatsActivity.kt3
3 files changed, 8 insertions, 4 deletions
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/adapters/GameAdapter.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/adapters/GameAdapter.kt
index 0f7ec20811..103ba4a318 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/adapters/GameAdapter.kt
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/adapters/GameAdapter.kt
@@ -17,6 +17,7 @@ import org.dolphinemu.dolphinemu.activities.EmulationActivity
import androidx.fragment.app.FragmentActivity
import androidx.lifecycle.lifecycleScope
import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import org.dolphinemu.dolphinemu.databinding.CardGameBinding
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) {
val customCoverUri = CoilUtils.findCustomCover(gameFile)
withContext(Dispatchers.Main) {
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/adapters/GameRowPresenter.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/adapters/GameRowPresenter.kt
index 4f062538f9..c23b4b3e14 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/adapters/GameRowPresenter.kt
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/adapters/GameRowPresenter.kt
@@ -15,6 +15,7 @@ import android.widget.ImageView
import androidx.fragment.app.FragmentActivity
import androidx.lifecycle.lifecycleScope
import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import org.dolphinemu.dolphinemu.dialogs.GamePropertiesDialog
import org.dolphinemu.dolphinemu.utils.CoilUtils
@@ -53,11 +54,12 @@ class GameRowPresenter(private val mActivity: FragmentActivity) : Presenter() {
// Set the background color of the card
val background = ContextCompat.getDrawable(context, R.drawable.tv_card_background)
cardParent.infoAreaBackground = background
- cardParent.setOnClickListener { view: View ->
+ cardParent.setOnLongClickListener { view: View ->
val activity = view.context as FragmentActivity
val fragment = GamePropertiesDialog.newInstance(holder.gameFile)
activity.supportFragmentManager.beginTransaction()
.add(fragment, GamePropertiesDialog.TAG).commit()
+ true
}
if (GameFileCacheManager.findSecondDisc(gameFile) != null) {
@@ -68,7 +70,7 @@ class GameRowPresenter(private val mActivity: FragmentActivity) : Presenter() {
}
}
- mActivity.lifecycleScope.launchWhenStarted {
+ mActivity.lifecycleScope.launch {
withContext(Dispatchers.IO) {
val customCoverUri = CoilUtils.findCustomCover(gameFile)
withContext(Dispatchers.Main) {
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/cheats/ui/CheatsActivity.kt b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/cheats/ui/CheatsActivity.kt
index dd1226d3f2..dec284abfb 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/cheats/ui/CheatsActivity.kt
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/cheats/ui/CheatsActivity.kt
@@ -24,6 +24,7 @@ import com.google.android.material.color.MaterialColors
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.android.material.elevation.ElevationOverlayProvider
import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import org.dolphinemu.dolphinemu.R
import org.dolphinemu.dolphinemu.databinding.ActivityCheatsBinding
@@ -171,7 +172,7 @@ class CheatsActivity : AppCompatActivity(), PanelSlideListener {
.setCancelable(false)
.show()
- lifecycleScope.launchWhenResumed {
+ lifecycleScope.launch {
withContext(Dispatchers.IO) {
val codes = downloadCodes(gameTdbId!!)
withContext(Dispatchers.Main) {