Use the "No Banner" graphic as a Drawable resource, instead of as an asset.
This commit is contained in:
parent
a546ef3276
commit
0170050cad
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
|
@ -7,6 +7,7 @@
|
||||||
package org.dolphinemu.dolphinemu.gamelist;
|
package org.dolphinemu.dolphinemu.gamelist;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.graphics.Bitmap;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
@ -75,7 +76,21 @@ public final class GameListAdapter extends ArrayAdapter<GameListItem>
|
||||||
{
|
{
|
||||||
holder.title.setText(item.getName());
|
holder.title.setText(item.getName());
|
||||||
holder.subtitle.setText(item.getData());
|
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
|
// Make every other game in the list grey
|
||||||
|
|
|
@ -45,25 +45,7 @@ public final class GameListItem implements Comparable<GameListItem>
|
||||||
if (!file.isDirectory() && !path.isEmpty())
|
if (!file.isDirectory() && !path.isEmpty())
|
||||||
{
|
{
|
||||||
int[] Banner = NativeLibrary.GetBanner(path);
|
int[] Banner = NativeLibrary.GetBanner(path);
|
||||||
if (Banner[0] == 0)
|
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
|
|
||||||
{
|
{
|
||||||
image = Bitmap.createBitmap(Banner, 96, 32, Bitmap.Config.ARGB_8888);
|
image = Bitmap.createBitmap(Banner, 96, 32, Bitmap.Config.ARGB_8888);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue