From 6d81e2b79bce557c3eb8f91adcad82ce1cac2afb Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Fri, 8 Apr 2011 14:45:19 +0900 Subject: [PATCH] Increase the horizontal gap between shift/delete and normal keys This change also adds capability to add horizontal padding to the keyboard. Bug: 4269094 Change-Id: I805e76b253a497079517c01bd2a976f8702f7e56 --- java/res/layout/input_basic.xml | 1 + java/res/layout/input_basic_highcontrast.xml | 2 +- java/res/layout/input_gingerbread.xml | 3 +-- java/res/layout/input_honeycomb.xml | 3 +-- java/res/layout/input_stone_bold.xml | 3 ++- java/res/layout/input_stone_normal.xml | 3 ++- ...ut_stone_popup.xml => keyboard_popup_stone.xml} | 1 - java/res/values-land/dimens.xml | 1 + java/res/values-xlarge-land/dimens.xml | 1 + java/res/values-xlarge/dimens.xml | 1 + java/res/values/dimens.xml | 1 + java/res/xml/kbd_qwerty_row3.xml | 8 ++++++-- .../com/android/inputmethod/keyboard/Keyboard.java | 4 +++- .../inputmethod/keyboard/KeyboardParser.java | 14 ++++++++++++-- .../android/inputmethod/keyboard/KeyboardView.java | 2 +- 15 files changed, 34 insertions(+), 14 deletions(-) rename java/res/layout/{input_stone_popup.xml => keyboard_popup_stone.xml} (96%) diff --git a/java/res/layout/input_basic.xml b/java/res/layout/input_basic.xml index 7b85bae94..86ae82d51 100644 --- a/java/res/layout/input_basic.xml +++ b/java/res/layout/input_basic.xml @@ -25,6 +25,7 @@ android:layout_alignParentBottom="true" android:layout_width="match_parent" android:layout_height="wrap_content" + android:padding="0dip" android:background="@drawable/keyboard_background" latin:keyBackground="@drawable/btn_keyboard_key" diff --git a/java/res/layout/input_basic_highcontrast.xml b/java/res/layout/input_basic_highcontrast.xml index d9200fd5e..03b22ef07 100644 --- a/java/res/layout/input_basic_highcontrast.xml +++ b/java/res/layout/input_basic_highcontrast.xml @@ -21,11 +21,11 @@ diff --git a/java/res/layout/input_stone_normal.xml b/java/res/layout/input_stone_normal.xml index 6ae9aed55..8baecabdb 100644 --- a/java/res/layout/input_stone_normal.xml +++ b/java/res/layout/input_stone_normal.xml @@ -25,6 +25,7 @@ android:layout_alignParentBottom="true" android:layout_width="match_parent" android:layout_height="wrap_content" + android:padding="0dip" android:background="@drawable/keyboard_background" latin:keyBackground="@drawable/btn_keyboard_key_stone" @@ -32,5 +33,5 @@ latin:keyTextColorDisabled="#FF808080" latin:shadowColor="@color/latinkeyboard_key_color_white" latin:colorScheme="black" - latin:popupLayout="@layout/input_stone_popup" + latin:popupLayout="@layout/keyboard_popup_stone" /> diff --git a/java/res/layout/input_stone_popup.xml b/java/res/layout/keyboard_popup_stone.xml similarity index 96% rename from java/res/layout/input_stone_popup.xml rename to java/res/layout/keyboard_popup_stone.xml index b4da04536..e6acee374 100644 --- a/java/res/layout/input_stone_popup.xml +++ b/java/res/layout/keyboard_popup_stone.xml @@ -36,6 +36,5 @@ latin:keyBackground="@drawable/btn_keyboard_key_stone" latin:keyTextColor="@color/latinkeyboard_key_color_black" latin:shadowColor="@color/latinkeyboard_key_color_white" - latin:popupLayout="@layout/input_stone_popup" /> diff --git a/java/res/values-land/dimens.xml b/java/res/values-land/dimens.xml index 7df124bfc..6954ba2ae 100644 --- a/java/res/values-land/dimens.xml +++ b/java/res/values-land/dimens.xml @@ -27,6 +27,7 @@ 0.270in 0.0in 0.0in + 0.0in 38dip 63dip 2dip diff --git a/java/res/values-xlarge-land/dimens.xml b/java/res/values-xlarge-land/dimens.xml index ba42ddde6..fd6b1f386 100644 --- a/java/res/values-xlarge-land/dimens.xml +++ b/java/res/values-xlarge-land/dimens.xml @@ -28,6 +28,7 @@ 13.0mm 1.1mm 0.0mm + 0.0mm 28dip 20dip diff --git a/java/res/values-xlarge/dimens.xml b/java/res/values-xlarge/dimens.xml index cdb6e89a4..0dc5621ff 100644 --- a/java/res/values-xlarge/dimens.xml +++ b/java/res/values-xlarge/dimens.xml @@ -28,6 +28,7 @@ 10.0mm 1.1mm 0.0mm + 0.0mm 40dip 12dip diff --git a/java/res/values/dimens.xml b/java/res/values/dimens.xml index 2cfc17de9..767dc4aa9 100644 --- a/java/res/values/dimens.xml +++ b/java/res/values/dimens.xml @@ -28,6 +28,7 @@ 0.325in 0.00in 0.06in + 0.0in 16dip 32dip 8dip diff --git a/java/res/xml/kbd_qwerty_row3.xml b/java/res/xml/kbd_qwerty_row3.xml index 26608fd71..27016aff0 100644 --- a/java/res/xml/kbd_qwerty_row3.xml +++ b/java/res/xml/kbd_qwerty_row3.xml @@ -26,8 +26,10 @@ > + @@ -46,9 +48,11 @@ latin:popupCharacters="@string/alternates_for_n" /> + diff --git a/java/src/com/android/inputmethod/keyboard/Keyboard.java b/java/src/com/android/inputmethod/keyboard/Keyboard.java index 418188209..f720334f1 100644 --- a/java/src/com/android/inputmethod/keyboard/Keyboard.java +++ b/java/src/com/android/inputmethod/keyboard/Keyboard.java @@ -165,7 +165,9 @@ public class Keyboard { GRID_HEIGHT = res.getInteger(R.integer.config_keyboard_grid_height); GRID_SIZE = GRID_WIDTH * GRID_HEIGHT; - mDisplayWidth = width; + final int horizontalEdgesPadding = (int)res.getDimension( + R.dimen.keyboard_horizontal_edges_padding); + mDisplayWidth = width - horizontalEdgesPadding * 2; mDisplayHeight = height; mDefaultHorizontalGap = 0; diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardParser.java b/java/src/com/android/inputmethod/keyboard/KeyboardParser.java index 62e6f302d..9c556c309 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardParser.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardParser.java @@ -122,6 +122,7 @@ public class KeyboardParser { private final Keyboard mKeyboard; private final Resources mResources; + private int mHorizontalEdgesPadding; private int mCurrentX = 0; private int mCurrentY = 0; private int mMaxRowWidth = 0; @@ -132,6 +133,7 @@ public class KeyboardParser { public KeyboardParser(Keyboard keyboard, Resources res) { mKeyboard = keyboard; mResources = res; + mHorizontalEdgesPadding = (int)res.getDimension(R.dimen.keyboard_horizontal_edges_padding); } public int getMaxRowWidth() { @@ -151,6 +153,7 @@ public class KeyboardParser { final String tag = parser.getName(); if (TAG_KEYBOARD.equals(tag)) { parseKeyboardAttributes(parser); + startKeyboard(); parseKeyboardContent(parser, mKeyboard.getKeys()); break; } else { @@ -520,25 +523,32 @@ public class KeyboardParser { throw new NonEmptyTag(tag, parser); } + private void startKeyboard() { + mCurrentY += (int)mResources.getDimension(R.dimen.keyboard_top_padding); + } + private void startRow(Row row) { mCurrentX = 0; + setSpacer(mHorizontalEdgesPadding); mCurrentRow = row; } private void endRow() { if (mCurrentRow == null) throw new InflateException("orphant end row tag"); + setSpacer(mHorizontalEdgesPadding); + if (mCurrentX > mMaxRowWidth) + mMaxRowWidth = mCurrentX; mCurrentY += mCurrentRow.mDefaultHeight; mCurrentRow = null; } private void endKey(Key key) { mCurrentX += key.mGap + key.mWidth; - if (mCurrentX > mMaxRowWidth) - mMaxRowWidth = mCurrentX; } private void endKeyboard(int defaultVerticalGap) { + mCurrentY += (int)mResources.getDimension(R.dimen.keyboard_bottom_padding); mTotalHeight = mCurrentY - defaultVerticalGap; } diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java index cc14589f6..e82796bf4 100644 --- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java @@ -1056,7 +1056,7 @@ public class KeyboardView extends View implements PointerTracker.UIProxy { mKeyboardActionListener.onCodeInput(Keyboard.CODE_CAPSLOCK, null, 0, 0); } - private void onDoubleTapShiftKey(PointerTracker tracker) { + private void onDoubleTapShiftKey(@SuppressWarnings("unused") PointerTracker tracker) { // When shift key is double tapped, the first tap is correctly processed as usual tap. And // the second tap is treated as this double tap event, so that we need not mark tracker // calling setAlreadyProcessed() nor remove the tracker from mPointerQueueueue.