本文整理汇总了Java中com.android.tools.lint.detector.api.Category类的典型用法代码示例。如果您正苦于以下问题:Java Category类的具体用法?Java Category怎么用?Java Category使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Category类属于com.android.tools.lint.detector.api包,在下文中一共展示了Category类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isCategoryName
import com.android.tools.lint.detector.api.Category; //导入依赖的package包/类
/**
* Returns true if the given category is a valid category
*
* @param name the category name to be checked
* @return true if the given string is a valid category
*/
public final boolean isCategoryName(@NonNull String name) {
for (Category category : getCategories()) {
if (category.getName().equals(name) || category.getFullName().equals(name)) {
return true;
}
}
return false;
}
示例2: getCategories
import com.android.tools.lint.detector.api.Category; //导入依赖的package包/类
/**
* Returns the available categories
*
* @return an iterator for all the categories, never null
*/
@NonNull
public List<Category> getCategories() {
if (sCategories == null) {
final Set<Category> categories = new HashSet<Category>();
for (Issue issue : getIssues()) {
categories.add(issue.getCategory());
}
List<Category> sorted = new ArrayList<Category>(categories);
Collections.sort(sorted);
sCategories = Collections.unmodifiableList(sorted);
}
return sCategories;
}
示例3: displayValidIds
import com.android.tools.lint.detector.api.Category; //导入依赖的package包/类
private static void displayValidIds(IssueRegistry registry, PrintStream out) {
List<Category> categories = registry.getCategories();
out.println("Valid issue categories:");
for (Category category : categories) {
out.println(" " + category.getFullName());
}
out.println();
List<Issue> issues = registry.getIssues();
out.println("Valid issue id's:");
for (Issue issue : issues) {
listIssue(out, issue);
}
}
示例4: showIssues
import com.android.tools.lint.detector.api.Category; //导入依赖的package包/类
private static void showIssues(IssueRegistry registry) {
List<Issue> issues = registry.getIssues();
List<Issue> sorted = new ArrayList<Issue>(issues);
Collections.sort(sorted, new Comparator<Issue>() {
@Override
public int compare(Issue issue1, Issue issue2) {
int d = issue1.getCategory().compareTo(issue2.getCategory());
if (d != 0) {
return d;
}
d = issue2.getPriority() - issue1.getPriority();
if (d != 0) {
return d;
}
return issue1.getId().compareTo(issue2.getId());
}
});
System.out.println("Available issues:\n");
Category previousCategory = null;
for (Issue issue : sorted) {
Category category = issue.getCategory();
if (!category.equals(previousCategory)) {
String name = category.getFullName();
System.out.println(name);
for (int i = 0, n = name.length(); i < n; i++) {
System.out.print('=');
}
System.out.println('\n');
previousCategory = category;
}
describeIssue(issue);
System.out.println();
}
}
示例5: writeOverview
import com.android.tools.lint.detector.api.Category; //导入依赖的package包/类
private void writeOverview(List<List<Warning>> related, int missingCount)
throws IOException {
// Write issue id summary
mWriter.write("<table class=\"overview\">\n"); //$NON-NLS-1$
String errorUrl = null;
String warningUrl = null;
if (!mSimpleFormat) {
errorUrl = addLocalResources(getErrorIconUrl());
warningUrl = addLocalResources(getWarningIconUrl());
mFixUrl = addLocalResources(HtmlReporter.class.getResource("lint-run.png")); //$NON-NLS-1$)
}
Category previousCategory = null;
for (List<Warning> warnings : related) {
Issue issue = warnings.get(0).issue;
boolean isError = false;
for (Warning warning : warnings) {
if (warning.severity == Severity.ERROR || warning.severity == Severity.FATAL) {
isError = true;
break;
}
}
if (issue.getCategory() != previousCategory) {
mWriter.write("<tr><td></td><td class=\"categoryColumn\">");
previousCategory = issue.getCategory();
String categoryName = issue.getCategory().getFullName();
mWriter.write("<a href=\"#"); //$NON-NLS-1$
mWriter.write(categoryName);
mWriter.write("\">"); //$NON-NLS-1$
mWriter.write(categoryName);
mWriter.write("</a>\n"); //$NON-NLS-1$
mWriter.write("</td></tr>"); //$NON-NLS-1$
mWriter.write("\n"); //$NON-NLS-1$
}
mWriter.write("<tr>\n"); //$NON-NLS-1$
// Count column
mWriter.write("<td class=\"countColumn\">"); //$NON-NLS-1$
mWriter.write(Integer.toString(warnings.size()));
mWriter.write("</td>"); //$NON-NLS-1$
mWriter.write("<td class=\"issueColumn\">"); //$NON-NLS-1$
String imageUrl = isError ? errorUrl : warningUrl;
if (imageUrl != null) {
mWriter.write("<img border=\"0\" align=\"top\" src=\""); //$NON-NLS-1$
mWriter.write(imageUrl);
mWriter.write("\" alt=\"");
mWriter.write(isError ? "Error" : "Warning");
mWriter.write("\" />\n"); //$NON-NLS-1$
}
mWriter.write("<a href=\"#"); //$NON-NLS-1$
mWriter.write(issue.getId());
mWriter.write("\">"); //$NON-NLS-1$
mWriter.write(issue.getId());
mWriter.write(": "); //$NON-NLS-1$
mWriter.write(issue.getBriefDescription(HTML));
mWriter.write("</a>\n"); //$NON-NLS-1$
mWriter.write("</td></tr>\n");
}
if (missingCount > 0 && !mClient.isCheckingSpecificIssues()) {
mWriter.write("<tr><td></td>"); //$NON-NLS-1$
mWriter.write("<td class=\"categoryColumn\">"); //$NON-NLS-1$
mWriter.write("<a href=\"#MissingIssues\">"); //$NON-NLS-1$
mWriter.write(String.format("Disabled Checks (%1$d)",
missingCount));
mWriter.write("</a>\n"); //$NON-NLS-1$
mWriter.write("</td></tr>"); //$NON-NLS-1$
}
mWriter.write("</table>\n"); //$NON-NLS-1$
mWriter.write("<br/>"); //$NON-NLS-1$
}
示例6: dummyIssue
import com.android.tools.lint.detector.api.Category; //导入依赖的package包/类
public static Issue dummyIssue() {
return Issue.create("", " ", " ", Category.LINT, 0, Severity.IGNORE,
mock(Implementation.class));
}