diff --git a/java/src/com/android/inputmethod/keyboard/Keyboard.java b/java/src/com/android/inputmethod/keyboard/Keyboard.java index 9ba8c3693..ae5bc95ee 100644 --- a/java/src/com/android/inputmethod/keyboard/Keyboard.java +++ b/java/src/com/android/inputmethod/keyboard/Keyboard.java @@ -34,6 +34,8 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.List; +import java.util.Map; +import java.util.Set; /** * Loads an XML description of a keyboard and stores the attributes of the keys. A keyboard @@ -93,33 +95,7 @@ public class Keyboard { // Code value representing the code is not specified. public static final int CODE_UNSPECIFIED = -99; - /** Horizontal gap default for all rows */ - private int mDefaultHorizontalGap; - - /** Default key width */ - private int mDefaultWidth; - - /** Default key height */ - private int mDefaultHeight; - - /** Default gap between rows */ - private int mDefaultVerticalGap; - - /** Popup keyboard template */ - private int mPopupKeyboardResId; - - /** Maximum column for popup keyboard */ - private int mMaxPopupColumn; - - /** True if Right-To-Left keyboard */ - private boolean mIsRtlKeyboard; - - /** List of shift keys in this keyboard and its icons and state */ - private final List mShiftKeys = new ArrayList(); - private final HashMap mShiftedIcons = new HashMap(); - private final HashMap mUnshiftedIcons = new HashMap(); - private final HashSet mShiftLockKeys = new HashSet(); - private final KeyboardShiftState mShiftState = new KeyboardShiftState(); + public final KeyboardId mId; /** Total height of the keyboard, including the padding and keys */ private int mTotalHeight; @@ -130,8 +106,36 @@ public class Keyboard { */ private int mMinWidth; + /** Horizontal gap default for all rows */ + private int mHorizontalGap; + + /** Default key width */ + private int mDefaultKeyWidth; + + /** Default row height */ + private int mDefaultRowHeight; + + /** Default gap between rows */ + private int mVerticalGap; + + /** Popup keyboard template */ + private int mPopupKeyboardResId; + + /** Maximum column for popup keyboard */ + private int mMaxPopupColumn; + + /** True if Right-To-Left keyboard */ + private boolean mIsRtlKeyboard; + /** List of keys in this keyboard */ private final List mKeys = new ArrayList(); + /** List of shift keys in this keyboard and its icons and state */ + private final List mShiftKeys = new ArrayList(); + private final Map mShiftedIcons = new HashMap(); + private final Map mUnshiftedIcons = new HashMap(); + private final Set mShiftLockKeys = new HashSet(); + public final KeyboardIconsSet mIconsSet = new KeyboardIconsSet(); + /** Width of the screen available to fit the keyboard */ private final int mDisplayWidth; @@ -144,9 +148,7 @@ public class Keyboard { private int mMostCommonKeyWidth = 0; - public final KeyboardId mId; - - public final KeyboardIconsSet mIconsSet = new KeyboardIconsSet(); + private final KeyboardShiftState mShiftState = new KeyboardShiftState(); // Variables for pre-computing nearest keys. @@ -175,10 +177,10 @@ public class Keyboard { // TODO: Adjust the height by referring to the height of area available for drawing as well. mDisplayHeight = res.getDisplayMetrics().heightPixels; - mDefaultHorizontalGap = 0; + mHorizontalGap = 0; setKeyWidth(mDisplayWidth / 10); - mDefaultVerticalGap = 0; - mDefaultHeight = mDefaultWidth; + mVerticalGap = 0; + mDefaultRowHeight = mDefaultKeyWidth; mId = id; loadKeyboard(context, xmlLayoutResId); mProximityInfo = new ProximityInfo( @@ -194,35 +196,35 @@ public class Keyboard { } public int getHorizontalGap() { - return mDefaultHorizontalGap; + return mHorizontalGap; } public void setHorizontalGap(int gap) { - mDefaultHorizontalGap = gap; + mHorizontalGap = gap; } public int getVerticalGap() { - return mDefaultVerticalGap; + return mVerticalGap; } public void setVerticalGap(int gap) { - mDefaultVerticalGap = gap; + mVerticalGap = gap; } public int getRowHeight() { - return mDefaultHeight; + return mDefaultRowHeight; } public void setRowHeight(int height) { - mDefaultHeight = height; + mDefaultRowHeight = height; } public int getKeyWidth() { - return mDefaultWidth; + return mDefaultKeyWidth; } public void setKeyWidth(int width) { - mDefaultWidth = width; + mDefaultKeyWidth = width; } /**