Java Code Examples for com.android.tools.lint.detector.api.Context#getProject()
The following examples show how to use
com.android.tools.lint.detector.api.Context#getProject() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LauncherActivityDetector.java From lewis with Apache License 2.0 | 6 votes |
@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."); } } }
Example 2
Source File: MainActivityDetector.java From android-custom-lint-rules with Apache License 2.0 | 6 votes |
@Override public void afterCheckProject(@NonNull Context context) { // Don't report issues on libraries that may not have a launcher activity if (context.getProject() == context.getMainProject() && !context.getMainProject().isLibrary() && mManifestLocation != null) { if (!mHasActivity) { context.report(ISSUE, mManifestLocation, "Expecting " + ANDROID_MANIFEST_XML + " to have an <" + TAG_ACTIVITY + "> tag."); } else if (!mHasLauncherActivity) { // Report the issue if the manifest file has no activity with a launcher intent. context.report(ISSUE, mManifestLocation, "Expecting " + ANDROID_MANIFEST_XML + " to have an activity with a launcher intent."); } } }
Example 3
Source File: IconInLibraryDetector.java From lewis with Apache License 2.0 | 5 votes |
@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"); } } }
Example 4
Source File: PermissionsInLibraryDetector.java From lewis with Apache License 2.0 | 5 votes |
@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"); } } }
Example 5
Source File: MainActivityDetector.java From android-custom-lint-rules with Apache License 2.0 | 5 votes |
@Override public void afterCheckFile(@NonNull Context context) { // Store a reference to the manifest file in case we need to report it's location. if (context.getProject() == context.getMainProject()) { mManifestLocation = Location.create(context.file); } }