From ea0c567f86bd19015d53fc038c4579df776cfec3 Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Mon, 5 Sep 2011 18:58:30 +0900 Subject: [PATCH] Tune mini keyboard visual This change only gets rid of the surrounding paddings of the mini keyboard. Bug: 5248783 Change-Id: Idb95ac1467085c230fd60e4bc0f466fef5700bfb --- ...eyboard_popup_panel_background_holo.9.png} | Bin ...eyboard_popup_panel_background_holo.9.png} | Bin ...eyboard_popup_panel_background_holo.9.png} | Bin java/res/values/attrs.xml | 8 +++-- java/res/values/dimens.xml | 2 +- java/res/values/styles.xml | 34 +++++++++++++++++- java/res/values/themes-basic-highcontrast.xml | 1 + java/res/values/themes-basic.xml | 1 + java/res/values/themes-gingerbread.xml | 1 + java/res/values/themes-ics.xml | 1 + java/res/values/themes-stone-bold.xml | 1 + java/res/values/themes-stone.xml | 1 + java/res/xml/kbd_mini_keyboard_template.xml | 1 + .../inputmethod/keyboard/MiniKeyboard.java | 21 ++++------- 14 files changed, 52 insertions(+), 20 deletions(-) rename java/res/drawable-hdpi/{btn_keyboard_key_popup_background_holo.9.png => keyboard_popup_panel_background_holo.9.png} (100%) rename java/res/drawable-mdpi/{btn_keyboard_key_popup_background_holo.9.png => keyboard_popup_panel_background_holo.9.png} (100%) rename java/res/drawable-xhdpi/{btn_keyboard_key_popup_background_holo.9.png => keyboard_popup_panel_background_holo.9.png} (100%) diff --git a/java/res/drawable-hdpi/btn_keyboard_key_popup_background_holo.9.png b/java/res/drawable-hdpi/keyboard_popup_panel_background_holo.9.png similarity index 100% rename from java/res/drawable-hdpi/btn_keyboard_key_popup_background_holo.9.png rename to java/res/drawable-hdpi/keyboard_popup_panel_background_holo.9.png diff --git a/java/res/drawable-mdpi/btn_keyboard_key_popup_background_holo.9.png b/java/res/drawable-mdpi/keyboard_popup_panel_background_holo.9.png similarity index 100% rename from java/res/drawable-mdpi/btn_keyboard_key_popup_background_holo.9.png rename to java/res/drawable-mdpi/keyboard_popup_panel_background_holo.9.png diff --git a/java/res/drawable-xhdpi/btn_keyboard_key_popup_background_holo.9.png b/java/res/drawable-xhdpi/keyboard_popup_panel_background_holo.9.png similarity index 100% rename from java/res/drawable-xhdpi/btn_keyboard_key_popup_background_holo.9.png rename to java/res/drawable-xhdpi/keyboard_popup_panel_background_holo.9.png diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml index 20f1e32c8..e964889c4 100644 --- a/java/res/values/attrs.xml +++ b/java/res/values/attrs.xml @@ -22,6 +22,8 @@ + + @@ -130,15 +132,15 @@ - + - - + + diff --git a/java/res/values/styles.xml b/java/res/values/styles.xml index dc2021a44..0e8216b48 100644 --- a/java/res/values/styles.xml +++ b/java/res/values/styles.xml @@ -67,6 +67,14 @@ 2.75 0.5 + + + + diff --git a/java/res/values/themes-basic-highcontrast.xml b/java/res/values/themes-basic-highcontrast.xml index a45fa5239..ce0598042 100644 --- a/java/res/values/themes-basic-highcontrast.xml +++ b/java/res/values/themes-basic-highcontrast.xml @@ -19,6 +19,7 @@ @style/Keyboard @style/LatinKeyboard @style/KeyboardView.HighContrast + @style/MiniKeyboard @style/MiniKeyboardView @style/MiniKeyboardPanelStyle @style/SuggestionsStripBackgroundStyle diff --git a/java/res/values/themes-basic.xml b/java/res/values/themes-basic.xml index 4f754844f..ff9fed55f 100644 --- a/java/res/values/themes-basic.xml +++ b/java/res/values/themes-basic.xml @@ -19,6 +19,7 @@ @style/Keyboard @style/LatinKeyboard @style/KeyboardView + @style/MiniKeyboard @style/MiniKeyboardView @style/MiniKeyboardPanelStyle @style/SuggestionsStripBackgroundStyle diff --git a/java/res/values/themes-gingerbread.xml b/java/res/values/themes-gingerbread.xml index f3a74f33e..be853eb0f 100644 --- a/java/res/values/themes-gingerbread.xml +++ b/java/res/values/themes-gingerbread.xml @@ -19,6 +19,7 @@ @style/Keyboard.Gingerbread @style/LatinKeyboard @style/KeyboardView.Gingerbread + @style/MiniKeyboard.Gingerbread @style/MiniKeyboardView.Gingerbread @style/MiniKeyboardPanelStyle @style/SuggestionsStripBackgroundStyle diff --git a/java/res/values/themes-ics.xml b/java/res/values/themes-ics.xml index 4b5ae6d20..618aaed79 100644 --- a/java/res/values/themes-ics.xml +++ b/java/res/values/themes-ics.xml @@ -19,6 +19,7 @@ @style/Keyboard.IceCreamSandwich @style/LatinKeyboard.IceCreamSandwich @style/KeyboardView.IceCreamSandwich + @style/MiniKeyboard.IceCreamSandwich @style/MiniKeyboardView.IceCreamSandwich @style/MiniKeyboardPanelStyle.IceCreamSandwich @style/SuggestionsStripBackgroundStyle.IceCreamSandwich diff --git a/java/res/values/themes-stone-bold.xml b/java/res/values/themes-stone-bold.xml index 3cff0f123..fdf9c51f5 100644 --- a/java/res/values/themes-stone-bold.xml +++ b/java/res/values/themes-stone-bold.xml @@ -19,6 +19,7 @@ @style/Keyboard.Stone @style/LatinKeyboard.Stone @style/KeyboardView.Stone.Bold + @style/MiniKeyboard.Stone @style/MiniKeyboardView.Stone @style/MiniKeyboardPanelStyle @style/SuggestionsStripBackgroundStyle diff --git a/java/res/values/themes-stone.xml b/java/res/values/themes-stone.xml index 785f4107f..cb3edc58f 100644 --- a/java/res/values/themes-stone.xml +++ b/java/res/values/themes-stone.xml @@ -19,6 +19,7 @@ @style/Keyboard.Stone @style/LatinKeyboard.Stone @style/KeyboardView.Stone + @style/MiniKeyboard.Stone @style/MiniKeyboardView.Stone @style/MiniKeyboardPanelStyle @style/SuggestionsStripBackgroundStyle diff --git a/java/res/xml/kbd_mini_keyboard_template.xml b/java/res/xml/kbd_mini_keyboard_template.xml index d25878b48..ad6cf51fe 100644 --- a/java/res/xml/kbd_mini_keyboard_template.xml +++ b/java/res/xml/kbd_mini_keyboard_template.xml @@ -21,5 +21,6 @@ diff --git a/java/src/com/android/inputmethod/keyboard/MiniKeyboard.java b/java/src/com/android/inputmethod/keyboard/MiniKeyboard.java index da91b62d9..ad8056cc0 100644 --- a/java/src/com/android/inputmethod/keyboard/MiniKeyboard.java +++ b/java/src/com/android/inputmethod/keyboard/MiniKeyboard.java @@ -123,7 +123,9 @@ public class MiniKeyboard extends Keyboard { } mWidth = mOccupiedWidth = mNumColumns * mDefaultKeyWidth; - mHeight = mOccupiedHeight = mNumRows * mDefaultRowHeight + mVerticalGap; + // Need to subtract the bottom row's gutter only. + mHeight = mOccupiedHeight = mNumRows * mDefaultRowHeight - mVerticalGap + + mTopPadding + mBottomPadding; } // Return key position according to column count (0 is default). @@ -209,20 +211,9 @@ public class MiniKeyboard extends Keyboard { super(view.getContext(), new MiniKeyboardParams()); load(parentKeyboard.mId.cloneWithNewXml(mResources.getResourceEntryName(xmlId), xmlId)); - // HACK: Current mini keyboard design totally relies on the 9-patch - // padding about horizontal - // and vertical key spacing. To keep the visual of mini keyboard as - // is, these hacks are - // needed to keep having the same horizontal and vertical key - // spacing. - mParams.mHorizontalGap = 0; - mParams.mVerticalGap = mParams.mTopPadding = parentKeyboard.mVerticalGap / 2; - // TODO: When we have correctly padded key background 9-patch - // drawables for mini keyboard, - // revert the above hacks and uncomment the following lines. - // mParams.mHorizontalGap = parentKeyboard.mHorizontalGap; - // mParams.mVerticalGap = parentKeyboard.mVerticalGap; - + // TODO: Mini keyboard's vertical gap is currently calculated heuristically. + // Should revise the algorithm. + mParams.mVerticalGap = parentKeyboard.mVerticalGap / 2; mParams.mIsRtlKeyboard = parentKeyboard.mIsRtlKeyboard; mMoreKeys = parentKey.mMoreKeys;