do not add system attribute references into R.attr class

This commit is contained in:
Eugene Kudelevsky
2012-06-20 17:56:57 +04:00
parent 70f3139606
commit 90f753e851
5 changed files with 15 additions and 6 deletions
@@ -75,11 +75,13 @@ public abstract class ValueResourcesFileParser implements IXMLBuilder {
@Override
public void elementAttributesProcessed(String name, String nsPrefix, String nsURI) throws Exception {
if (myLastNameAttr != null && name != null) {
final String resType = "item".equals(name)
final String resTypeStr = "item".equals(name)
? myLastTypeAttr
: AndroidCommonUtils.getResourceTypeByTagName(name);
if (resType != null && ResourceType.getEnum(resType) != null) {
process(new ResourceEntry(resType, myLastNameAttr));
final ResourceType resType = resTypeStr != null ? ResourceType.getEnum(resTypeStr) : null;
if (resType != null &&
!(resType == ResourceType.ATTR && myLastNameAttr.startsWith("android:"))) {
process(new ResourceEntry(resTypeStr, myLastNameAttr));
}
}
}
@@ -163,6 +163,6 @@ public class AndroidValueResourcesIndex extends FileBasedIndexExtension<Resource
@Override
public int getVersion() {
return 0;
return 1;
}
}
@@ -795,6 +795,6 @@ public class AndroidResourceUtil {
@NotNull
public static String getFieldNameByResourceName(@NotNull String fieldName) {
return fieldName.replace('.', '_').replace('-', '_');
return fieldName.replace('.', '_').replace('-', '_').replace(':', '_');
}
}
@@ -6,5 +6,8 @@ public class JavaCompletion1 {
int n2 = R.string.<error>unknown</error>;
<error>int n3 = R.styleable.MyStyleable;</error>
int[] n4 = R.styleable.MyStyleable;
int n5 = R.attr.myAttr1;
n5 = R.attr.myAttr2;
n5 = R.attr.<error>android_text</error>;
}
}
@@ -1,5 +1,9 @@
<resources>
<string name="my_string">abacaba</string>
<style name="Theme.MyCustomStyle" parent="android:style/Theme.Dialog"></style>
<declare-styleable name="MyStyleable"></declare-styleable>
<declare-styleable name="MyStyleable">
<attr name="myAttr1" format="string"/>
<attr name="android:text"/>
</declare-styleable>
<attr name="myAttr2" format="string"/>
</resources>