Merge "Use XmlPullParser.getEventType()"
commit
73d00e68d8
|
@ -301,7 +301,9 @@ public final class KeyboardLayoutSet {
|
||||||
final int xmlId = mResources.getIdentifier(keyboardLayoutSetName, "xml", packageName);
|
final int xmlId = mResources.getIdentifier(keyboardLayoutSetName, "xml", packageName);
|
||||||
try {
|
try {
|
||||||
parseKeyboardLayoutSet(mResources, xmlId);
|
parseKeyboardLayoutSet(mResources, xmlId);
|
||||||
} catch (final Exception e) {
|
} catch (final IOException e) {
|
||||||
|
throw new RuntimeException(e.getMessage() + " in " + keyboardLayoutSetName, e);
|
||||||
|
} catch (final XmlPullParserException e) {
|
||||||
throw new RuntimeException(e.getMessage() + " in " + keyboardLayoutSetName, e);
|
throw new RuntimeException(e.getMessage() + " in " + keyboardLayoutSetName, e);
|
||||||
}
|
}
|
||||||
return new KeyboardLayoutSet(mContext, mParams);
|
return new KeyboardLayoutSet(mContext, mParams);
|
||||||
|
@ -311,8 +313,8 @@ public final class KeyboardLayoutSet {
|
||||||
throws XmlPullParserException, IOException {
|
throws XmlPullParserException, IOException {
|
||||||
final XmlResourceParser parser = res.getXml(resId);
|
final XmlResourceParser parser = res.getXml(resId);
|
||||||
try {
|
try {
|
||||||
int event;
|
while (parser.getEventType() != XmlPullParser.END_DOCUMENT) {
|
||||||
while ((event = parser.next()) != XmlPullParser.END_DOCUMENT) {
|
final int event = parser.next();
|
||||||
if (event == XmlPullParser.START_TAG) {
|
if (event == XmlPullParser.START_TAG) {
|
||||||
final String tag = parser.getName();
|
final String tag = parser.getName();
|
||||||
if (TAG_KEYBOARD_SET.equals(tag)) {
|
if (TAG_KEYBOARD_SET.equals(tag)) {
|
||||||
|
@ -329,8 +331,8 @@ public final class KeyboardLayoutSet {
|
||||||
|
|
||||||
private void parseKeyboardLayoutSetContent(final XmlPullParser parser)
|
private void parseKeyboardLayoutSetContent(final XmlPullParser parser)
|
||||||
throws XmlPullParserException, IOException {
|
throws XmlPullParserException, IOException {
|
||||||
int event;
|
while (parser.getEventType() != XmlPullParser.END_DOCUMENT) {
|
||||||
while ((event = parser.next()) != XmlPullParser.END_DOCUMENT) {
|
final int event = parser.next();
|
||||||
if (event == XmlPullParser.START_TAG) {
|
if (event == XmlPullParser.START_TAG) {
|
||||||
final String tag = parser.getName();
|
final String tag = parser.getName();
|
||||||
if (TAG_ELEMENT.equals(tag)) {
|
if (TAG_ELEMENT.equals(tag)) {
|
||||||
|
|
|
@ -164,10 +164,10 @@ public class KeyboardBuilder<KP extends KeyboardParams> {
|
||||||
parseKeyboard(parser);
|
parseKeyboard(parser);
|
||||||
} catch (XmlPullParserException e) {
|
} catch (XmlPullParserException e) {
|
||||||
Log.w(BUILDER_TAG, "keyboard XML parse error", e);
|
Log.w(BUILDER_TAG, "keyboard XML parse error", e);
|
||||||
throw new IllegalArgumentException(e);
|
throw new IllegalArgumentException(e.getMessage(), e);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.w(BUILDER_TAG, "keyboard XML parse error", e);
|
Log.w(BUILDER_TAG, "keyboard XML parse error", e);
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e.getMessage(), e);
|
||||||
} finally {
|
} finally {
|
||||||
parser.close();
|
parser.close();
|
||||||
}
|
}
|
||||||
|
@ -210,8 +210,8 @@ public class KeyboardBuilder<KP extends KeyboardParams> {
|
||||||
private void parseKeyboard(final XmlPullParser parser)
|
private void parseKeyboard(final XmlPullParser parser)
|
||||||
throws XmlPullParserException, IOException {
|
throws XmlPullParserException, IOException {
|
||||||
if (DEBUG) startTag("<%s> %s", TAG_KEYBOARD, mParams.mId);
|
if (DEBUG) startTag("<%s> %s", TAG_KEYBOARD, mParams.mId);
|
||||||
int event;
|
while (parser.getEventType() != XmlPullParser.END_DOCUMENT) {
|
||||||
while ((event = parser.next()) != XmlPullParser.END_DOCUMENT) {
|
final int event = parser.next();
|
||||||
if (event == XmlPullParser.START_TAG) {
|
if (event == XmlPullParser.START_TAG) {
|
||||||
final String tag = parser.getName();
|
final String tag = parser.getName();
|
||||||
if (TAG_KEYBOARD.equals(tag)) {
|
if (TAG_KEYBOARD.equals(tag)) {
|
||||||
|
@ -303,8 +303,8 @@ public class KeyboardBuilder<KP extends KeyboardParams> {
|
||||||
|
|
||||||
private void parseKeyboardContent(final XmlPullParser parser, final boolean skip)
|
private void parseKeyboardContent(final XmlPullParser parser, final boolean skip)
|
||||||
throws XmlPullParserException, IOException {
|
throws XmlPullParserException, IOException {
|
||||||
int event;
|
while (parser.getEventType() != XmlPullParser.END_DOCUMENT) {
|
||||||
while ((event = parser.next()) != XmlPullParser.END_DOCUMENT) {
|
final int event = parser.next();
|
||||||
if (event == XmlPullParser.START_TAG) {
|
if (event == XmlPullParser.START_TAG) {
|
||||||
final String tag = parser.getName();
|
final String tag = parser.getName();
|
||||||
if (TAG_ROW.equals(tag)) {
|
if (TAG_ROW.equals(tag)) {
|
||||||
|
@ -358,8 +358,8 @@ public class KeyboardBuilder<KP extends KeyboardParams> {
|
||||||
|
|
||||||
private void parseRowContent(final XmlPullParser parser, final KeyboardRow row,
|
private void parseRowContent(final XmlPullParser parser, final KeyboardRow row,
|
||||||
final boolean skip) throws XmlPullParserException, IOException {
|
final boolean skip) throws XmlPullParserException, IOException {
|
||||||
int event;
|
while (parser.getEventType() != XmlPullParser.END_DOCUMENT) {
|
||||||
while ((event = parser.next()) != XmlPullParser.END_DOCUMENT) {
|
final int event = parser.next();
|
||||||
if (event == XmlPullParser.START_TAG) {
|
if (event == XmlPullParser.START_TAG) {
|
||||||
final String tag = parser.getName();
|
final String tag = parser.getName();
|
||||||
if (TAG_KEY.equals(tag)) {
|
if (TAG_KEY.equals(tag)) {
|
||||||
|
@ -506,8 +506,8 @@ public class KeyboardBuilder<KP extends KeyboardParams> {
|
||||||
private void parseMerge(final XmlPullParser parser, final KeyboardRow row, final boolean skip)
|
private void parseMerge(final XmlPullParser parser, final KeyboardRow row, final boolean skip)
|
||||||
throws XmlPullParserException, IOException {
|
throws XmlPullParserException, IOException {
|
||||||
if (DEBUG) startTag("<%s>", TAG_MERGE);
|
if (DEBUG) startTag("<%s>", TAG_MERGE);
|
||||||
int event;
|
while (parser.getEventType() != XmlPullParser.END_DOCUMENT) {
|
||||||
while ((event = parser.next()) != XmlPullParser.END_DOCUMENT) {
|
final int event = parser.next();
|
||||||
if (event == XmlPullParser.START_TAG) {
|
if (event == XmlPullParser.START_TAG) {
|
||||||
final String tag = parser.getName();
|
final String tag = parser.getName();
|
||||||
if (TAG_MERGE.equals(tag)) {
|
if (TAG_MERGE.equals(tag)) {
|
||||||
|
@ -539,8 +539,8 @@ public class KeyboardBuilder<KP extends KeyboardParams> {
|
||||||
final boolean skip) throws XmlPullParserException, IOException {
|
final boolean skip) throws XmlPullParserException, IOException {
|
||||||
if (DEBUG) startTag("<%s> %s", TAG_SWITCH, mParams.mId);
|
if (DEBUG) startTag("<%s> %s", TAG_SWITCH, mParams.mId);
|
||||||
boolean selected = false;
|
boolean selected = false;
|
||||||
int event;
|
while (parser.getEventType() != XmlPullParser.END_DOCUMENT) {
|
||||||
while ((event = parser.next()) != XmlPullParser.END_DOCUMENT) {
|
final int event = parser.next();
|
||||||
if (event == XmlPullParser.START_TAG) {
|
if (event == XmlPullParser.START_TAG) {
|
||||||
final String tag = parser.getName();
|
final String tag = parser.getName();
|
||||||
if (TAG_CASE.equals(tag)) {
|
if (TAG_CASE.equals(tag)) {
|
||||||
|
|
Loading…
Reference in New Issue