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

java.lang.Object
  extended by com.android.tools.lint.detector.api.Context
      extended by com.android.tools.lint.detector.api.ResourceContext
Direct Known Subclasses:
XmlContext

@Beta
public class ResourceContext
extends Context

A Context used when checking resource files (both bitmaps and XML files; for XML files a subclass of this context is used: XmlContext.)

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.


Field Summary
 
Fields inherited from class com.android.tools.lint.detector.api.Context
file, mDriver
 
Constructor Summary
ResourceContext(LintDriver driver, Project project, Project main, java.io.File file, com.android.resources.ResourceFolderType folderType)
          Construct a new ResourceContext
 
Method Summary
 int getFolderVersion()
          Returns the folder version.
 com.android.resources.ResourceFolderType getResourceFolderType()
          Returns the resource folder type of this XML file, if any.
 
Methods inherited from class com.android.tools.lint.detector.api.Context
containsCommentSuppress, getClient, getConfiguration, getContents, getDriver, getMainProject, getPhase, getProject, getProperty, getScope, getSdkInfo, getSuppressCommentPrefix, isEnabled, isSuppressedWithComment, log, report, report, requestRepeat, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceContext

public ResourceContext(@NonNull
                       LintDriver driver,
                       @NonNull
                       Project project,
                       @Nullable
                       Project main,
                       @NonNull
                       java.io.File file,
                       @Nullable
                       com.android.resources.ResourceFolderType folderType)
Construct a new ResourceContext

Parameters:
driver - the driver running through the checks
project - the project containing the file being checked
main - the main project if this project is a library project, or null if this is not a library project. The main project is the root project of all library projects, not necessarily the directly including project.
file - the file being checked
folderType - the ResourceFolderType of this file, if any
Method Detail

getResourceFolderType

@Nullable
public com.android.resources.ResourceFolderType getResourceFolderType()
Returns the resource folder type of this XML file, if any.

Returns:
the resource folder type or null

getFolderVersion

public int getFolderVersion()
Returns the folder version. For example, for the file values-v14/foo.xml, it returns 14.

Returns:
the folder version, or -1 if no specific version was specified