本文整理汇总了Java中com.android.tools.lint.detector.api.Context.isEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java Context.isEnabled方法的具体用法?Java Context.isEnabled怎么用?Java Context.isEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.android.tools.lint.detector.api.Context
的用法示例。
在下文中一共展示了Context.isEnabled方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkOctal
import com.android.tools.lint.detector.api.Context; //导入方法依赖的package包/类
protected void checkOctal(
@NonNull Context context,
@NonNull String value,
@NonNull Object cookie) {
if (value.length() >= 2
&& value.charAt(0) == '0'
&& (value.length() > 2 || value.charAt(1) >= '8'
&& isInteger(value))
&& context.isEnabled(ACCIDENTAL_OCTAL)) {
String message = "The leading 0 turns this number into octal which is probably "
+ "not what was intended";
try {
long numericValue = Long.decode(value);
message += " (interpreted as " + numericValue + ")";
} catch (NumberFormatException nufe) {
message += " (and it is not a valid octal number)";
}
report(context, cookie, ACCIDENTAL_OCTAL, message);
}
}
示例2: report
import com.android.tools.lint.detector.api.Context; //导入方法依赖的package包/类
private void report(@NonNull Context context, @NonNull Object cookie, @NonNull Issue issue,
@NonNull String message) {
if (context.isEnabled(issue)) {
// Suppressed?
// Temporarily unconditionally checking for suppress comments in Gradle files
// since Studio insists on an AndroidLint id prefix
boolean checkComments = /*context.getClient().checkForSuppressComments()
&&*/ context.containsCommentSuppress();
if (checkComments) {
int startOffset = getStartOffset(context, cookie);
if (startOffset >= 0 && context.isSuppressedWithComment(startOffset, issue)) {
return;
}
}
context.report(issue, createLocation(context, cookie), message);
}
}
示例3: afterCheckProject
import com.android.tools.lint.detector.api.Context; //导入方法依赖的package包/类
@Override
public void afterCheckProject(@NonNull Context context) {
if (mFormatStrings != null) {
boolean checkCount = context.isEnabled(ARG_COUNT);
boolean checkValid = context.isEnabled(INVALID);
boolean checkTypes = context.isEnabled(ARG_TYPES);
// Ensure that all the format strings are consistent with respect to each other;
// e.g. they all have the same number of arguments, they all use all the
// arguments, and they all use the same types for all the numbered arguments
for (Map.Entry<String, List<Pair<Handle, String>>> entry : mFormatStrings.entrySet()) {
String name = entry.getKey();
List<Pair<Handle, String>> list = entry.getValue();
// Check argument counts
if (checkCount) {
checkArity(context, name, list);
}
// Check argument types (and also make sure that the formatting strings are valid)
if (checkValid || checkTypes) {
checkTypes(context, checkValid, checkTypes, name, list);
}
}
}
}
示例4: checkLocalMavenVersions
import com.android.tools.lint.detector.api.Context; //导入方法依赖的package包/类
private void checkLocalMavenVersions(Context context, GradleCoordinate dependency,
Object cookie, String groupId, String artifactId, File repository) {
GradleCoordinate max = SdkMavenRepository.getHighestInstalledVersion(groupId, artifactId,
repository, null, false);
if (max != null) {
if (COMPARE_PLUS_HIGHER.compare(dependency, max) < 0
&& context.isEnabled(DEPENDENCY)) {
String message = getNewerVersionAvailableMessage(dependency, max.getFullRevision());
report(context, cookie, DEPENDENCY, message);
}
}
}
示例5: beforeCheckProject
import com.android.tools.lint.detector.api.Context; //导入方法依赖的package包/类
@Override
public void beforeCheckProject(@NonNull Context context) {
mCheckDashes = context.isEnabled(DASHES);
mCheckQuotes = context.isEnabled(QUOTES);
mCheckFractions = context.isEnabled(FRACTIONS);
mCheckEllipsis = context.isEnabled(ELLIPSIS);
mCheckMisc = context.isEnabled(OTHER);
}