Cosmetic fixes

Change-Id: I5460252af534d4455ba22273a06ac956bc904831
main
Ken Wakasa 2012-08-19 01:26:05 +09:00
parent e46d12927e
commit 522e12660a
1 changed files with 28 additions and 17 deletions

View File

@ -283,9 +283,10 @@ public class Keyboard {
public void load(String[] data) {
final int dataLength = data.length;
if (dataLength % TOUCH_POSITION_CORRECTION_RECORD_SIZE != 0) {
if (LatinImeLogger.sDBG)
if (LatinImeLogger.sDBG) {
throw new RuntimeException(
"the size of touch position correction data is invalid");
}
return;
}
@ -870,10 +871,12 @@ public class Keyboard {
final TypedArray a = mResources.obtainAttributes(Xml.asAttributeSet(parser),
R.styleable.Keyboard);
try {
if (a.hasValue(R.styleable.Keyboard_horizontalGap))
if (a.hasValue(R.styleable.Keyboard_horizontalGap)) {
throw new XmlParseUtils.IllegalAttribute(parser, "horizontalGap");
if (a.hasValue(R.styleable.Keyboard_verticalGap))
}
if (a.hasValue(R.styleable.Keyboard_verticalGap)) {
throw new XmlParseUtils.IllegalAttribute(parser, "verticalGap");
}
return new Row(mResources, mParams, parser, mCurrentY);
} finally {
a.recycle();
@ -921,7 +924,9 @@ public class Keyboard {
throws XmlPullParserException, IOException {
if (skip) {
XmlParseUtils.checkEndTag(TAG_KEY, parser);
if (DEBUG) startEndTag("<%s /> skipped", TAG_KEY);
if (DEBUG) {
startEndTag("<%s /> skipped", TAG_KEY);
}
} else {
final Key key = new Key(mResources, mParams, row, parser);
if (DEBUG) {
@ -1099,9 +1104,9 @@ public class Keyboard {
private boolean parseCaseCondition(XmlPullParser parser) {
final KeyboardId id = mParams.mId;
if (id == null)
if (id == null) {
return true;
}
final TypedArray a = mResources.obtainAttributes(Xml.asAttributeSet(parser),
R.styleable.Keyboard_Case);
try {
@ -1205,9 +1210,9 @@ public class Keyboard {
// If <case> does not have "index" attribute, that means this <case> is wild-card for
// the attribute.
final TypedValue v = a.peekValue(index);
if (v == null)
if (v == null) {
return true;
}
if (isIntegerValue(v)) {
return intValue == a.getInt(index, 0);
} else if (isStringValue(v)) {
@ -1218,9 +1223,10 @@ public class Keyboard {
private static boolean stringArrayContains(String[] array, String value) {
for (final String elem : array) {
if (elem.equals(value))
if (elem.equals(value)) {
return true;
}
}
return false;
}
@ -1242,16 +1248,18 @@ public class Keyboard {
TypedArray keyAttrs = mResources.obtainAttributes(Xml.asAttributeSet(parser),
R.styleable.Keyboard_Key);
try {
if (!keyStyleAttr.hasValue(R.styleable.Keyboard_KeyStyle_styleName))
if (!keyStyleAttr.hasValue(R.styleable.Keyboard_KeyStyle_styleName)) {
throw new XmlParseUtils.ParseException("<" + TAG_KEY_STYLE
+ "/> needs styleName attribute", parser);
}
if (DEBUG) {
startEndTag("<%s styleName=%s />%s", TAG_KEY_STYLE,
keyStyleAttr.getString(R.styleable.Keyboard_KeyStyle_styleName),
skip ? " skipped" : "");
}
if (!skip)
if (!skip) {
mParams.mKeyStyles.parseKeyStyleAttributes(keyStyleAttr, keyAttrs, parser);
}
} finally {
keyStyleAttr.recycle();
keyAttrs.recycle();
@ -1272,8 +1280,9 @@ public class Keyboard {
}
private void endRow(Row row) {
if (mCurrentRow == null)
if (mCurrentRow == null) {
throw new InflateException("orphan end row tag");
}
if (mRightEdgeKey != null) {
mRightEdgeKey.markAsRightEdge(mParams);
mRightEdgeKey = null;
@ -1309,8 +1318,9 @@ public class Keyboard {
public static float getDimensionOrFraction(TypedArray a, int index, int base,
float defValue) {
final TypedValue value = a.peekValue(index);
if (value == null)
if (value == null) {
return defValue;
}
if (isFractionValue(value)) {
return a.getFraction(index, base, base, defValue);
} else if (isDimensionValue(value)) {
@ -1321,8 +1331,9 @@ public class Keyboard {
public static int getEnumValue(TypedArray a, int index, int defValue) {
final TypedValue value = a.peekValue(index);
if (value == null)
if (value == null) {
return defValue;
}
if (isIntegerValue(value)) {
return a.getInt(index, defValue);
}