summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorXavier Ducrohet <xav@android.com>2011-03-17 14:11:23 -0700
committerXavier Ducrohet <xav@android.com>2011-03-17 14:24:50 -0700
commitc7c8c599a636a105db0d2eac3b8b332532a7a40f (patch)
treef2ba035079a3faaa7d2c34f70f37551856577fe5 /tools
parent5982bf66d4fdea38105d91ff0f9d38660ac87581 (diff)
downloadframeworks_base-c7c8c599a636a105db0d2eac3b8b332532a7a40f.zip
frameworks_base-c7c8c599a636a105db0d2eac3b8b332532a7a40f.tar.gz
frameworks_base-c7c8c599a636a105db0d2eac3b8b332532a7a40f.tar.bz2
Merge 67450db0 from honeycomb. Do not merge.
Change-Id: I0ca140dd6d9279ff313f930739ad40fbbed4f335 LayoutLib: TypedArray.getDimensionPixelSize can actually return <0
Diffstat (limited to 'tools')
-rw-r--r--tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeTypedArray.java15
1 files changed, 4 insertions, 11 deletions
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeTypedArray.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeTypedArray.java
index 138a455..b9f769f 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeTypedArray.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeTypedArray.java
@@ -491,18 +491,11 @@ public final class BridgeTypedArray extends TypedArray {
if (ResourceHelper.stringToFloat(s, mValue)) {
float f = mValue.getDimension(mBridgeResources.mMetrics);
- if (f < 0) {
- // negative values are not allowed in pixel dimensions
- Bridge.getLog().error(LayoutLog.TAG_BROKEN,
- "Negative pixel dimension: " + s,
- null, null /*data*/);
- return defValue;
- }
-
+ final int res = (int)(f+0.5f);
+ if (res != 0) return res;
if (f == 0) return 0;
- if (f < 1) return 1;
-
- return (int)(f+0.5f);
+ if (f > 0) return 1;
+ return defValue; // this is basically unreachable.
}
// looks like we were unable to resolve the dimension value