Java Code Examples for com.android.tools.lint.detector.api.Context#getPhase()
The following examples show how to use
com.android.tools.lint.detector.api.Context#getPhase() .
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: TranslationDetector.java From javaide with GNU General Public License v3.0 | 6 votes |
@Override public void afterCheckFile(@NonNull Context context) { if (context.getPhase() == 1) { // Store this layout's set of ids for full project analysis in afterCheckProject if (context.getProject().getReportIssues() && mNames != null && !mNames.isEmpty()) { mFileToNames.put(context.file, mNames); Element root = ((XmlContext) context).document.getDocumentElement(); if (root != null) { String locale = root.getAttributeNS(TOOLS_URI, ATTR_LOCALE); if (locale != null && !locale.isEmpty()) { if (mFileToLocale == null) { mFileToLocale = Maps.newHashMap(); } mFileToLocale.put(context.file, locale); } // Add in English here if not specified? Worry about false positives listing "en" explicitly } } mNames = null; } }
Example 2
Source File: RequiredAttributeDetector.java From javaide with GNU General Public License v3.0 | 5 votes |
@Override public void afterCheckProject(@NonNull Context context) { // Process checks in two phases: // Phase 1: Gather styles and includes (styles are encountered after the layouts // so we can't do it in a single phase, and includes can be affected by includes from // layouts we haven't seen yet) // Phase 2: Process layouts, using gathered style and include data, and mark layouts // not known. // if (context.getPhase() == 1) { checkSizeSetInTheme(); context.requestRepeat(this, Scope.RESOURCE_FILE_SCOPE); } }
Example 3
Source File: DuplicateIdDetector.java From javaide with GNU General Public License v3.0 | 5 votes |
@Override public void afterCheckFile(@NonNull Context context) { if (context.getPhase() == 1) { // Store this layout's set of ids for full project analysis in afterCheckProject mFileToIds.put(context.file, mIds); mIds = null; } }
Example 4
Source File: DuplicateIdDetector.java From javaide with GNU General Public License v3.0 | 5 votes |
@Override public void beforeCheckProject(@NonNull Context context) { if (context.getPhase() == 1) { mFileToIds = new HashMap<File, Set<String>>(); mIncludes = new HashMap<File, List<String>>(); } }
Example 5
Source File: ButtonDetector.java From javaide with GNU General Public License v3.0 | 5 votes |
@Override public void afterCheckProject(@NonNull Context context) { int phase = context.getPhase(); if (phase == 1 && mApplicableResources != null) { // We found resources for the string "Cancel"; perform a second pass // where we check layout text attributes against these strings. context.getDriver().requestRepeat(this, Scope.RESOURCE_FILE_SCOPE); } }
Example 6
Source File: TranslationDetector.java From javaide with GNU General Public License v3.0 | 5 votes |
@Override public void beforeCheckFile(@NonNull Context context) { if (context.getPhase() == 1) { mNames = new HashSet<String>(); } // Convention seen in various projects mIgnoreFile = context.file.getName().startsWith("donottranslate") //$NON-NLS-1$ || UnusedResourceDetector.isAnalyticsFile(context); if (!context.getProject().getReportIssues()) { mIgnoreFile = true; } }
Example 7
Source File: UnusedResourceDetector.java From javaide with GNU General Public License v3.0 | 5 votes |
@Override public void beforeCheckProject(@NonNull Context context) { if (context.getPhase() == 1) { mDeclarations = new HashSet<String>(300); mReferences = new HashSet<String>(300); } }
Example 8
Source File: DuplicateIdDetector.java From javaide with GNU General Public License v3.0 | 4 votes |
@Override public void beforeCheckFile(@NonNull Context context) { if (context.getPhase() == 1) { mIds = new HashSet<String>(); } }
Example 9
Source File: ArraySizeDetector.java From javaide with GNU General Public License v3.0 | 4 votes |
@Override public void beforeCheckProject(@NonNull Context context) { if (context.getPhase() == 1) { mFileToArrayCount = ArrayListMultimap.create(30, 5); } }