mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
Tune mini keyboard visual
This change only gets rid of the surrounding paddings of the mini keyboard. Bug: 5248783 Change-Id: Idb95ac1467085c230fd60e4bc0f466fef5700bfb
This commit is contained in:
parent
3f8351e186
commit
ea0c567f86
Before Width: | Height: | Size: 856 B After Width: | Height: | Size: 856 B |
Before Width: | Height: | Size: 571 B After Width: | Height: | Size: 571 B |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
@ -22,6 +22,8 @@
|
||||
<attr name="latinKeyboardStyle" format="reference" />
|
||||
<!-- KeyboardView style -->
|
||||
<attr name="keyboardViewStyle" format="reference" />
|
||||
<!-- MiniKeyboard style -->
|
||||
<attr name="miniKeyboardStyle" format="reference" />
|
||||
<!-- MiniKeyboardView style -->
|
||||
<attr name="miniKeyboardViewStyle" format="reference" />
|
||||
<attr name="miniKeyboardPanelStyle" format="reference" />
|
||||
@ -130,15 +132,15 @@
|
||||
|
||||
<declare-styleable name="Keyboard">
|
||||
<!-- Default keyboard height -->
|
||||
<attr name="keyboardHeight" format="dimension" />
|
||||
<attr name="keyboardHeight" format="dimension|fraction" />
|
||||
<!-- Maximum keyboard height, in pixels or percentage of display height -->
|
||||
<attr name="maxKeyboardHeight" format="dimension|fraction" />
|
||||
<!-- Minimum keyboard height represented in pixels, percentage of display height if fraction
|
||||
is positive, or percentage of display width if fraction is negative. -->
|
||||
<attr name="minKeyboardHeight" format="dimension|fraction" />
|
||||
<!-- Keyboard top and bottom paddings. -->
|
||||
<attr name="keyboardTopPadding" format="dimension" />
|
||||
<attr name="keyboardBottomPadding" format="dimension" />
|
||||
<attr name="keyboardTopPadding" format="dimension|fraction" />
|
||||
<attr name="keyboardBottomPadding" format="dimension|fraction" />
|
||||
<!-- Default width of a key, in pixels or percentage of display width.
|
||||
If the value is zero, the actual key width will be determined to fill out the area up
|
||||
to the right edge of the keyboard.
|
||||
|
@ -48,7 +48,7 @@
|
||||
<fraction name="keyboard_bottom_padding_ics">4.669%p</fraction>
|
||||
<fraction name="key_bottom_gap_ics">6.127%p</fraction>
|
||||
<fraction name="key_horizontal_gap_ics">1.739%p</fraction>
|
||||
<dimen name="mini_keyboard_horizontal_edges_padding_ics">6dp</dimen>
|
||||
<dimen name="mini_keyboard_horizontal_edges_padding_ics">4dip</dimen>
|
||||
|
||||
<!-- Amount of allowance for selecting keys in a mini popup keyboard by sliding finger. -->
|
||||
<!-- popup_key_height x 1.2 -->
|
||||
|
@ -67,6 +67,14 @@
|
||||
<item name="shadowRadius">2.75</item>
|
||||
<item name="backgroundDimAmount">0.5</item>
|
||||
</style>
|
||||
<style
|
||||
name="MiniKeyboard"
|
||||
parent="Keyboard"
|
||||
>
|
||||
<item name="keyboardTopPadding">0dip</item>
|
||||
<item name="keyboardBottomPadding">0dip</item>
|
||||
<item name="horizontalGap">0dip</item>
|
||||
</style>
|
||||
<style
|
||||
name="MiniKeyboardView"
|
||||
parent="KeyboardView"
|
||||
@ -145,6 +153,14 @@
|
||||
<item name="keyUppercaseLetterActivatedColor">#CC000000</item>
|
||||
<item name="shadowColor">#FFFFFFFF</item>
|
||||
</style>
|
||||
<style
|
||||
name="MiniKeyboard.Stone"
|
||||
parent="Keyboard.Stone"
|
||||
>
|
||||
<item name="keyboardTopPadding">0dip</item>
|
||||
<item name="keyboardBottomPadding">0dip</item>
|
||||
<item name="horizontalGap">0dip</item>
|
||||
</style>
|
||||
<style
|
||||
name="MiniKeyboardView.Stone"
|
||||
parent="MiniKeyboardView"
|
||||
@ -176,6 +192,14 @@
|
||||
<item name="keyBackground">@drawable/btn_keyboard_key_gingerbread</item>
|
||||
<item name="keyTextStyle">bold</item>
|
||||
</style>
|
||||
<style
|
||||
name="MiniKeyboard.Gingerbread"
|
||||
parent="Keyboard.Gingerbread"
|
||||
>
|
||||
<item name="keyboardTopPadding">0dip</item>
|
||||
<item name="keyboardBottomPadding">0dip</item>
|
||||
<item name="horizontalGap">0dip</item>
|
||||
</style>
|
||||
<style
|
||||
name="MiniKeyboardView.Gingerbread"
|
||||
parent="MiniKeyboardView"
|
||||
@ -219,6 +243,14 @@
|
||||
<item name="shadowColor">#00000000</item>
|
||||
<item name="shadowRadius">0.0</item>
|
||||
</style>
|
||||
<style
|
||||
name="MiniKeyboard.IceCreamSandwich"
|
||||
parent="Keyboard.IceCreamSandwich"
|
||||
>
|
||||
<item name="keyboardTopPadding">0dip</item>
|
||||
<item name="keyboardBottomPadding">0dip</item>
|
||||
<item name="horizontalGap">0dip</item>
|
||||
</style>
|
||||
<style
|
||||
name="MiniKeyboardView.IceCreamSandwich"
|
||||
parent="MiniKeyboardView"
|
||||
@ -227,7 +259,7 @@
|
||||
<item name="keyBackground">@drawable/btn_keyboard_key_popup_ics</item>
|
||||
</style>
|
||||
<style name="MiniKeyboardPanelStyle.IceCreamSandwich">
|
||||
<item name="android:background">@drawable/btn_keyboard_key_popup_background_holo</item>
|
||||
<item name="android:background">@drawable/keyboard_popup_panel_background_holo</item>
|
||||
<item name="android:paddingLeft">@dimen/mini_keyboard_horizontal_edges_padding_ics</item>
|
||||
<item name="android:paddingRight">@dimen/mini_keyboard_horizontal_edges_padding_ics</item>
|
||||
</style>
|
||||
|
@ -19,6 +19,7 @@
|
||||
<item name="keyboardStyle">@style/Keyboard</item>
|
||||
<item name="latinKeyboardStyle">@style/LatinKeyboard</item>
|
||||
<item name="keyboardViewStyle">@style/KeyboardView.HighContrast</item>
|
||||
<item name="miniKeyboardStyle">@style/MiniKeyboard</item>
|
||||
<item name="miniKeyboardViewStyle">@style/MiniKeyboardView</item>
|
||||
<item name="miniKeyboardPanelStyle">@style/MiniKeyboardPanelStyle</item>
|
||||
<item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item>
|
||||
|
@ -19,6 +19,7 @@
|
||||
<item name="keyboardStyle">@style/Keyboard</item>
|
||||
<item name="latinKeyboardStyle">@style/LatinKeyboard</item>
|
||||
<item name="keyboardViewStyle">@style/KeyboardView</item>
|
||||
<item name="miniKeyboardStyle">@style/MiniKeyboard</item>
|
||||
<item name="miniKeyboardViewStyle">@style/MiniKeyboardView</item>
|
||||
<item name="miniKeyboardPanelStyle">@style/MiniKeyboardPanelStyle</item>
|
||||
<item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item>
|
||||
|
@ -19,6 +19,7 @@
|
||||
<item name="keyboardStyle">@style/Keyboard.Gingerbread</item>
|
||||
<item name="latinKeyboardStyle">@style/LatinKeyboard</item>
|
||||
<item name="keyboardViewStyle">@style/KeyboardView.Gingerbread</item>
|
||||
<item name="miniKeyboardStyle">@style/MiniKeyboard.Gingerbread</item>
|
||||
<item name="miniKeyboardViewStyle">@style/MiniKeyboardView.Gingerbread</item>
|
||||
<item name="miniKeyboardPanelStyle">@style/MiniKeyboardPanelStyle</item>
|
||||
<item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item>
|
||||
|
@ -19,6 +19,7 @@
|
||||
<item name="keyboardStyle">@style/Keyboard.IceCreamSandwich</item>
|
||||
<item name="latinKeyboardStyle">@style/LatinKeyboard.IceCreamSandwich</item>
|
||||
<item name="keyboardViewStyle">@style/KeyboardView.IceCreamSandwich</item>
|
||||
<item name="miniKeyboardStyle">@style/MiniKeyboard.IceCreamSandwich</item>
|
||||
<item name="miniKeyboardViewStyle">@style/MiniKeyboardView.IceCreamSandwich</item>
|
||||
<item name="miniKeyboardPanelStyle">@style/MiniKeyboardPanelStyle.IceCreamSandwich</item>
|
||||
<item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle.IceCreamSandwich</item>
|
||||
|
@ -19,6 +19,7 @@
|
||||
<item name="keyboardStyle">@style/Keyboard.Stone</item>
|
||||
<item name="latinKeyboardStyle">@style/LatinKeyboard.Stone</item>
|
||||
<item name="keyboardViewStyle">@style/KeyboardView.Stone.Bold</item>
|
||||
<item name="miniKeyboardStyle">@style/MiniKeyboard.Stone</item>
|
||||
<item name="miniKeyboardViewStyle">@style/MiniKeyboardView.Stone</item>
|
||||
<item name="miniKeyboardPanelStyle">@style/MiniKeyboardPanelStyle</item>
|
||||
<item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item>
|
||||
|
@ -19,6 +19,7 @@
|
||||
<item name="keyboardStyle">@style/Keyboard.Stone</item>
|
||||
<item name="latinKeyboardStyle">@style/LatinKeyboard.Stone</item>
|
||||
<item name="keyboardViewStyle">@style/KeyboardView.Stone</item>
|
||||
<item name="miniKeyboardStyle">@style/MiniKeyboard.Stone</item>
|
||||
<item name="miniKeyboardViewStyle">@style/MiniKeyboardView.Stone</item>
|
||||
<item name="miniKeyboardPanelStyle">@style/MiniKeyboardPanelStyle</item>
|
||||
<item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item>
|
||||
|
@ -21,5 +21,6 @@
|
||||
<Keyboard xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
|
||||
latin:keyWidth="10%p"
|
||||
latin:rowHeight="@dimen/popup_key_height"
|
||||
style="?attr/miniKeyboardStyle"
|
||||
>
|
||||
</Keyboard>
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user