diff options
| author | Eder Bastos <bastos.eder@gmail.com> | 2014-07-04 15:48:12 -0400 |
|---|---|---|
| committer | Eder Bastos <bastos.eder@gmail.com> | 2014-07-14 21:34:44 -0400 |
| commit | 0170050cad3a28ca4fdf0f34ff2f4414dd6b013a (patch) | |
| tree | c6dd6693eeaa50d305dccb4b69f8fb966f36ade7 /Source/Android/src | |
| parent | a546ef3276f4533f489a6381219199312e63f5df (diff) | |
Use the "No Banner" graphic as a Drawable resource, instead of as an asset.
Diffstat (limited to 'Source/Android/src')
| -rw-r--r-- | Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListAdapter.java | 17 | ||||
| -rw-r--r-- | Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListItem.java | 20 |
2 files changed, 17 insertions, 20 deletions
diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListAdapter.java b/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListAdapter.java index 30796593ca..aabd4f2bc3 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListAdapter.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListAdapter.java @@ -7,6 +7,7 @@ package org.dolphinemu.dolphinemu.gamelist; import android.content.Context; +import android.graphics.Bitmap; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -75,7 +76,21 @@ public final class GameListAdapter extends ArrayAdapter<GameListItem> { holder.title.setText(item.getName()); holder.subtitle.setText(item.getData()); - holder.icon.setImageBitmap(item.getImage()); + + Bitmap icon = item.getImage(); + + if (icon != null) + { + holder.icon.setImageBitmap(item.getImage()); + } + else + { + holder.icon.setImageResource(R.drawable.no_banner); + } + + String subtitle = String.format(context.getString(R.string.file_size_gib), item.getFilesize()); + + holder.subtitle.setText(subtitle); } // Make every other game in the list grey diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListItem.java b/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListItem.java index 1b72da7b9b..b804337781 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListItem.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListItem.java @@ -45,25 +45,7 @@ public final class GameListItem implements Comparable<GameListItem> if (!file.isDirectory() && !path.isEmpty()) { int[] Banner = NativeLibrary.GetBanner(path); - if (Banner[0] == 0) - { - try - { - // Open the no banner icon. - InputStream noBannerPath = ctx.getAssets().open("NoBanner.png"); - - // Decode the bitmap. - image = BitmapFactory.decodeStream(noBannerPath); - - // Scale the bitmap to match other banners. - image = Bitmap.createScaledBitmap(image, 96, 32, false); - } - catch (IOException e) - { - Log.e("GameListItem", e.toString()); - } - } - else + if (Banner[0] != 0) { image = Bitmap.createBitmap(Banner, 96, 32, Bitmap.Config.ARGB_8888); } |
