com.android.tools.lint.detector.api
Class LayoutDetector

java.lang.Object
  extended by com.android.tools.lint.detector.api.Detector
      extended by com.android.tools.lint.detector.api.ResourceXmlDetector
          extended by com.android.tools.lint.detector.api.LayoutDetector
All Implemented Interfaces:
Detector.XmlScanner

@Beta
public abstract class LayoutDetector
extends ResourceXmlDetector

Abstract class specifically intended for layout detectors which provides some common utility methods shared by layout detectors.

NOTE: This is not a public or final API; if you rely on this be prepared to adjust your code for the next tools release.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.android.tools.lint.detector.api.Detector
Detector.BinaryResourceScanner, Detector.ClassScanner, Detector.GradleScanner, Detector.JavaScanner, Detector.OtherFileScanner, Detector.ResourceFolderScanner, Detector.XmlScanner
 
Field Summary
 
Fields inherited from interface com.android.tools.lint.detector.api.Detector.XmlScanner
ALL
 
Constructor Summary
LayoutDetector()
           
 
Method Summary
 boolean appliesTo(com.android.resources.ResourceFolderType folderType)
          Returns whether this detector applies to the given folder type.
protected  boolean hasPadding(org.w3c.dom.Element root)
           
protected static boolean isHeightFillParent(org.w3c.dom.Element element)
           
protected static boolean isWidthFillParent(org.w3c.dom.Element element)
           
 
Methods inherited from class com.android.tools.lint.detector.api.ResourceXmlDetector
appliesTo, run
 
Methods inherited from class com.android.tools.lint.detector.api.Detector
afterCheckFile, afterCheckLibraryProject, afterCheckProject, applicableSuperClasses, appliesToFolder, appliesToResourceRefs, beforeCheckFile, beforeCheckLibraryProject, beforeCheckProject, checkBinaryResource, checkCall, checkClass, checkClass, checkFolder, checkInstruction, createJavaVisitor, getApplicableAsmNodeTypes, getApplicableAttributes, getApplicableCallNames, getApplicableCallOwners, getApplicableConstructorTypes, getApplicableElements, getApplicableFiles, getApplicableMethodNames, getApplicableNodeTypes, getSpeed, getSpeed, visitAttribute, visitBuildScript, visitConstructor, visitDocument, visitElement, visitElementAfter, visitMethod, visitResourceReference
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.android.tools.lint.detector.api.Detector.XmlScanner
getApplicableAttributes, getApplicableElements, visitAttribute, visitDocument, visitElement, visitElementAfter
 

Constructor Detail

LayoutDetector

public LayoutDetector()
Method Detail

appliesTo

public boolean appliesTo(@NonNull
                         com.android.resources.ResourceFolderType folderType)
Description copied from class: ResourceXmlDetector
Returns whether this detector applies to the given folder type. This allows the detectors to be pruned from iteration, so for example when we are analyzing a string value file we don't need to look up detectors related to layout.

Overrides:
appliesTo in class ResourceXmlDetector
Parameters:
folderType - the folder type to be visited
Returns:
true if this detector can apply to resources in folders of the given type

isWidthFillParent

protected static boolean isWidthFillParent(@NonNull
                                           org.w3c.dom.Element element)

isHeightFillParent

protected static boolean isHeightFillParent(@NonNull
                                            org.w3c.dom.Element element)

hasPadding

protected boolean hasPadding(@NonNull
                             org.w3c.dom.Element root)