diff options
Diffstat (limited to 'src/android')
| -rw-r--r-- | src/android/app/src/main/java/org/yuzu/yuzu_emu/adapters/GameAdapter.kt | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/src/android/app/src/main/java/org/yuzu/yuzu_emu/adapters/GameAdapter.kt b/src/android/app/src/main/java/org/yuzu/yuzu_emu/adapters/GameAdapter.kt index d4613fa8c..7a0969a55 100644 --- a/src/android/app/src/main/java/org/yuzu/yuzu_emu/adapters/GameAdapter.kt +++ b/src/android/app/src/main/java/org/yuzu/yuzu_emu/adapters/GameAdapter.kt | |||
| @@ -62,21 +62,6 @@ class GameAdapter(private val activity: AppCompatActivity) : RecyclerView.Adapte | |||
| 62 | override fun onBindViewHolder(holder: GameViewHolder, position: Int) { | 62 | override fun onBindViewHolder(holder: GameViewHolder, position: Int) { |
| 63 | if (isDatasetValid) { | 63 | if (isDatasetValid) { |
| 64 | if (cursor!!.moveToPosition(position)) { | 64 | if (cursor!!.moveToPosition(position)) { |
| 65 | holder.binding.imageGameScreen.scaleType = ImageView.ScaleType.CENTER_CROP | ||
| 66 | activity.lifecycleScope.launch { | ||
| 67 | withContext(Dispatchers.IO) { | ||
| 68 | val uri = | ||
| 69 | Uri.parse(cursor!!.getString(GameDatabase.GAME_COLUMN_PATH)).toString() | ||
| 70 | val bitmap = decodeGameIcon(uri) | ||
| 71 | withContext(Dispatchers.Main) { | ||
| 72 | holder.binding.imageGameScreen.load(bitmap) { | ||
| 73 | error(R.drawable.no_icon) | ||
| 74 | crossfade(true) | ||
| 75 | } | ||
| 76 | } | ||
| 77 | } | ||
| 78 | } | ||
| 79 | |||
| 80 | // TODO These shouldn't be necessary once the move to a DB-based model is complete. | 65 | // TODO These shouldn't be necessary once the move to a DB-based model is complete. |
| 81 | val game = Game( | 66 | val game = Game( |
| 82 | cursor!!.getString(GameDatabase.GAME_COLUMN_TITLE), | 67 | cursor!!.getString(GameDatabase.GAME_COLUMN_TITLE), |
| @@ -88,6 +73,15 @@ class GameAdapter(private val activity: AppCompatActivity) : RecyclerView.Adapte | |||
| 88 | ) | 73 | ) |
| 89 | holder.game = game | 74 | holder.game = game |
| 90 | 75 | ||
| 76 | holder.binding.imageGameScreen.scaleType = ImageView.ScaleType.CENTER_CROP | ||
| 77 | activity.lifecycleScope.launch { | ||
| 78 | val bitmap = decodeGameIcon(game.path) | ||
| 79 | holder.binding.imageGameScreen.load(bitmap) { | ||
| 80 | error(R.drawable.no_icon) | ||
| 81 | crossfade(true) | ||
| 82 | } | ||
| 83 | } | ||
| 84 | |||
| 91 | holder.binding.textGameTitle.text = game.title.replace("[\\t\\n\\r]+".toRegex(), " ") | 85 | holder.binding.textGameTitle.text = game.title.replace("[\\t\\n\\r]+".toRegex(), " ") |
| 92 | holder.binding.textGameCaption.text = game.company | 86 | holder.binding.textGameCaption.text = game.company |
| 93 | 87 | ||