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
XmlBlock: implement nativeGetAttributeName, use getPooledString instead of mStrings.get
This commit is contained in:
@@ -114,6 +114,12 @@ JNIEXPORT jint JNICALL Java_android_content_res_XmlBlock_nativeGetAttributeData(
|
||||
return ResXMLParser_getAttributeData(parser, index);
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL Java_android_content_res_XmlBlock_nativeGetAttributeName(JNIEnv *env, jclass this, jlong parser_ptr, jint index)
|
||||
{
|
||||
struct ResXMLParser *parser = (struct ResXMLParser *)_PTR(parser_ptr);
|
||||
return ResXMLParser_getAttributeNameID(parser, index);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_android_content_res_XmlBlock_nativeDestroyParseState(JNIEnv *env, jobject this, jlong parser_ptr)
|
||||
{
|
||||
struct ResXMLParser *parser = (struct ResXMLParser *)_PTR(parser_ptr);
|
||||
|
||||
@@ -137,7 +137,7 @@ final class XmlBlock {
|
||||
}
|
||||
public String getText() {
|
||||
int id = nativeGetText(mParseState);
|
||||
return id >= 0 ? mStrings.get(id).toString() : null;
|
||||
return id >= 0 ? (String)getPooledString(id) : null;
|
||||
}
|
||||
public int getLineNumber() {
|
||||
return nativeGetLineNumber(mParseState);
|
||||
@@ -165,7 +165,7 @@ final class XmlBlock {
|
||||
}
|
||||
public String getNamespace() {
|
||||
int id = nativeGetNamespace(mParseState);
|
||||
return id >= 0 ? mStrings.get(id).toString() : "";
|
||||
return id >= 0 ? (String)getPooledString(id) : "";
|
||||
}
|
||||
public String getName() {
|
||||
return nativeGetName(mParseState);
|
||||
@@ -175,7 +175,7 @@ final class XmlBlock {
|
||||
if (DEBUG)
|
||||
System.out.println("getAttributeNamespace of " + index + " = " + id);
|
||||
if (id >= 0)
|
||||
return mStrings.get(id).toString();
|
||||
return (String)getPooledString(id);
|
||||
else if (id == -1)
|
||||
return "";
|
||||
throw new IndexOutOfBoundsException(String.valueOf(index));
|
||||
@@ -185,7 +185,7 @@ final class XmlBlock {
|
||||
if (DEBUG)
|
||||
System.out.println("getAttributeName of " + index + " = " + id);
|
||||
if (id >= 0)
|
||||
return mStrings.get(id).toString();
|
||||
return (String)getPooledString(id);
|
||||
throw new IndexOutOfBoundsException(String.valueOf(index));
|
||||
}
|
||||
public String getAttributePrefix(int index) {
|
||||
@@ -417,7 +417,7 @@ final class XmlBlock {
|
||||
|
||||
public String getIdAttribute() {
|
||||
int id = nativeGetIdAttribute(mParseState);
|
||||
return id >= 0 ? mStrings.get(id).toString() : null;
|
||||
return id >= 0 ? (String)getPooledString(id) : null;
|
||||
}
|
||||
public String getClassAttribute() {
|
||||
return nativeGetClassAttribute(mParseState);
|
||||
|
||||
Reference in New Issue
Block a user