summaryrefslogtreecommitdiffstats
path: root/core/java/android/content/res
diff options
context:
space:
mode:
authorMitsuru Oshima <oshima@google.com>2009-06-09 21:16:08 -0700
committerMitsuru Oshima <oshima@google.com>2009-06-10 15:22:17 -0700
commite5fb328825995aa33b5b7ecf8b5bee2b17f81715 (patch)
tree4b6ca87aaf21dd587e1d033f5ba3318c4329698f /core/java/android/content/res
parentca436e24dec0fa258a8a756c3e7d07bcb096c5b3 (diff)
downloadframeworks_base-e5fb328825995aa33b5b7ecf8b5bee2b17f81715.zip
frameworks_base-e5fb328825995aa33b5b7ecf8b5bee2b17f81715.tar.gz
frameworks_base-e5fb328825995aa33b5b7ecf8b5bee2b17f81715.tar.bz2
resolution support fix/improvement
* adding compatibility menu * backup gravity * set expanable=true if the screen size is hvga * density. * added "supports any density" mode. I'll add sdk check later. * disallow to catch orientation change event if the app is not expandable. This was causing layout problem under non-expandable mode. I discussed this with Mike C and we agreed to do this approach for now. We'll revisit if this causes problem to a lot of applications.
Diffstat (limited to 'core/java/android/content/res')
-rw-r--r--core/java/android/content/res/CompatibilityInfo.java22
-rw-r--r--core/java/android/content/res/Resources.java6
2 files changed, 19 insertions, 9 deletions
diff --git a/core/java/android/content/res/CompatibilityInfo.java b/core/java/android/content/res/CompatibilityInfo.java
index 19379fb..836de39 100644
--- a/core/java/android/content/res/CompatibilityInfo.java
+++ b/core/java/android/content/res/CompatibilityInfo.java
@@ -51,10 +51,17 @@ public class CompatibilityInfo {
public final float mApplicationInvertedScale;
/**
- *
* A boolean flag to indicates that the application can expand over the original size.
+ * The flag is set to true if
+ * 1) Application declares its expandable in manifest file using <expandable /> or
+ * 2) The screen size is same as (320 x 480) * density.
*/
- public final boolean mExpandable;
+ public boolean mExpandable;
+
+ /**
+ * A expandable flag in the configuration.
+ */
+ public final boolean mConfiguredExpandable;
/**
* A boolean flag to tell if the application needs scaling (when mApplicationScale != 1.0f)
@@ -62,13 +69,16 @@ public class CompatibilityInfo {
public final boolean mScalingRequired;
public CompatibilityInfo(ApplicationInfo appInfo) {
- // A temp workaround to fix rotation issue.
- // mExpandable = appInfo.expandable;
- mExpandable = true;
+ mExpandable = mConfiguredExpandable = appInfo.expandable;
+
float packageDensityScale = -1.0f;
if (appInfo.supportsDensities != null) {
int minDiff = Integer.MAX_VALUE;
for (int density : appInfo.supportsDensities) {
+ if (density == ApplicationInfo.ANY_DENSITY) {
+ packageDensityScale = 1.0f;
+ break;
+ }
int tmpDiff = Math.abs(DisplayMetrics.DEVICE_DENSITY - density);
if (tmpDiff == 0) {
packageDensityScale = 1.0f;
@@ -92,7 +102,7 @@ public class CompatibilityInfo {
private CompatibilityInfo() {
mApplicationScale = mApplicationInvertedScale = 1.0f;
- mExpandable = true;
+ mExpandable = mConfiguredExpandable = true;
mScalingRequired = false;
}
diff --git a/core/java/android/content/res/Resources.java b/core/java/android/content/res/Resources.java
index 976b618..2f63820 100644
--- a/core/java/android/content/res/Resources.java
+++ b/core/java/android/content/res/Resources.java
@@ -88,7 +88,7 @@ public class Resources {
PluralRules mPluralRule;
private final CompatibilityInfo mCompatibilityInfo;
-
+
private static final SparseArray<Object> EMPTY_ARRAY = new SparseArray<Object>() {
@Override
public void put(int k, Object o) {
@@ -1255,7 +1255,7 @@ public class Resources {
return array;
}
-
+
/**
* Store the newly updated configuration.
*/
@@ -1268,7 +1268,7 @@ public class Resources {
}
if (metrics != null) {
mMetrics.setTo(metrics);
- mMetrics.updateMetrics(mCompatibilityInfo, mConfiguration);
+ mMetrics.updateMetrics(mCompatibilityInfo, mConfiguration.orientation);
}
mMetrics.scaledDensity = mMetrics.density * mConfiguration.fontScale;