本文整理汇总了Java中com.android.tools.lint.detector.api.Context.getMainProject方法的典型用法代码示例。如果您正苦于以下问题:Java Context.getMainProject方法的具体用法?Java Context.getMainProject怎么用?Java Context.getMainProject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.android.tools.lint.detector.api.Context
的用法示例。
在下文中一共展示了Context.getMainProject方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: rtlApplies
import com.android.tools.lint.detector.api.Context; //导入方法依赖的package包/类
private boolean rtlApplies(@NonNull Context context) {
Project project = context.getMainProject();
if (project.getTargetSdk() < RTL_API) {
return false;
}
int buildTarget = project.getBuildSdk();
if (buildTarget != -1 && buildTarget < RTL_API) {
return false;
}
//noinspection RedundantIfStatement
if (mEnabledRtlSupport != null && !mEnabledRtlSupport) {
return false;
}
return true;
}
示例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");
}
}
}
示例5: getTheme
import com.android.tools.lint.detector.api.Context; //导入方法依赖的package包/类
/** Return the theme to be used for the given layout */
private String getTheme(Context context, String layoutName) {
if (mActivityToTheme != null && mLayoutToActivity != null) {
List<String> activities = mLayoutToActivity.get(layoutName);
if (activities != null) {
for (String activity : activities) {
String theme = mActivityToTheme.get(activity);
if (theme != null) {
return theme;
}
}
}
}
if (mManifestTheme != null) {
return mManifestTheme;
}
Project project = context.getMainProject();
int apiLevel = project.getTargetSdk();
if (apiLevel == -1) {
apiLevel = project.getMinSdk();
}
if (apiLevel >= 11) {
return "@android:style/Theme.Holo"; //$NON-NLS-1$
} else {
return "@android:style/Theme"; //$NON-NLS-1$
}
}