diff options
author | Tor Norbye <tnorbye@google.com> | 2012-11-20 16:31:42 -0800 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2012-11-20 16:31:42 -0800 |
commit | 31da0a916ec2babfe48d2c9c4ba674be0dc3fe64 (patch) | |
tree | d67c73e8c4364a83310a01e36f5cca46710dc609 /lint/libs | |
parent | 27147987343970a4644900982faf673d68aa750f (diff) | |
parent | 4a7f210ef524bf71267dfff12f30530f540c920c (diff) | |
download | sdk-31da0a916ec2babfe48d2c9c4ba674be0dc3fe64.zip sdk-31da0a916ec2babfe48d2c9c4ba674be0dc3fe64.tar.gz sdk-31da0a916ec2babfe48d2c9c4ba674be0dc3fe64.tar.bz2 |
Merge "39601: PxUsage shouldn't flag 0px"
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> |