diff options
Diffstat (limited to 'java')
-rw-r--r-- | java/res/values/attrs.xml | 6 | ||||
-rw-r--r-- | java/res/values/dimens.xml | 3 | ||||
-rw-r--r-- | java/res/values/styles.xml | 3 | ||||
-rw-r--r-- | java/res/xml-land/kbd_number.xml | 3 | ||||
-rw-r--r-- | java/res/xml-land/kbd_phone.xml | 3 | ||||
-rw-r--r-- | java/res/xml-land/kbd_phone_symbols.xml | 3 | ||||
-rw-r--r-- | java/res/xml-sw600dp-land/kbd_number.xml | 3 | ||||
-rw-r--r-- | java/res/xml-sw600dp-land/kbd_phone.xml | 3 | ||||
-rw-r--r-- | java/res/xml-sw600dp-land/kbd_phone_symbols.xml | 3 | ||||
-rw-r--r-- | java/res/xml-sw768dp-land/kbd_number.xml | 3 | ||||
-rw-r--r-- | java/res/xml-sw768dp-land/kbd_phone.xml | 3 | ||||
-rw-r--r-- | java/res/xml-sw768dp-land/kbd_phone_symbols.xml | 3 | ||||
-rw-r--r-- | java/src/com/android/inputmethod/keyboard/Key.java | 4 | ||||
-rw-r--r-- | java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java | 16 | ||||
-rw-r--r-- | java/src/com/android/inputmethod/keyboard/internal/KeyboardParams.java | 4 | ||||
-rw-r--r-- | java/src/com/android/inputmethod/keyboard/internal/KeyboardRow.java | 8 |
16 files changed, 40 insertions, 31 deletions
diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml index f8fb64c7b..3a7b39e3a 100644 --- a/java/res/values/attrs.xml +++ b/java/res/values/attrs.xml @@ -173,11 +173,11 @@ <attr name="themeId" format="integer" /> <!-- Touch position correction --> <attr name="touchPositionCorrectionData" format="reference" /> - <!-- Keyboard top, bottom edges paddings, in propotion of keyboard height. --> + <!-- Keyboard top, bottom, left, right edges paddings, in propotion of keyboard height. --> <attr name="keyboardTopPadding" format="fraction" /> <attr name="keyboardBottomPadding" format="fraction" /> - <!-- Keyboard both horizontal edges paddings, in propotion of keyboard width. --> - <attr name="keyboardHorizontalEdgesPadding" format="fraction" /> + <attr name="keyboardLeftPadding" format="fraction" /> + <attr name="keyboardRightPadding" format="fraction" /> <!-- Default height of a row (key height + vertical gap), in pixels or in the proportion of keyboard height. --> <attr name="rowHeight" format="dimension|fraction" /> diff --git a/java/res/values/dimens.xml b/java/res/values/dimens.xml index eb0934c63..dd42acf3c 100644 --- a/java/res/values/dimens.xml +++ b/java/res/values/dimens.xml @@ -31,7 +31,8 @@ <fraction name="keyboard_top_padding">1.556%p</fraction> <fraction name="keyboard_bottom_padding">4.669%p</fraction> - <fraction name="keyboard_horizontal_edges_padding">0%p</fraction> + <fraction name="keyboard_left_padding">0%p</fraction> + <fraction name="keyboard_right_padding">0%p</fraction> <fraction name="key_bottom_gap">6.250%p</fraction> <fraction name="key_horizontal_gap">1.352%p</fraction> diff --git a/java/res/values/styles.xml b/java/res/values/styles.xml index 9dc09f155..fb59c745f 100644 --- a/java/res/values/styles.xml +++ b/java/res/values/styles.xml @@ -24,7 +24,8 @@ <item name="moreKeysTemplate">@xml/kbd_more_keys_keyboard_template</item> <item name="keyboardTopPadding">@fraction/keyboard_top_padding</item> <item name="keyboardBottomPadding">@fraction/keyboard_bottom_padding</item> - <item name="keyboardHorizontalEdgesPadding">@fraction/keyboard_horizontal_edges_padding</item> + <item name="keyboardLeftPadding">@fraction/keyboard_left_padding</item> + <item name="keyboardRightPadding">@fraction/keyboard_right_padding</item> <item name="horizontalGap">@fraction/key_horizontal_gap</item> <item name="verticalGap">@fraction/key_bottom_gap</item> <item name="maxMoreKeysColumn">@integer/config_max_more_keys_column</item> diff --git a/java/res/xml-land/kbd_number.xml b/java/res/xml-land/kbd_number.xml index 8d31df1f8..0dced28ac 100644 --- a/java/res/xml-land/kbd_number.xml +++ b/java/res/xml-land/kbd_number.xml @@ -20,7 +20,8 @@ <Keyboard xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" - latin:keyboardHorizontalEdgesPadding="10%p" + latin:keyboardLeftPadding="10%p" + latin:keyboardRightPadding="10%p" latin:keyWidth="26.67%p" latin:touchPositionCorrectionData="@array/touch_position_correction_data_default" > diff --git a/java/res/xml-land/kbd_phone.xml b/java/res/xml-land/kbd_phone.xml index 2f8fc3560..e5d7b443f 100644 --- a/java/res/xml-land/kbd_phone.xml +++ b/java/res/xml-land/kbd_phone.xml @@ -20,7 +20,8 @@ <Keyboard xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" - latin:keyboardHorizontalEdgesPadding="10%p" + latin:keyboardLeftPadding="10%p" + latin:keyboardRightPadding="10%p" latin:keyWidth="26.67%p" latin:touchPositionCorrectionData="@array/touch_position_correction_data_default" > diff --git a/java/res/xml-land/kbd_phone_symbols.xml b/java/res/xml-land/kbd_phone_symbols.xml index 0e6bcdd6a..b881e6234 100644 --- a/java/res/xml-land/kbd_phone_symbols.xml +++ b/java/res/xml-land/kbd_phone_symbols.xml @@ -20,7 +20,8 @@ <Keyboard xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" - latin:keyboardHorizontalEdgesPadding="10%p" + latin:keyboardLeftPadding="10%p" + latin:keyboardRightPadding="10%p" latin:keyWidth="26.67%p" latin:touchPositionCorrectionData="@array/touch_position_correction_data_default" > diff --git a/java/res/xml-sw600dp-land/kbd_number.xml b/java/res/xml-sw600dp-land/kbd_number.xml index 63dfc90d0..a9e812171 100644 --- a/java/res/xml-sw600dp-land/kbd_number.xml +++ b/java/res/xml-sw600dp-land/kbd_number.xml @@ -20,7 +20,8 @@ <Keyboard xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" - latin:keyboardHorizontalEdgesPadding="10%p" + latin:keyboardLeftPadding="10%p" + latin:keyboardRightPadding="10%p" latin:keyWidth="18%p" latin:touchPositionCorrectionData="@array/touch_position_correction_data_default" > diff --git a/java/res/xml-sw600dp-land/kbd_phone.xml b/java/res/xml-sw600dp-land/kbd_phone.xml index b6161111b..4cabdeb5a 100644 --- a/java/res/xml-sw600dp-land/kbd_phone.xml +++ b/java/res/xml-sw600dp-land/kbd_phone.xml @@ -20,7 +20,8 @@ <Keyboard xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" - latin:keyboardHorizontalEdgesPadding="10%p" + latin:keyboardLeftPadding="10%p" + latin:keyboardRightPadding="10%p" latin:keyWidth="18%p" latin:touchPositionCorrectionData="@array/touch_position_correction_data_default" > diff --git a/java/res/xml-sw600dp-land/kbd_phone_symbols.xml b/java/res/xml-sw600dp-land/kbd_phone_symbols.xml index 9b0bee026..9c3e8259e 100644 --- a/java/res/xml-sw600dp-land/kbd_phone_symbols.xml +++ b/java/res/xml-sw600dp-land/kbd_phone_symbols.xml @@ -20,7 +20,8 @@ <Keyboard xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" - latin:keyboardHorizontalEdgesPadding="10%p" + latin:keyboardLeftPadding="10%p" + latin:keyboardRightPadding="10%p" latin:keyWidth="18%p" latin:touchPositionCorrectionData="@array/touch_position_correction_data_default" > diff --git a/java/res/xml-sw768dp-land/kbd_number.xml b/java/res/xml-sw768dp-land/kbd_number.xml index de8d55904..1cb775ef7 100644 --- a/java/res/xml-sw768dp-land/kbd_number.xml +++ b/java/res/xml-sw768dp-land/kbd_number.xml @@ -20,7 +20,8 @@ <Keyboard xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" - latin:keyboardHorizontalEdgesPadding="10%p" + latin:keyboardLeftPadding="10%p" + latin:keyboardRightPadding="10%p" latin:keyWidth="13.250%p" latin:touchPositionCorrectionData="@array/touch_position_correction_data_default" > diff --git a/java/res/xml-sw768dp-land/kbd_phone.xml b/java/res/xml-sw768dp-land/kbd_phone.xml index f88a076f6..890518210 100644 --- a/java/res/xml-sw768dp-land/kbd_phone.xml +++ b/java/res/xml-sw768dp-land/kbd_phone.xml @@ -20,7 +20,8 @@ <Keyboard xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" - latin:keyboardHorizontalEdgesPadding="10%p" + latin:keyboardLeftPadding="10%p" + latin:keyboardRightPadding="10%p" latin:keyWidth="13.250%p" latin:touchPositionCorrectionData="@array/touch_position_correction_data_default" > diff --git a/java/res/xml-sw768dp-land/kbd_phone_symbols.xml b/java/res/xml-sw768dp-land/kbd_phone_symbols.xml index eaa413e7d..6038b1f1e 100644 --- a/java/res/xml-sw768dp-land/kbd_phone_symbols.xml +++ b/java/res/xml-sw768dp-land/kbd_phone_symbols.xml @@ -20,7 +20,8 @@ <Keyboard xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" - latin:keyboardHorizontalEdgesPadding="10%p" + latin:keyboardLeftPadding="10%p" + latin:keyboardRightPadding="10%p" latin:keyWidth="13.250%p" latin:touchPositionCorrectionData="@array/touch_position_correction_data_default" > diff --git a/java/src/com/android/inputmethod/keyboard/Key.java b/java/src/com/android/inputmethod/keyboard/Key.java index e137b922a..1e5af5154 100644 --- a/java/src/com/android/inputmethod/keyboard/Key.java +++ b/java/src/com/android/inputmethod/keyboard/Key.java @@ -470,11 +470,11 @@ public class Key implements Comparable<Key> { } public void markAsLeftEdge(final KeyboardParams params) { - mHitBox.left = params.mHorizontalEdgesPadding; + mHitBox.left = params.mLeftPadding; } public void markAsRightEdge(final KeyboardParams params) { - mHitBox.right = params.mOccupiedWidth - params.mHorizontalEdgesPadding; + mHitBox.right = params.mOccupiedWidth - params.mRightPadding; } public void markAsTopEdge(final KeyboardParams params) { diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java index 20edf6598..e087a4565 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java +++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardBuilder.java @@ -243,13 +243,13 @@ public class KeyboardBuilder<KP extends KeyboardParams> { R.styleable.Keyboard_keyboardTopPadding, height, height, 0); params.mBottomPadding = (int)keyboardAttr.getFraction( R.styleable.Keyboard_keyboardBottomPadding, height, height, 0); - // TODO: Split keyboardHorizontalEdgesPadding into two, keyboardLeftPaddings and - // keyboardRightPaddings. - params.mHorizontalEdgesPadding = (int)keyboardAttr.getFraction( - R.styleable.Keyboard_keyboardHorizontalEdgesPadding, width, width, 0); + params.mLeftPadding = (int)keyboardAttr.getFraction( + R.styleable.Keyboard_keyboardLeftPadding, width, width, 0); + params.mRightPadding = (int)keyboardAttr.getFraction( + R.styleable.Keyboard_keyboardRightPadding, width, width, 0); - final int baseWidth = params.mOccupiedWidth - params.mHorizontalEdgesPadding * 2 - - params.mHorizontalCenterPadding; + final int baseWidth = + params.mOccupiedWidth - params.mLeftPadding - params.mRightPadding; params.mBaseWidth = baseWidth; params.mDefaultKeyWidth = (int)keyAttr.getFraction(R.styleable.Keyboard_Key_keyWidth, baseWidth, baseWidth, baseWidth / DEFAULT_KEYBOARD_COLUMNS); @@ -742,7 +742,7 @@ public class KeyboardBuilder<KP extends KeyboardParams> { } private void startRow(final KeyboardRow row) { - addEdgeSpace(mParams.mHorizontalEdgesPadding, row); + addEdgeSpace(mParams.mLeftPadding, row); mCurrentRow = row; mLeftEdge = true; mRightEdgeKey = null; @@ -756,7 +756,7 @@ public class KeyboardBuilder<KP extends KeyboardParams> { mRightEdgeKey.markAsRightEdge(mParams); mRightEdgeKey = null; } - addEdgeSpace(mParams.mHorizontalEdgesPadding, row); + addEdgeSpace(mParams.mRightPadding, row); mCurrentY += row.mRowHeight; mCurrentRow = null; mTopEdge = false; diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardParams.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardParams.java index e13dbe5d0..15eb690e1 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardParams.java +++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardParams.java @@ -42,8 +42,8 @@ public class KeyboardParams { public int mTopPadding; public int mBottomPadding; - public int mHorizontalEdgesPadding; - public int mHorizontalCenterPadding; + public int mLeftPadding; + public int mRightPadding; public KeyVisualAttributes mKeyVisualAttributes; diff --git a/java/src/com/android/inputmethod/keyboard/internal/KeyboardRow.java b/java/src/com/android/inputmethod/keyboard/internal/KeyboardRow.java index e2256faba..855f65507 100644 --- a/java/src/com/android/inputmethod/keyboard/internal/KeyboardRow.java +++ b/java/src/com/android/inputmethod/keyboard/internal/KeyboardRow.java @@ -111,8 +111,6 @@ public final class KeyboardRow { } public float getKeyX(final TypedArray keyAttr) { - final int keyboardRightEdge = mParams.mOccupiedWidth - - mParams.mHorizontalEdgesPadding; if (keyAttr.hasValue(R.styleable.Keyboard_Key_keyXPos)) { final float keyXPos = keyAttr.getFraction(R.styleable.Keyboard_Key_keyXPos, mParams.mBaseWidth, mParams.mBaseWidth, 0); @@ -122,9 +120,10 @@ public final class KeyboardRow { // keyXPos shouldn't be less than mCurrentX because drawable area for this // key starts at mCurrentX. Or, this key will overlaps the adjacent key on // its left hand side. + final int keyboardRightEdge = mParams.mOccupiedWidth - mParams.mRightPadding; return Math.max(keyXPos + keyboardRightEdge, mCurrentX); } else { - return keyXPos + mParams.mHorizontalEdgesPadding; + return keyXPos + mParams.mLeftPadding; } } return mCurrentX; @@ -139,10 +138,9 @@ public final class KeyboardRow { R.styleable.Keyboard_Key_keyWidth, KEYWIDTH_NOT_ENUM); switch (widthType) { case KEYWIDTH_FILL_RIGHT: - final int keyboardRightEdge = - mParams.mOccupiedWidth - mParams.mHorizontalEdgesPadding; // If keyWidth is fillRight, the actual key width will be determined to fill // out the area up to the right edge of the keyboard. + final int keyboardRightEdge = mParams.mOccupiedWidth - mParams.mRightPadding; return keyboardRightEdge - keyXPos; default: // KEYWIDTH_NOT_ENUM return keyAttr.getFraction(R.styleable.Keyboard_Key_keyWidth, |