diff options
author | Tor Norbye <tnorbye@google.com> | 2012-11-20 15:12:19 -0800 |
---|---|---|
committer | Tor Norbye <tnorbye@google.com> | 2012-11-20 15:12:19 -0800 |
commit | 4a7f210ef524bf71267dfff12f30530f540c920c (patch) | |
tree | 568a01ee2042ca83a677b4fe916bdc12b85ed96a /lint/libs | |
parent | 58f08e38bdba9e7d594802d0e3c9f7f5549382a1 (diff) | |
download | sdk-4a7f210ef524bf71267dfff12f30530f540c920c.zip sdk-4a7f210ef524bf71267dfff12f30530f540c920c.tar.gz sdk-4a7f210ef524bf71267dfff12f30530f540c920c.tar.bz2 |
39601: PxUsage shouldn't flag 0px
Change-Id: I87d24b9d9435656957d32ac16fef06af592e85e5
Diffstat (limited to 'lint/libs')
-rw-r--r-- | lint/libs/lint_checks/src/com/android/tools/lint/checks/PxUsageDetector.java | 4 | ||||
-rw-r--r-- | lint/libs/lint_checks/tests/src/com/android/tools/lint/checks/data/res/values/pxsp.xml | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/lint/libs/lint_checks/src/com/android/tools/lint/checks/PxUsageDetector.java b/lint/libs/lint_checks/src/com/android/tools/lint/checks/PxUsageDetector.java index d1c5c63..63aac6c 100644 --- a/lint/libs/lint_checks/src/com/android/tools/lint/checks/PxUsageDetector.java +++ b/lint/libs/lint_checks/src/com/android/tools/lint/checks/PxUsageDetector.java @@ -209,7 +209,7 @@ public class PxUsageDetector extends LayoutDetector { if (!Character.isWhitespace(c)) { if (c == 'x' && text.charAt(j - 1) == 'p') { // ends with px text = text.trim(); - if (text.matches("\\d+px")) { //$NON-NLS-1$ + if (text.matches("\\d+px") && text.charAt(0) != '0') { //$NON-NLS-1$ if (context.isEnabled(PX_ISSUE)) { context.report(PX_ISSUE, item, context.getLocation(textNode), "Avoid using \"px\" as units; use \"dp\" instead", null); @@ -219,7 +219,7 @@ public class PxUsageDetector extends LayoutDetector { c == 'n' && text.charAt(j - 1) == 'i') { text = text.trim(); String unit = text.substring(text.length() - 2); - if (text.matches("\\d+" + unit)) { //$NON-NLS-1$ + if (text.matches("\\d+" + unit) && text.charAt(0) != '0') { //$NON-NLS-1$ if (context.isEnabled(IN_MM_ISSUE)) { context.report(IN_MM_ISSUE, item, context.getLocation(textNode), String.format("Avoid using \"%1$s\" as units " diff --git a/lint/libs/lint_checks/tests/src/com/android/tools/lint/checks/data/res/values/pxsp.xml b/lint/libs/lint_checks/tests/src/com/android/tools/lint/checks/data/res/values/pxsp.xml index 91bf06b..7a44201 100644 --- a/lint/libs/lint_checks/tests/src/com/android/tools/lint/checks/data/res/values/pxsp.xml +++ b/lint/libs/lint_checks/tests/src/com/android/tools/lint/checks/data/res/values/pxsp.xml @@ -26,4 +26,9 @@ </item> </style> + <style name="Widget.TabStrip" parent="Widget"> + <item name="android:divider">?android:attr/listDivider</item> + <item name="android:showDividers">middle</item> + <item name="android:dividerPadding">0px</item> + </style> </resources> |