Update API-related code and reduce global vars
This commit is contained in:
parent
40c244a6ee
commit
f21e9382d2
|
@ -408,7 +408,7 @@ public class FileBrowser extends Fragment {
|
|||
builder.setCancelable(true);
|
||||
builder.setTitle(getString(R.string.game_details,
|
||||
xmlParser.getGameTitle()));
|
||||
builder.setMessage(xmlParser.game_details.get(index));
|
||||
builder.setMessage(xmlParser.getGameDetails());
|
||||
builder.setIcon(xmlParser.getGameIcon());
|
||||
builder.setPositiveButton("Close",
|
||||
new DialogInterface.OnClickListener() {
|
||||
|
|
|
@ -56,8 +56,8 @@ public class XMLParser extends AsyncTask<String, Integer, String> {
|
|||
private Drawable game_icon;
|
||||
|
||||
private static final String game_index = "http://thegamesdb.net/api/GetGame.php?platform=sega+dreamcast&name=";
|
||||
public SparseArray<String> game_details = new SparseArray<String>();
|
||||
public SparseArray<Bitmap> game_preview = new SparseArray<Bitmap>();
|
||||
private SparseArray<String> game_details = new SparseArray<String>();
|
||||
private SparseArray<Bitmap> game_preview = new SparseArray<Bitmap>();
|
||||
|
||||
public XMLParser(File game, int index, SharedPreferences mPrefs) {
|
||||
this.mPrefs = mPrefs;
|
||||
|
@ -217,6 +217,14 @@ public class XMLParser extends AsyncTask<String, Integer, String> {
|
|||
public String getGameTitle() {
|
||||
return game_name;
|
||||
}
|
||||
|
||||
public String getGameDetails() {
|
||||
return game_details.get(index);
|
||||
}
|
||||
|
||||
public Bitmap getGamePreview() {
|
||||
return game_preview.get(index);
|
||||
}
|
||||
|
||||
public Document getDomElement(String xml) {
|
||||
Document doc = null;
|
||||
|
|
|
@ -4,9 +4,11 @@ import java.util.HashMap;
|
|||
|
||||
import tv.ouya.console.api.OuyaController;
|
||||
import tv.ouya.console.api.OuyaFacade;
|
||||
import android.app.UiModeManager;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Build;
|
||||
import android.util.SparseArray;
|
||||
import android.view.KeyEvent;
|
||||
|
@ -180,6 +182,13 @@ public class Gamepad {
|
|||
}
|
||||
|
||||
public boolean IsOuyaOrTV(Context context) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
|
||||
UiModeManager uiModeManager = (UiModeManager)
|
||||
context.getSystemService(Context.UI_MODE_SERVICE);
|
||||
if (uiModeManager.getCurrentModeType() == Configuration.UI_MODE_TYPE_TELEVISION) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
PackageManager pMan = context.getPackageManager();
|
||||
if (pMan.hasSystemFeature(PackageManager.FEATURE_TELEVISION)) {
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue