diff options
author | Tor Norbye <tnorbye@google.com> | 2012-11-07 13:18:55 -0800 |
---|---|---|
committer | Tor Norbye <tnorbye@google.com> | 2012-11-07 13:18:55 -0800 |
commit | eb21ce35df9c17480158d9d78bd2aac3647d41a5 (patch) | |
tree | ffe52714890fe413645e54c00b54cc1ff8efee28 /lint/libs | |
parent | e3023aa8af4e93f3ecc4c929153721c185551829 (diff) | |
download | sdk-eb21ce35df9c17480158d9d78bd2aac3647d41a5.zip sdk-eb21ce35df9c17480158d9d78bd2aac3647d41a5.tar.gz sdk-eb21ce35df9c17480158d9d78bd2aac3647d41a5.tar.bz2 |
Refine labelFor check: don't warn when hint is set
Change-Id: I397dc73b9ab9f13b142b8e38dbb328fff14cc50e
Diffstat (limited to 'lint/libs')
-rw-r--r-- | lint/libs/lint_checks/src/com/android/tools/lint/checks/LabelForDetector.java | 4 | ||||
-rw-r--r-- | lint/libs/lint_checks/tests/src/com/android/tools/lint/checks/data/res/layout/labelfor.xml | 9 |
2 files changed, 13 insertions, 0 deletions
diff --git a/lint/libs/lint_checks/src/com/android/tools/lint/checks/LabelForDetector.java b/lint/libs/lint_checks/src/com/android/tools/lint/checks/LabelForDetector.java index 74e510d..dea05bd 100644 --- a/lint/libs/lint_checks/src/com/android/tools/lint/checks/LabelForDetector.java +++ b/lint/libs/lint_checks/src/com/android/tools/lint/checks/LabelForDetector.java @@ -17,6 +17,7 @@ package com.android.tools.lint.checks; import static com.android.SdkConstants.ANDROID_URI; +import static com.android.SdkConstants.ATTR_HINT; import static com.android.SdkConstants.ATTR_ID; import static com.android.SdkConstants.ATTR_LABEL_FOR; import static com.android.SdkConstants.AUTO_COMPLETE_TEXT_VIEW; @@ -103,6 +104,9 @@ public class LabelForDetector extends LayoutDetector { } for (Element element : mTextFields) { + if (element.hasAttributeNS(ANDROID_URI, ATTR_HINT)) { + continue; + } String id = element.getAttributeNS(ANDROID_URI, ATTR_ID); boolean missing = true; if (mLabels.contains(id)) { diff --git a/lint/libs/lint_checks/tests/src/com/android/tools/lint/checks/data/res/layout/labelfor.xml b/lint/libs/lint_checks/tests/src/com/android/tools/lint/checks/data/res/layout/labelfor.xml index 7eec47e..7d4935c 100644 --- a/lint/libs/lint_checks/tests/src/com/android/tools/lint/checks/data/res/layout/labelfor.xml +++ b/lint/libs/lint_checks/tests/src/com/android/tools/lint/checks/data/res/layout/labelfor.xml @@ -72,4 +72,13 @@ android:ems="10" android:text="MultiAutoCompleteTextView" /> + <EditText + android:id="@+id/editText20" + android:hint="Enter your address" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:ems="10" + android:inputType="textPostalAddress" /> + + </LinearLayout>
\ No newline at end of file |