diff options
| author | Mitsuru Oshima <oshima@google.com> | 2009-06-21 00:03:11 -0700 |
|---|---|---|
| committer | Mitsuru Oshima <oshima@google.com> | 2009-06-23 23:11:55 -0700 |
| commit | 64f59342d41849bd365cb43fad7505d5e3daa417 (patch) | |
| tree | b0cef479b2674ee78a8bff6e833224850a36f2ab /core/java/android/util | |
| parent | 5a42b08389f3fe9195930ce5d2998e68bb09b748 (diff) | |
| download | frameworks_base-64f59342d41849bd365cb43fad7505d5e3daa417.zip frameworks_base-64f59342d41849bd365cb43fad7505d5e3daa417.tar.gz frameworks_base-64f59342d41849bd365cb43fad7505d5e3daa417.tar.bz2 | |
* new screen resolution support impl.
* use full window for activities, and shift & clip the content
* refactored the compatibility code, and introdcued Translator class to handle cooridnate translations.
* removed a workaround to handle an activity with configChagne=rotation in old implementation.
* I'll fix background issue on rotation in next CL.
* removed unnecessary scaling code in SurfaceView, which I forgot to remove when I changed SurfaceView
not to scale the content.
Diffstat (limited to 'core/java/android/util')
| -rw-r--r-- | core/java/android/util/DisplayMetrics.java | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/core/java/android/util/DisplayMetrics.java b/core/java/android/util/DisplayMetrics.java index a095913..d89ada0 100644 --- a/core/java/android/util/DisplayMetrics.java +++ b/core/java/android/util/DisplayMetrics.java @@ -106,16 +106,8 @@ public class DisplayMetrics { * {@hide} */ public void updateMetrics(CompatibilityInfo compatibilityInfo, int orientation) { - if (compatibilityInfo.mScalingRequired) { - float invertedRatio = compatibilityInfo.mApplicationInvertedScale; - density *= invertedRatio; - scaledDensity *= invertedRatio; - xdpi *= invertedRatio; - ydpi *= invertedRatio; - widthPixels *= invertedRatio; - heightPixels *= invertedRatio; - } - if (!compatibilityInfo.mConfiguredExpandable) { + int xOffset = 0; + if (!compatibilityInfo.isConfiguredExpandable()) { // Note: this assume that configuration is updated before calling // updateMetrics method. int defaultWidth; @@ -141,11 +133,13 @@ public class DisplayMetrics { if (defaultWidth == widthPixels && defaultHeight == heightPixels) { // the screen size is same as expected size. make it expandable - compatibilityInfo.mExpandable = true; + compatibilityInfo.setExpandable(true); } else { - compatibilityInfo.mExpandable = false; + compatibilityInfo.setExpandable(false); // adjust the size only when the device's screen is bigger. if (defaultWidth < widthPixels) { + // content/window's x offset in original pixels + xOffset = ((widthPixels - defaultWidth) / 2); widthPixels = defaultWidth; } if (defaultHeight < heightPixels) { @@ -153,8 +147,19 @@ public class DisplayMetrics { } } } + compatibilityInfo.setVisibleRect(xOffset, widthPixels, heightPixels); + if (compatibilityInfo.isScalingRequired()) { + float invertedRatio = compatibilityInfo.applicationInvertedScale; + density *= invertedRatio; + scaledDensity *= invertedRatio; + xdpi *= invertedRatio; + ydpi *= invertedRatio; + widthPixels *= invertedRatio; + heightPixels *= invertedRatio; + } } + @Override public String toString() { return "DisplayMetrics{density=" + density + ", width=" + widthPixels + ", height=" + heightPixels + ", scaledDensity=" + scaledDensity + |
