diff --git a/app/src/common/shared/com/igalia/wolvic/input/CustomKeyboard.java b/app/src/common/shared/com/igalia/wolvic/input/CustomKeyboard.java index 575ed5a543..25de58123d 100644 --- a/app/src/common/shared/com/igalia/wolvic/input/CustomKeyboard.java +++ b/app/src/common/shared/com/igalia/wolvic/input/CustomKeyboard.java @@ -8,7 +8,6 @@ import android.content.Context; import android.content.res.Resources; import android.content.res.XmlResourceParser; -import com.igalia.wolvic.input.Keyboard; import android.view.KeyEvent; import java.lang.reflect.Field; @@ -67,7 +66,7 @@ public CustomKeyboard (Context context, int layoutTemplateResId, CharSequence ch } for (int i = 0; i < characters.length(); i++) { char c = characters.charAt(i); - int rowIndex = (int)Math.floor(i/columns); + int rowIndex = i / columns; final Key key = new Key(mRows[rowIndex]); @@ -91,9 +90,7 @@ public CustomKeyboard (Context context, int layoutTemplateResId, CharSequence ch if (keysObj != null && getFieldObject(mRows[rowIndex], "mKeys") instanceof ArrayList) { @SuppressWarnings("unchecked") ArrayList mKeys = (ArrayList) keysObj; - if (mKeys != null) { - mKeys.add(key); - } + mKeys.add(key); } int mTotalWidth = getParentFieldInt(this, "mTotalWidth"); if (x > mTotalWidth) { @@ -145,8 +142,7 @@ public static Field getField(Class clazz, String fieldName) { Class tmpClass = clazz; do { try { - Field f = tmpClass.getDeclaredField(fieldName); - return f; + return tmpClass.getDeclaredField(fieldName); } catch (NoSuchFieldException e) { tmpClass = tmpClass.getSuperclass(); } @@ -188,7 +184,7 @@ protected Key createKeyFromXml(Resources res, Row parent, int x, int y, XmlResou @Override public int[] getNearestKeys(int x, int y) { List keys = getKeys(); - Key[] mKeys = keys.toArray(new Key[keys.size()]); + Key[] mKeys = keys.toArray(new Key[0]); int i = 0; for (Key key : mKeys) { if(key.isInside(x, y))