diff --git a/shell/android/src/com/reicast/emulator/XMLParser.java b/shell/android/src/com/reicast/emulator/XMLParser.java index ffa09a9f3..184ace54f 100755 --- a/shell/android/src/com/reicast/emulator/XMLParser.java +++ b/shell/android/src/com/reicast/emulator/XMLParser.java @@ -59,11 +59,10 @@ public class XMLParser extends AsyncTask { private Drawable game_icon; private boolean getId; private String gameId; + private String game_details; private static final String game_index = "http://thegamesdb.net/api/GetGamesList.php?platform=sega+dreamcast&name="; private static final String game_id = "http://thegamesdb.net/api/GetGame.php?platform=sega+dreamcast&id="; - private SparseArray game_details = new SparseArray(); - private SparseArray game_preview = new SparseArray(); public XMLParser(File game, int index, SharedPreferences mPrefs) { this.getId = false; @@ -79,6 +78,7 @@ public class XMLParser extends AsyncTask { public void setGameID(String id) { this.gameId = id; + initializeDefaults(); } protected void onPreExecute() { @@ -185,8 +185,7 @@ public class XMLParser extends AsyncTask { xmlParser.execute(game_name); } else { game_name = getValue(root, "GameTitle"); - String details = getValue(root, "Overview"); - game_details.put(index, details); + game_details = getValue(root, "Overview"); Element images = (Element) root.getElementsByTagName("Images").item(0); Element boxart = null; if (images.getElementsByTagName("boxart").getLength() > 1) { @@ -195,19 +194,14 @@ public class XMLParser extends AsyncTask { boxart = (Element) images.getElementsByTagName("boxart").item(0); } if (boxart != null) { - String image = "http://thegamesdb.net/banners/" + getElementValue(boxart); - game_preview.put(index, decodeBitmapIcon(image)); - game_icon = new BitmapDrawable(decodeBitmapIcon(image)); + Bitmap image = decodeBitmapIcon("http://thegamesdb.net/banners/" + getElementValue(boxart)); + game_icon = new BitmapDrawable(image); } } - } else { - initializeDefaults(); } } catch (Exception e) { - initializeDefaults(); + } - } else { - initializeDefaults(); } ((TextView) childview.findViewById(R.id.item_name)).setText(game_name); @@ -221,8 +215,7 @@ public class XMLParser extends AsyncTask { } private void initializeDefaults() { - game_details.put(index, - mContext.getString(R.string.info_unavailable)); + game_details = mContext.getString(R.string.info_unavailable); final String nameLower = game.getName().toLowerCase( Locale.getDefault()); if (Build.VERSION.SDK_INT < 21) { @@ -257,11 +250,7 @@ public class XMLParser extends AsyncTask { } public String getGameDetails() { - return game_details.get(index); - } - - public Bitmap getGamePreview() { - return game_preview.get(index); + return game_details; } public Document getDomElement(String xml) { diff --git a/shell/android/src/com/reicast/emulator/config/OptionsFragment.java b/shell/android/src/com/reicast/emulator/config/OptionsFragment.java index 2fa5a19fc..1bb562a3d 100644 --- a/shell/android/src/com/reicast/emulator/config/OptionsFragment.java +++ b/shell/android/src/com/reicast/emulator/config/OptionsFragment.java @@ -170,6 +170,14 @@ public class OptionsFragment extends Fragment { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { mPrefs.edit().putBoolean(Config.pref_gamedetails, isChecked).commit(); + if (!isChecked) { + File dir = new File(getActivity().getExternalFilesDir(null), "images"); + for (File file : dir.listFiles()) { + if (!file.isDirectory()) { + file.delete(); + } + } + } } }; Switch details_opt = (Switch) getView().findViewById(