From 74103ee1b92349eee7b13f3958f494655300b925 Mon Sep 17 00:00:00 2001 From: satok Date: Fri, 29 Oct 2010 18:05:07 +0900 Subject: [PATCH] Increased the size of GRID in Keyboard Bug: 3122894 - Changed width 10 -> 32 - Changed height 5 -> 16 Change-Id: I07354cf5c942974cc25a5e043f41e0f13a09351b --- java/res/values/config.xml | 2 ++ .../inputmethod/latin/BaseKeyboard.java | 25 ++++++++----------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/java/res/values/config.xml b/java/res/values/config.xml index af145a629..456d9ad4d 100644 --- a/java/res/values/config.xml +++ b/java/res/values/config.xml @@ -27,6 +27,8 @@ 100 400 50 + 32 + 16 400 1200 800 diff --git a/java/src/com/android/inputmethod/latin/BaseKeyboard.java b/java/src/com/android/inputmethod/latin/BaseKeyboard.java index cb41ad047..266300eb3 100644 --- a/java/src/com/android/inputmethod/latin/BaseKeyboard.java +++ b/java/src/com/android/inputmethod/latin/BaseKeyboard.java @@ -109,9 +109,9 @@ public class BaseKeyboard { // Variables for pre-computing nearest keys. - private static final int GRID_WIDTH = 10; - private static final int GRID_HEIGHT = 5; - private static final int GRID_SIZE = GRID_WIDTH * GRID_HEIGHT; + private final int GRID_WIDTH; + private final int GRID_HEIGHT; + private final int GRID_SIZE; private int mCellWidth; private int mCellHeight; private int[][] mGridNeighbors; @@ -466,6 +466,11 @@ public class BaseKeyboard { * @param height sets height of keyboard */ public BaseKeyboard(Context context, int xmlLayoutResId, int modeId, int width, int height) { + Resources res = context.getResources(); + GRID_WIDTH = res.getInteger(R.integer.config_keyboard_grid_width); + GRID_HEIGHT = res.getInteger(R.integer.config_keyboard_grid_height); + GRID_SIZE = GRID_WIDTH * GRID_HEIGHT; + mDisplayWidth = width; mDisplayHeight = height; @@ -485,17 +490,9 @@ public class BaseKeyboard { * @param modeId keyboard mode identifier */ public BaseKeyboard(Context context, int xmlLayoutResId, int modeId) { - DisplayMetrics dm = context.getResources().getDisplayMetrics(); - mDisplayWidth = dm.widthPixels; - mDisplayHeight = dm.heightPixels; - //Log.v(TAG, "keyboard's display metrics:" + dm); - - mDefaultHorizontalGap = 0; - setKeyWidth(mDisplayWidth / 10); - mDefaultVerticalGap = 0; - mDefaultHeight = mDefaultWidth; - mKeyboardMode = modeId; - loadKeyboard(context, xmlLayoutResId); + this(context, xmlLayoutResId, modeId, + context.getResources().getDisplayMetrics().widthPixels, + context.getResources().getDisplayMetrics().heightPixels); } /**