本文整理汇总了Java中com.android.tools.lint.detector.api.Context.getProject方法的典型用法代码示例。如果您正苦于以下问题:Java Context.getProject方法的具体用法?Java Context.getProject怎么用?Java Context.getProject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.android.tools.lint.detector.api.Context
的用法示例。
在下文中一共展示了Context.getProject方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: afterCheckProject
import com.android.tools.lint.detector.api.Context; //导入方法依赖的package包/类
@Override
public void afterCheckProject(@NonNull Context context) {
// if it's not a library, it's an application
if (context.getProject() == context.getMainProject() && !context.getMainProject().isLibrary() && mApplicationTagLocation != null) {
if (!mHasActivity) {
context.report(ISSUE_MISSING_LAUNCHER, mApplicationTagLocation,
"Expecting " + ANDROID_MANIFEST_XML + " to have an <" + TAG_ACTIVITY + "> tag.");
} else if (!mHasLauncherActivity) {
context.report(ISSUE_MISSING_LAUNCHER, mApplicationTagLocation,
"Expecting " + ANDROID_MANIFEST_XML + " to have an activity with a launcher intent.");
}
}
}
示例2: getRequiredDensityFolders
import com.android.tools.lint.detector.api.Context; //导入方法依赖的package包/类
private List<String> getRequiredDensityFolders(@NonNull Context context) {
if (mCachedRequiredDensities == null
|| context.getProject() != mCachedDensitiesForProject) {
mCachedDensitiesForProject = context.getProject();
mCachedRequiredDensities = Lists.newArrayListWithExpectedSize(10);
List<String> applicableDensities = context.getProject().getApplicableDensities();
if (applicableDensities != null) {
mCachedRequiredDensities.addAll(applicableDensities);
} else {
if (INCLUDE_LDPI) {
mCachedRequiredDensities.add(DRAWABLE_LDPI);
}
mCachedRequiredDensities.add(DRAWABLE_MDPI);
mCachedRequiredDensities.add(DRAWABLE_HDPI);
mCachedRequiredDensities.add(DRAWABLE_XHDPI);
mCachedRequiredDensities.add(DRAWABLE_XXHDPI);
mCachedRequiredDensities.add(DRAWABLE_XXXHDPI);
}
}
return mCachedRequiredDensities;
}
示例3: afterCheckProject
import com.android.tools.lint.detector.api.Context; //导入方法依赖的package包/类
@Override
public void afterCheckProject(@NonNull Context context) {
// if it's a library
if (context.getProject() == context.getMainProject() && context.getMainProject().isLibrary()) {
for (int i = 0; i < mIconAttributesLocations.size(); i++) {
context.report(ISSUE_ICON_IN_LIBRARY, mIconAttributesLocations.get(i),
"Expecting " + ANDROID_MANIFEST_XML + " not to have an icon inside <" + TAG_APPLICATION + "> tag");
}
}
}
示例4: afterCheckProject
import com.android.tools.lint.detector.api.Context; //导入方法依赖的package包/类
@Override
public void afterCheckProject(@NonNull Context context) {
// if it is a library
if (context.getProject() == context.getMainProject() && context.getMainProject().isLibrary()) {
for (Location location : mPermissionTagsLocations) {
context.report(ISSUE_PERMISSION_USAGE_IN_LIBRARY, location,
"Expecting " + ANDROID_MANIFEST_XML + " not to have a <" + TAG_USES_PERMISSION + "> tag invocation");
}
}
}