From 522e12660a8541a5e98b4737d55e40bd6c49ee00 Mon Sep 17 00:00:00 2001 From: Ken Wakasa Date: Sun, 19 Aug 2012 01:26:05 +0900 Subject: [PATCH] Cosmetic fixes Change-Id: I5460252af534d4455ba22273a06ac956bc904831 --- .../inputmethod/keyboard/Keyboard.java | 45 ++++++++++++------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/java/src/com/android/inputmethod/keyboard/Keyboard.java b/java/src/com/android/inputmethod/keyboard/Keyboard.java index 919850095..489cc37ea 100644 --- a/java/src/com/android/inputmethod/keyboard/Keyboard.java +++ b/java/src/com/android/inputmethod/keyboard/Keyboard.java @@ -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; } @@ -324,7 +325,7 @@ public class Keyboard { public boolean isValid() { return mEnabled && mXs != null && mYs != null && mRadii != null - && mXs.length > 0 && mYs.length > 0 && mRadii.length > 0; + && mXs.length > 0 && mYs.length > 0 && mRadii.length > 0; } } @@ -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 does not have "index" attribute, that means this 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,8 +1223,9 @@ 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" : ""); + 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); }