当前位置: 首页>>代码示例>>Java>>正文


Java Context.getMainProject方法代码示例

本文整理汇总了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.");
        }

    }
}
 
开发者ID:inaka,项目名称:lewis,代码行数:17,代码来源:LauncherActivityDetector.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:RtlDetector.java

示例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");
        }
    }
}
 
开发者ID:inaka,项目名称:lewis,代码行数:12,代码来源:IconInLibraryDetector.java

示例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");
        }
    }
}
 
开发者ID:inaka,项目名称:lewis,代码行数:12,代码来源:PermissionsInLibraryDetector.java

示例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$
    }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:OverdrawDetector.java


注:本文中的com.android.tools.lint.detector.api.Context.getMainProject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。