You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
ARCSlib: use defaultValue for non existing XML attributes
This commit is contained in:
@@ -165,7 +165,7 @@ public class ResXmlPullParser implements XmlResourceParser {
|
||||
public int getAttributeListValue(String namespace, String attribute, String[] options, int defaultValue) {
|
||||
ResXmlAttribute xmlAttribute = getAttribute(namespace, attribute);
|
||||
if(xmlAttribute == null){
|
||||
return 0;
|
||||
return defaultValue;
|
||||
}
|
||||
List<String> list = Arrays.asList(options);
|
||||
int index = list.indexOf(decodeAttributeValue(xmlAttribute));
|
||||
@@ -186,7 +186,7 @@ public class ResXmlPullParser implements XmlResourceParser {
|
||||
public int getAttributeResourceValue(String namespace, String attribute, int defaultValue) {
|
||||
ResXmlAttribute xmlAttribute = getAttribute(namespace, attribute);
|
||||
if(xmlAttribute == null){
|
||||
return 0;
|
||||
return defaultValue;
|
||||
}
|
||||
ValueType valueType=xmlAttribute.getValueType();
|
||||
if(valueType==ValueType.ATTRIBUTE
|
||||
@@ -201,7 +201,7 @@ public class ResXmlPullParser implements XmlResourceParser {
|
||||
public int getAttributeIntValue(String namespace, String attribute, int defaultValue) {
|
||||
ResXmlAttribute xmlAttribute = getAttribute(namespace, attribute);
|
||||
if(xmlAttribute == null){
|
||||
return 0;
|
||||
return defaultValue;
|
||||
}
|
||||
ValueType valueType=xmlAttribute.getValueType();
|
||||
if(valueType==ValueType.INT_DEC
|
||||
@@ -214,7 +214,7 @@ public class ResXmlPullParser implements XmlResourceParser {
|
||||
public int getAttributeUnsignedIntValue(String namespace, String attribute, int defaultValue) {
|
||||
ResXmlAttribute xmlAttribute = getAttribute(namespace, attribute);
|
||||
if(xmlAttribute == null){
|
||||
return 0;
|
||||
return defaultValue;
|
||||
}
|
||||
ValueType valueType=xmlAttribute.getValueType();
|
||||
if(valueType==ValueType.INT_DEC){
|
||||
@@ -226,7 +226,7 @@ public class ResXmlPullParser implements XmlResourceParser {
|
||||
public float getAttributeFloatValue(String namespace, String attribute, float defaultValue) {
|
||||
ResXmlAttribute xmlAttribute = getAttribute(namespace, attribute);
|
||||
if(xmlAttribute == null){
|
||||
return 0;
|
||||
return defaultValue;
|
||||
}
|
||||
ValueType valueType=xmlAttribute.getValueType();
|
||||
if(valueType==ValueType.FLOAT){
|
||||
@@ -239,7 +239,7 @@ public class ResXmlPullParser implements XmlResourceParser {
|
||||
public int getAttributeListValue(int index, String[] options, int defaultValue) {
|
||||
ResXmlAttribute xmlAttribute = getResXmlAttributeAt(index);
|
||||
if(xmlAttribute == null){
|
||||
return 0;
|
||||
return defaultValue;
|
||||
}
|
||||
List<String> list = Arrays.asList(options);
|
||||
int i = list.indexOf(decodeAttributeValue(xmlAttribute));
|
||||
@@ -260,7 +260,7 @@ public class ResXmlPullParser implements XmlResourceParser {
|
||||
public int getAttributeResourceValue(int index, int defaultValue) {
|
||||
ResXmlAttribute xmlAttribute = getResXmlAttributeAt(index);
|
||||
if(xmlAttribute == null){
|
||||
return 0;
|
||||
return defaultValue;
|
||||
}
|
||||
ValueType valueType=xmlAttribute.getValueType();
|
||||
if(valueType==ValueType.ATTRIBUTE
|
||||
@@ -283,7 +283,7 @@ public class ResXmlPullParser implements XmlResourceParser {
|
||||
public int getAttributeUnsignedIntValue(int index, int defaultValue) {
|
||||
ResXmlAttribute xmlAttribute = getResXmlAttributeAt(index);
|
||||
if(xmlAttribute == null){
|
||||
return 0;
|
||||
return defaultValue;
|
||||
}
|
||||
return xmlAttribute.getData();
|
||||
}
|
||||
@@ -291,7 +291,7 @@ public class ResXmlPullParser implements XmlResourceParser {
|
||||
public float getAttributeFloatValue(int index, float defaultValue) {
|
||||
ResXmlAttribute xmlAttribute = getResXmlAttributeAt(index);
|
||||
if(xmlAttribute == null){
|
||||
return 0;
|
||||
return defaultValue;
|
||||
}
|
||||
ValueType valueType=xmlAttribute.getValueType();
|
||||
if(valueType==ValueType.FLOAT){
|
||||
|
||||
Reference in New Issue
Block a user