本文整理了Java中com.android.tools.lint.detector.api.Location.getClientData()
方法的一些代码示例,展示了Location.getClientData()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Location.getClientData()
方法的具体详情如下:
包路径:com.android.tools.lint.detector.api.Location
类名称:Location
方法名:getClientData
[英]Returns the client data associated with this location - an optional field which can be used by the creator of the Location to store temporary state associated with the location.
[中]返回与此位置关联的客户端数据-一个可选字段,该字段可由位置创建者用于存储与该位置关联的临时状态。
代码示例来源:origin: com.amazon.device.tools.lint/lint-checks
Location curr;
for (curr = location; curr != null; curr = curr.getSecondary()) {
Object clientData = curr.getClientData();
if (clientData instanceof Node) {
Node node = (Node) clientData;
代码示例来源:origin: com.android.tools.lint/lint-checks
Location curr;
for (curr = location; curr != null; curr = curr.getSecondary()) {
Object clientData = curr.getClientData();
if (clientData instanceof Node) {
Node node = (Node) clientData;
代码示例来源:origin: com.android.tools.lint/lint-checks
@Override
public void afterCheckProject(@NonNull Context context) {
if (mRootAttributes != null) {
for (Pair<Location, String> pair : mRootAttributes) {
Location location = pair.getFirst();
Object clientData = location.getClientData();
if (clientData instanceof Node) {
if (context.getDriver().isSuppressed(null, ISSUE, (Node) clientData)) {
return;
}
}
String layoutName = location.getFile().getName();
if (endsWith(layoutName, DOT_XML)) {
layoutName = layoutName.substring(0, layoutName.length() - DOT_XML.length());
}
String theme = getTheme(context, layoutName);
if (theme == null || !isBlankTheme(theme)) {
String drawable = pair.getSecond();
String message = String.format(
"Possible overdraw: Root element paints background `%1$s` with " +
"a theme that also paints a background (inferred theme is `%2$s`)",
drawable, theme);
// TODO: Compute applicable scope node
context.report(ISSUE, location, message);
}
}
}
}
代码示例来源:origin: com.amazon.device.tools.lint/lint-checks
@Override
public void afterCheckProject(@NonNull Context context) {
if (mRootAttributes != null) {
for (Pair<Location, String> pair : mRootAttributes) {
Location location = pair.getFirst();
Object clientData = location.getClientData();
if (clientData instanceof Node) {
if (context.getDriver().isSuppressed(null, ISSUE, (Node) clientData)) {
return;
}
}
String layoutName = location.getFile().getName();
if (endsWith(layoutName, DOT_XML)) {
layoutName = layoutName.substring(0, layoutName.length() - DOT_XML.length());
}
String theme = getTheme(context, layoutName);
if (theme == null || !isBlankTheme(theme)) {
String drawable = pair.getSecond();
String message = String.format(
"Possible overdraw: Root element paints background `%1$s` with " +
"a theme that also paints a background (inferred theme is `%2$s`)",
drawable, theme);
// TODO: Compute applicable scope node
context.report(ISSUE, location, message);
}
}
}
}
代码示例来源:origin: com.amazon.device.tools.lint/lint-checks
location = Location.create(occurrence.file);
} else {
Object clientData = location.getClientData();
if (clientData instanceof Node) {
Node node = (Node) clientData;
代码示例来源:origin: com.android.tools.lint/lint-checks
location = Location.create(occurrence.file);
} else {
Object clientData = location.getClientData();
if (clientData instanceof Node) {
Node node = (Node) clientData;
内容来源于网络,如有侵权,请联系作者删除!