public class TypographyDetector
extends com.android.tools.lint.detector.api.ResourceXmlDetector
Modifier and Type | Class and Description |
---|---|
static class |
TypographyDetector.ReplaceEdit
An object describing a single edit to be made.
|
com.android.tools.lint.detector.api.Detector.BinaryResourceScanner, com.android.tools.lint.detector.api.Detector.ClassScanner, com.android.tools.lint.detector.api.Detector.GradleScanner, com.android.tools.lint.detector.api.Detector.JavaPsiScanner, com.android.tools.lint.detector.api.Detector.JavaScanner, com.android.tools.lint.detector.api.Detector.OtherFileScanner, com.android.tools.lint.detector.api.Detector.ResourceFolderScanner, com.android.tools.lint.detector.api.Detector.XmlScanner
Modifier and Type | Field and Description |
---|---|
static com.android.tools.lint.detector.api.Issue |
DASHES
Replace hyphens with dashes?
|
static com.android.tools.lint.detector.api.Issue |
ELLIPSIS
Replace ...
|
static com.android.tools.lint.detector.api.Issue |
FRACTIONS
Replace fraction strings with fraction characters?
|
static com.android.tools.lint.detector.api.Issue |
OTHER
The main issue discovered by this detector
|
static com.android.tools.lint.detector.api.Issue |
QUOTES
Replace dumb quotes with smart quotes?
|
Constructor and Description |
---|
TypographyDetector()
Constructs a new
TypographyDetector |
Modifier and Type | Method and Description |
---|---|
boolean |
appliesTo(com.android.resources.ResourceFolderType folderType) |
void |
beforeCheckProject(com.android.tools.lint.detector.api.Context context) |
java.util.Collection<java.lang.String> |
getApplicableElements() |
static java.util.List<TypographyDetector.ReplaceEdit> |
getEdits(java.lang.String issueId,
java.lang.String message,
org.w3c.dom.Node textNode)
Returns a list of edits to be applied to fix the suggestion made by the
given warning.
|
static java.util.List<TypographyDetector.ReplaceEdit> |
getEdits(java.lang.String issueId,
java.lang.String message,
java.lang.String text)
Returns a list of edits to be applied to fix the suggestion made by the
given warning.
|
com.android.tools.lint.detector.api.Speed |
getSpeed() |
void |
visitElement(com.android.tools.lint.detector.api.XmlContext context,
org.w3c.dom.Element element) |
afterCheckFile, afterCheckLibraryProject, afterCheckProject, applicableSuperClasses, appliesToFolder, appliesToResourceRefs, beforeCheckFile, beforeCheckLibraryProject, checkBinaryResource, checkCall, checkClass, checkClass, checkClass, checkFolder, checkInstruction, createJavaVisitor, createPsiVisitor, getApplicableAsmNodeTypes, getApplicableAttributes, getApplicableCallNames, getApplicableCallOwners, getApplicableConstructorTypes, getApplicableFiles, getApplicableMethodNames, getApplicableNodeTypes, getApplicablePsiTypes, getApplicableReferenceNames, getSpeed, visitAttribute, visitBuildScript, visitConstructor, visitConstructor, visitDocument, visitElementAfter, visitMethod, visitMethod, visitReference, visitResourceReference, visitResourceReference
public static final com.android.tools.lint.detector.api.Issue DASHES
public static final com.android.tools.lint.detector.api.Issue QUOTES
public static final com.android.tools.lint.detector.api.Issue FRACTIONS
public static final com.android.tools.lint.detector.api.Issue ELLIPSIS
public static final com.android.tools.lint.detector.api.Issue OTHER
public TypographyDetector()
TypographyDetector
public boolean appliesTo(@NonNull com.android.resources.ResourceFolderType folderType)
appliesTo
in class com.android.tools.lint.detector.api.ResourceXmlDetector
@NonNull public com.android.tools.lint.detector.api.Speed getSpeed()
getSpeed
in class com.android.tools.lint.detector.api.Detector
public java.util.Collection<java.lang.String> getApplicableElements()
getApplicableElements
in interface com.android.tools.lint.detector.api.Detector.XmlScanner
getApplicableElements
in class com.android.tools.lint.detector.api.Detector
public void beforeCheckProject(@NonNull com.android.tools.lint.detector.api.Context context)
beforeCheckProject
in class com.android.tools.lint.detector.api.Detector
public void visitElement(@NonNull com.android.tools.lint.detector.api.XmlContext context, @NonNull org.w3c.dom.Element element)
visitElement
in interface com.android.tools.lint.detector.api.Detector.XmlScanner
visitElement
in class com.android.tools.lint.detector.api.Detector
public static java.util.List<TypographyDetector.ReplaceEdit> getEdits(java.lang.String issueId, java.lang.String message, org.w3c.dom.Node textNode)
This is intended to help tools implement automatic fixes of these warnings. The reason only the message and issue id can be provided instead of actual state passed in the data field to a reporter is that fix operation can be run much later than the lint is processed (for example, in a subsequent run of the IDE when only the warnings have been persisted),
issueId
- the issue id, which should be the id for one of the
typography issuesmessage
- the actual error message, which should be a message
provided by this detectortextNode
- a text node which corresponds to the text node the
warning operated onpublic static java.util.List<TypographyDetector.ReplaceEdit> getEdits(java.lang.String issueId, java.lang.String message, java.lang.String text)
This is intended to help tools implement automatic fixes of these warnings. The reason only the message and issue id can be provided instead of actual state passed in the data field to a reporter is that fix operation can be run much later than the lint is processed (for example, in a subsequent run of the IDE when only the warnings have been persisted),
issueId
- the issue id, which should be the id for one of the
typography issuesmessage
- the actual error message, which should be a message
provided by this detectortext
- the text of the XML node where the warning appeared