aboutsummaryrefslogtreecommitdiff
path: root/backends/platform/android
diff options
context:
space:
mode:
authorAngus Lees2010-06-29 12:56:22 +0000
committerAngus Lees2010-06-29 12:56:22 +0000
commita3a1499444654ed30aa13c0ab753b0916245f865 (patch)
tree77ffcd0c2dba7e6188a8b5390451f08f4ae54d20 /backends/platform/android
parentc96d44d928a2cb47e70e428b4e61bcf80ceda42b (diff)
downloadscummvm-rg350-a3a1499444654ed30aa13c0ab753b0916245f865.tar.gz
scummvm-rg350-a3a1499444654ed30aa13c0ab753b0916245f865.tar.bz2
scummvm-rg350-a3a1499444654ed30aa13c0ab753b0916245f865.zip
Replace some code with constructs that work on Android pre-1.6.
Add a boolean for disabling the "no plugins found" warning. svn-id: r50494
Diffstat (limited to 'backends/platform/android')
-rw-r--r--backends/platform/android/org/inodes/gus/scummvm/ScummVMActivity.java21
-rw-r--r--backends/platform/android/org/inodes/gus/scummvm/Unpacker.java4
2 files changed, 19 insertions, 6 deletions
diff --git a/backends/platform/android/org/inodes/gus/scummvm/ScummVMActivity.java b/backends/platform/android/org/inodes/gus/scummvm/ScummVMActivity.java
index ba3c058ae4..b37b2b8a52 100644
--- a/backends/platform/android/org/inodes/gus/scummvm/ScummVMActivity.java
+++ b/backends/platform/android/org/inodes/gus/scummvm/ScummVMActivity.java
@@ -32,14 +32,27 @@ public class ScummVMActivity extends Activity {
private class MyScummVM extends ScummVM {
private boolean scummvmRunning = false;
+ private boolean usingSmallScreen() {
+ // Multiple screen sizes came in with Android 1.6. Have
+ // to use reflection in order to continue supporting 1.5
+ // devices :(
+ DisplayMetrics metrics = new DisplayMetrics();
+ getWindowManager().getDefaultDisplay().getMetrics(metrics);
+ try {
+ // This 'density' term is very confusing.
+ int DENSITY_LOW = metrics.getClass().getField("DENSITY_LOW").getInt(null);
+ int densityDpi = metrics.getClass().getField("densityDpi").getInt(metrics);
+ return densityDpi <= DENSITY_LOW;
+ } catch (Exception e) {
+ return false;
+ }
+ }
+
public MyScummVM() {
super(ScummVMActivity.this);
// Enable ScummVM zoning on 'small' screens.
- // This 'density' term is very confusing.
- DisplayMetrics metrics = new DisplayMetrics();
- getWindowManager().getDefaultDisplay().getMetrics(metrics);
- enableZoning(metrics.densityDpi <= DisplayMetrics.DENSITY_LOW);
+ enableZoning(usingSmallScreen());
}
@Override
diff --git a/backends/platform/android/org/inodes/gus/scummvm/Unpacker.java b/backends/platform/android/org/inodes/gus/scummvm/Unpacker.java
index efa3e1d2ef..7280aac7d4 100644
--- a/backends/platform/android/org/inodes/gus/scummvm/Unpacker.java
+++ b/backends/platform/android/org/inodes/gus/scummvm/Unpacker.java
@@ -34,6 +34,7 @@ import java.util.zip.ZipFile;
import java.util.zip.ZipEntry;
public class Unpacker extends Activity {
+ private final static boolean PLUGINS_ENABLED = true;
private final static String META_NEXT_ACTIVITY =
"org.inodes.gus.unpacker.nextActivity";
private ProgressBar mProgress;
@@ -79,7 +80,6 @@ public class Unpacker extends Activity {
if (cn != null) {
final Intent origIntent = getIntent();
Intent intent = new Intent();
- intent.setPackage(origIntent.getPackage());
intent.setComponent(cn);
if (origIntent.getExtras() != null)
intent.putExtras(origIntent.getExtras());
@@ -294,7 +294,7 @@ public class Unpacker extends Activity {
Intent intent = new Intent(ScummVMApplication.ACTION_PLUGIN_QUERY);
List<ResolveInfo> plugins = getPackageManager()
.queryBroadcastReceivers(intent, 0);
- if (plugins.isEmpty()) {
+ if (PLUGINS_ENABLED && plugins.isEmpty()) {
// No plugins installed
AlertDialog.Builder alert = new AlertDialog.Builder(this)
.setTitle(R.string.no_plugins_title)