private void scanActivity(Context context, Element element) { String name = element.getAttributeNS(ANDROID_URI, ATTR_NAME); if (name.indexOf('$') != -1) { name = name.replace('$', '.'); } if (name.startsWith(".")) { String pkg = context.getProject().getPackage(); if (pkg != null && !pkg.isEmpty()) { name = pkg + name; } } String theme = element.getAttributeNS(ANDROID_URI, ATTR_THEME); if (theme != null && !theme.isEmpty()) { if (mActivityToTheme == null) { mActivityToTheme = new HashMap<>(); } mActivityToTheme.put(name, getResourceFieldName(theme)); } }
private void scanActivity(Context context, Element element) { String name = element.getAttributeNS(ANDROID_URI, ATTR_NAME); if (name.indexOf('$') != -1) { name = name.replace('$', '.'); } if (name.startsWith(".")) { //$NON-NLS-1$ String pkg = context.getProject().getPackage(); if (pkg != null && !pkg.isEmpty()) { name = pkg + name; } } if (mActivities == null) { mActivities = new HashSet<String>(); } mActivities.add(name); String theme = element.getAttributeNS(ANDROID_URI, ATTR_THEME); if (theme != null && !theme.isEmpty()) { if (mActivityToTheme == null) { mActivityToTheme = new HashMap<String, String>(); } mActivityToTheme.put(name, getResourceFieldName(theme)); } }
String resource = STYLE_RESOURCE_PREFIX + getResourceFieldName(styleName);
String resource = STYLE_RESOURCE_PREFIX + getResourceFieldName(styleName);
Attr nameAttribute = item.getAttributeNode(ATTR_NAME); if (nameAttribute != null) { String name = getResourceFieldName(nameAttribute.getValue()); String type = item.getTagName(); if (type.equals(TAG_ITEM)) {
Attr nameAttribute = item.getAttributeNode(ATTR_NAME); if (nameAttribute != null) { String name = getResourceFieldName(nameAttribute.getValue()); String type = item.getTagName(); if (type.equals(TAG_ITEM)) {
Attr nameAttribute = item.getAttributeNode(ATTR_NAME); if (nameAttribute != null) { String name = getResourceFieldName(nameAttribute.getValue()); String type = item.getTagName(); if (type.equals(TAG_ITEM)) {
@Override public void beforeCheckFile(@NonNull Context context) { File file = context.file; boolean isXmlFile = LintUtils.isXmlFile(file); if (!isXmlFile && !LintUtils.isBitmapFile(file)) { return; } String parentName = file.getParentFile().getName(); int dash = parentName.indexOf('-'); if (dash != -1 || FD_RES_VALUES.equals(parentName)) { return; } ResourceFolderType folderType = ResourceFolderType.getFolderType(parentName); if (folderType == null) { return; } List<ResourceType> types = FolderTypeRelationship.getRelatedResourceTypes(folderType); if (types.isEmpty()) { return; } ResourceType type = types.get(0); String resourceName = getResourceFieldName(getBaseName(file.getName())); if (isPrivate(context, type, resourceName)) { String message = createOverrideErrorMessage(context, type, resourceName); Location location = Location.create(file); context.report(ISSUE, location, message); } }
&& TAG_STYLE.equals(attribute.getOwnerElement().getTagName())) { owner = "android/R$style"; //$NON-NLS-1$ name = getResourceFieldName(value.substring(PREFIX_ANDROID.length())); prefix = null; } else { owner = "android/R$" //$NON-NLS-1$ + value.substring(prefix.length(), index); name = getResourceFieldName(value.substring(index + 1)); } else if (value.startsWith(ANDROID_THEME_PREFIX)) { owner = "android/R$attr"; //$NON-NLS-1$
@Override public void beforeCheckFile(@NonNull Context context) { File file = context.file; boolean isXmlFile = LintUtils.isXmlFile(file); if (!isXmlFile && !LintUtils.isBitmapFile(file)) { return; } String parentName = file.getParentFile().getName(); int dash = parentName.indexOf('-'); if (dash != -1 || FD_RES_VALUES.equals(parentName)) { return; } ResourceFolderType folderType = ResourceFolderType.getFolderType(parentName); if (folderType == null) { return; } List<ResourceType> types = FolderTypeRelationship.getRelatedResourceTypes(folderType); if (types.isEmpty()) { return; } ResourceType type = types.get(0); String resourceName = getResourceFieldName(getBaseName(file.getName())); if (isPrivate(context, type, resourceName)) { String message = createOverrideErrorMessage(context, type, resourceName); Location location = Location.create(file); context.report(ISSUE, location, message); } }
String originalName = name; name = getResourceFieldName(name);
String originalName = name; name = getResourceFieldName(name);
String owner = "android/R$" //$NON-NLS-1$ + text.substring(ANDROID_PREFIX.length(), index); String name = getResourceFieldName(text.substring(index + 1)); int api = mApiDatabase.getFieldVersion(owner, name); int minSdk = getMinSdk(context);
&& TAG_STYLE.equals(attribute.getOwnerElement().getTagName())) { owner = "android/R$style"; name = getResourceFieldName(value.substring(PREFIX_ANDROID.length())); prefix = null; } else { owner = "android/R$" + value.substring(prefix.length(), index); name = getResourceFieldName(value.substring(index + 1)); } else if (value.startsWith(ANDROID_THEME_PREFIX)) { owner = "android/R$attr";
if (ResourceType.getEnum(typeString) != null) { String owner = "android/R$" + typeString; String name = getResourceFieldName(text.substring(index + 1)); int api = mApiDatabase.getFieldVersion(owner, name); int minSdk = getMinSdk(context);