com.android.tools.lint.detector.api
Class ResourceContext
java.lang.Object
com.android.tools.lint.detector.api.Context
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.
Method Summary |
int |
getFolderVersion()
Returns the folder version. |
static int |
getFolderVersion(java.io.File file)
Returns the folder version of the given file. |
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, requestRepeat, setProperty |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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 checksproject
- the project containing the file being checkedmain
- 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 checkedfolderType
- the ResourceFolderType
of this file, if any
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
getFolderVersion
public static int getFolderVersion(java.io.File file)
- Returns the folder version of the given file. For example, for the file values-v14/foo.xml,
it returns 14.
- Parameters:
file
- the file to be checked
- Returns:
- the folder version, or -1 if no specific version was specified