aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--java/res/values-land/dimens.xml4
-rw-r--r--java/res/values-xlarge-land/dimens.xml4
-rw-r--r--java/res/values-xlarge/dimens.xml6
-rw-r--r--java/res/values/attrs.xml13
-rw-r--r--java/res/values/dimens.xml10
-rw-r--r--java/res/values/styles.xml4
-rw-r--r--java/res/xml-ar/kbd_qwerty.xml3
-rw-r--r--java/res/xml-cs/kbd_qwerty.xml3
-rw-r--r--java/res/xml-da/kbd_qwerty.xml3
-rw-r--r--java/res/xml-de/kbd_qwerty.xml3
-rw-r--r--java/res/xml-fi/kbd_qwerty.xml3
-rw-r--r--java/res/xml-fr-rCA/kbd_qwerty.xml3
-rw-r--r--java/res/xml-fr-rCH/kbd_qwerty.xml3
-rw-r--r--java/res/xml-fr/kbd_qwerty.xml3
-rw-r--r--java/res/xml-hu/kbd_qwerty.xml3
-rw-r--r--java/res/xml-iw/kbd_qwerty.xml3
-rw-r--r--java/res/xml-nb/kbd_qwerty.xml3
-rw-r--r--java/res/xml-ru/kbd_qwerty.xml3
-rw-r--r--java/res/xml-sr/kbd_qwerty.xml3
-rw-r--r--java/res/xml-sv/kbd_qwerty.xml3
-rw-r--r--java/res/xml-xlarge/kbd_number.xml3
-rw-r--r--java/res/xml-xlarge/kbd_phone.xml3
-rw-r--r--java/res/xml-xlarge/kbd_phone_symbols.xml3
-rw-r--r--java/res/xml-xlarge/kbd_symbols.xml3
-rw-r--r--java/res/xml-xlarge/kbd_symbols_shift.xml3
-rw-r--r--java/res/xml/kbd_number.xml3
-rw-r--r--java/res/xml/kbd_phone.xml3
-rw-r--r--java/res/xml/kbd_phone_symbols.xml3
-rw-r--r--java/res/xml/kbd_qwerty.xml3
-rw-r--r--java/res/xml/kbd_symbols.xml3
-rw-r--r--java/res/xml/kbd_symbols_shift.xml3
-rw-r--r--java/src/com/android/inputmethod/keyboard/Key.java4
-rw-r--r--java/src/com/android/inputmethod/keyboard/KeyboardParser.java17
-rw-r--r--java/src/com/android/inputmethod/keyboard/KeyboardView.java33
-rw-r--r--java/src/com/android/inputmethod/keyboard/MiniKeyboardBuilder.java10
35 files changed, 123 insertions, 57 deletions
diff --git a/java/res/values-land/dimens.xml b/java/res/values-land/dimens.xml
index c46a51711..a541287f0 100644
--- a/java/res/values-land/dimens.xml
+++ b/java/res/values-land/dimens.xml
@@ -21,6 +21,7 @@
<resources>
<!-- keyboardHeight = key_height*4 + key_bottom_gap*3, key_height=0.260in -->
<dimen name="keyboardHeight">1.100in</dimen>
+ <fraction name="minKeyboardHeight">45%p</fraction>
<!-- key_height + key_bottom_gap = popup_key_height -->
<!-- <dimen name="key_height">0.260in</dimen>-->
<dimen name="key_bottom_gap">0.020in</dimen>
@@ -28,6 +29,9 @@
<dimen name="keyboard_top_padding">0.0in</dimen>
<dimen name="keyboard_bottom_padding">0.0in</dimen>
<dimen name="keyboard_horizontal_edges_padding">0.0in</dimen>
+ <fraction name="key_letter_ratio">55%</fraction>
+ <fraction name="key_label_text_ratio">35%</fraction>
+ <fraction name="key_preview_text_ratio">90%</fraction>
<dimen name="candidate_strip_height">38dip</dimen>
<dimen name="candidate_strip_fading_edge_length">63dip</dimen>
<dimen name="spacebar_vertical_correction">2dip</dimen>
diff --git a/java/res/values-xlarge-land/dimens.xml b/java/res/values-xlarge-land/dimens.xml
index fd6b1f386..ade125639 100644
--- a/java/res/values-xlarge-land/dimens.xml
+++ b/java/res/values-xlarge-land/dimens.xml
@@ -30,8 +30,8 @@
<dimen name="keyboard_bottom_padding">0.0mm</dimen>
<dimen name="keyboard_horizontal_edges_padding">0.0mm</dimen>
- <dimen name="key_letter_size">28dip</dimen>
- <dimen name="key_label_text_size">20dip</dimen>
+ <fraction name="key_letter_ratio">30.7%</fraction>
+ <fraction name="key_label_text_ratio">21.9%</fraction>
<!-- left or right padding of label alignment -->
<dimen name="key_label_horizontal_alignment_padding">18dip</dimen>
<dimen name="key_preview_height_holo">26.5mm</dimen>
diff --git a/java/res/values-xlarge/dimens.xml b/java/res/values-xlarge/dimens.xml
index 4f78bea4f..2796b6fcb 100644
--- a/java/res/values-xlarge/dimens.xml
+++ b/java/res/values-xlarge/dimens.xml
@@ -37,11 +37,11 @@
<!-- popup_key_height x -1.0 -->
<dimen name="mini_keyboard_vertical_correction">-13.0mm</dimen>
- <dimen name="key_letter_size">26dip</dimen>
- <dimen name="key_label_text_size">16dip</dimen>
+ <fraction name="key_letter_ratio">34.4%</fraction>
+ <fraction name="key_label_text_ratio">21.2%</fraction>
<!-- left or right padding of label alignment -->
<dimen name="key_label_horizontal_alignment_padding">6dip</dimen>
- <dimen name="key_preview_text_size_large">24dip</dimen>
+ <fraction name="key_preview_text_ratio">26.3%</fraction>
<dimen name="key_preview_height_holo">23.0mm</dimen>
<dimen name="key_preview_offset_holo">8.0mm</dimen>
diff --git a/java/res/values/attrs.xml b/java/res/values/attrs.xml
index e88b007a9..f03da4f8f 100644
--- a/java/res/values/attrs.xml
+++ b/java/res/values/attrs.xml
@@ -25,11 +25,13 @@
checkable+checked+pressed. -->
<attr name="keyBackground" format="reference" />
- <!-- Size of the text for one letter character keys. -->
- <attr name="keyLetterSize" format="dimension" />
+ <!-- Size of the text for one letter character keys, in the proportion of key height.
+ -->
+ <attr name="keyLetterRatio" format="float" />
- <!-- Size of the text for custom keys with some text and no icon. -->
- <attr name="labelTextSize" format="dimension" />
+ <!-- Size of the text for custom keys with some text and no icon, in the proportion of key
+ height. -->
+ <attr name="labelTextRatio" format="float" />
<!-- Color to use for the label in a key. -->
<attr name="keyTextColor" format="color" />
@@ -80,6 +82,9 @@
<attr name="keyboardHeight" format="dimension" />
<!-- 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" />
<!-- Default width of a key, in pixels or percentage of display width. -->
<attr name="keyWidth" format="dimension|fraction" />
<!-- Default height of a row (key height + vertical gap), in pixels or percentage of
diff --git a/java/res/values/dimens.xml b/java/res/values/dimens.xml
index 69f962f00..8f719541e 100644
--- a/java/res/values/dimens.xml
+++ b/java/res/values/dimens.xml
@@ -21,6 +21,8 @@
<resources>
<!-- keyboardHeight = key_height*4 + key_bottom_gap*3, key_height=0.295in -->
<dimen name="keyboardHeight">1.285in</dimen>
+ <fraction name="maxKeyboardHeight">50%p</fraction>
+ <fraction name="minKeyboardHeight">-61.8%p</fraction>
<!-- key_height + key_bottom_gap = popup_key_height -->
<!-- <dimen name="key_height">0.295in</dimen> -->
<dimen name="key_bottom_gap">0.035in</dimen>
@@ -41,13 +43,13 @@
to user's finger. -->
<dimen name="keyboard_vertical_correction">-0.05in</dimen>
- <dimen name="key_letter_size">0.13in</dimen>
- <dimen name="key_label_text_size">0.083in</dimen>
+ <fraction name="key_letter_ratio">45%</fraction>
+ <fraction name="key_label_text_ratio">29%</fraction>
<!-- left or right padding of label alignment -->
- <dimen name="key_label_horizontal_alignment_padding">0.13in</dimen>
+ <dimen name="key_label_horizontal_alignment_padding">21dip</dimen>
<dimen name="key_preview_height">80sp</dimen>
<dimen name="key_preview_offset">0.000in</dimen>
- <dimen name="key_preview_text_size_large">36sp</dimen>
+ <fraction name="key_preview_text_ratio">82%</fraction>
<dimen name="key_preview_height_holo">130sp</dimen>
<dimen name="key_preview_offset_holo">0.193in</dimen>
diff --git a/java/res/values/styles.xml b/java/res/values/styles.xml
index 8a4b16d7a..3a389e57b 100644
--- a/java/res/values/styles.xml
+++ b/java/res/values/styles.xml
@@ -19,14 +19,14 @@
<item name="android:background">@drawable/keyboard_background</item>
<item name="keyBackground">@drawable/btn_keyboard_key</item>
- <item name="keyLetterSize">@dimen/key_letter_size</item>
+ <item name="keyLetterRatio">@fraction/key_letter_ratio</item>
<item name="keyLetterStyle">normal</item>
<item name="keyTextColor">#FFFFFFFF</item>
<item name="keyTextColorDisabled">#FFFFFFFF</item>
<item name="keyPreviewLayout">@layout/key_preview</item>
<item name="keyPreviewOffset">@dimen/key_preview_offset</item>
<item name="keyPreviewHeight">@dimen/key_preview_height</item>
- <item name="labelTextSize">@dimen/key_label_text_size</item>
+ <item name="labelTextRatio">@fraction/key_label_text_ratio</item>
<item name="popupLayout">@layout/keyboard_popup</item>
<item name="keyHysteresisDistance">@dimen/key_hysteresis_distance</item>
<item name="verticalCorrection">@dimen/keyboard_vertical_correction</item>
diff --git a/java/res/xml-ar/kbd_qwerty.xml b/java/res/xml-ar/kbd_qwerty.xml
index 5faf60336..93310bf9c 100644
--- a/java/res/xml-ar/kbd_qwerty.xml
+++ b/java/res/xml-ar/kbd_qwerty.xml
@@ -21,7 +21,8 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="50%p"
+ latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
+ latin:minKeyboardHeight="@fraction/minKeyboardHeight"
latin:rowHeight="25%p"
latin:keyWidth="10%p"
latin:horizontalGap="@dimen/key_horizontal_gap"
diff --git a/java/res/xml-cs/kbd_qwerty.xml b/java/res/xml-cs/kbd_qwerty.xml
index 0e6e40d7c..a74f7fa84 100644
--- a/java/res/xml-cs/kbd_qwerty.xml
+++ b/java/res/xml-cs/kbd_qwerty.xml
@@ -21,7 +21,8 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="50%p"
+ latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
+ latin:minKeyboardHeight="@fraction/minKeyboardHeight"
latin:rowHeight="25%p"
latin:keyWidth="10%p"
latin:horizontalGap="@dimen/key_horizontal_gap"
diff --git a/java/res/xml-da/kbd_qwerty.xml b/java/res/xml-da/kbd_qwerty.xml
index d9847ae83..12ea33c13 100644
--- a/java/res/xml-da/kbd_qwerty.xml
+++ b/java/res/xml-da/kbd_qwerty.xml
@@ -21,7 +21,8 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="50%p"
+ latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
+ latin:minKeyboardHeight="@fraction/minKeyboardHeight"
latin:rowHeight="25%p"
latin:horizontalGap="@dimen/key_horizontal_gap"
latin:verticalGap="@dimen/key_bottom_gap"
diff --git a/java/res/xml-de/kbd_qwerty.xml b/java/res/xml-de/kbd_qwerty.xml
index 6b5c22391..cc7722a44 100644
--- a/java/res/xml-de/kbd_qwerty.xml
+++ b/java/res/xml-de/kbd_qwerty.xml
@@ -21,7 +21,8 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="50%p"
+ latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
+ latin:minKeyboardHeight="@fraction/minKeyboardHeight"
latin:rowHeight="25%p"
latin:keyWidth="10%p"
latin:horizontalGap="@dimen/key_horizontal_gap"
diff --git a/java/res/xml-fi/kbd_qwerty.xml b/java/res/xml-fi/kbd_qwerty.xml
index ea08d670b..e35ab2b41 100644
--- a/java/res/xml-fi/kbd_qwerty.xml
+++ b/java/res/xml-fi/kbd_qwerty.xml
@@ -21,7 +21,8 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="50%p"
+ latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
+ latin:minKeyboardHeight="@fraction/minKeyboardHeight"
latin:rowHeight="25%p"
latin:horizontalGap="@dimen/key_horizontal_gap"
latin:verticalGap="@dimen/key_bottom_gap"
diff --git a/java/res/xml-fr-rCA/kbd_qwerty.xml b/java/res/xml-fr-rCA/kbd_qwerty.xml
index f9c29698b..e649a1e9c 100644
--- a/java/res/xml-fr-rCA/kbd_qwerty.xml
+++ b/java/res/xml-fr-rCA/kbd_qwerty.xml
@@ -21,7 +21,8 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="50%p"
+ latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
+ latin:minKeyboardHeight="@fraction/minKeyboardHeight"
latin:rowHeight="25%p"
latin:keyWidth="10%p"
latin:horizontalGap="@dimen/key_horizontal_gap"
diff --git a/java/res/xml-fr-rCH/kbd_qwerty.xml b/java/res/xml-fr-rCH/kbd_qwerty.xml
index e47cfd9b4..f82becb48 100644
--- a/java/res/xml-fr-rCH/kbd_qwerty.xml
+++ b/java/res/xml-fr-rCH/kbd_qwerty.xml
@@ -21,7 +21,8 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="50%p"
+ latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
+ latin:minKeyboardHeight="@fraction/minKeyboardHeight"
latin:rowHeight="25%p"
latin:keyWidth="10%p"
latin:horizontalGap="@dimen/key_horizontal_gap"
diff --git a/java/res/xml-fr/kbd_qwerty.xml b/java/res/xml-fr/kbd_qwerty.xml
index e4b73bf21..5d1f10c6b 100644
--- a/java/res/xml-fr/kbd_qwerty.xml
+++ b/java/res/xml-fr/kbd_qwerty.xml
@@ -21,7 +21,8 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="50%p"
+ latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
+ latin:minKeyboardHeight="@fraction/minKeyboardHeight"
latin:rowHeight="25%p"
latin:keyWidth="10%p"
latin:horizontalGap="@dimen/key_horizontal_gap"
diff --git a/java/res/xml-hu/kbd_qwerty.xml b/java/res/xml-hu/kbd_qwerty.xml
index db729cf02..952ad9a0f 100644
--- a/java/res/xml-hu/kbd_qwerty.xml
+++ b/java/res/xml-hu/kbd_qwerty.xml
@@ -21,7 +21,8 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="50%p"
+ latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
+ latin:minKeyboardHeight="@fraction/minKeyboardHeight"
latin:rowHeight="25%p"
latin:keyWidth="10%p"
latin:horizontalGap="@dimen/key_horizontal_gap"
diff --git a/java/res/xml-iw/kbd_qwerty.xml b/java/res/xml-iw/kbd_qwerty.xml
index 4cd565b88..cfe404c9d 100644
--- a/java/res/xml-iw/kbd_qwerty.xml
+++ b/java/res/xml-iw/kbd_qwerty.xml
@@ -21,7 +21,8 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="50%p"
+ latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
+ latin:minKeyboardHeight="@fraction/minKeyboardHeight"
latin:rowHeight="25%p"
latin:keyWidth="10%p"
latin:horizontalGap="@dimen/key_horizontal_gap"
diff --git a/java/res/xml-nb/kbd_qwerty.xml b/java/res/xml-nb/kbd_qwerty.xml
index 7b20ca28d..e7a743ca9 100644
--- a/java/res/xml-nb/kbd_qwerty.xml
+++ b/java/res/xml-nb/kbd_qwerty.xml
@@ -21,7 +21,8 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="50%p"
+ latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
+ latin:minKeyboardHeight="@fraction/minKeyboardHeight"
latin:rowHeight="25%p"
latin:horizontalGap="@dimen/key_horizontal_gap"
latin:verticalGap="@dimen/key_bottom_gap"
diff --git a/java/res/xml-ru/kbd_qwerty.xml b/java/res/xml-ru/kbd_qwerty.xml
index 065cf3afc..826818c46 100644
--- a/java/res/xml-ru/kbd_qwerty.xml
+++ b/java/res/xml-ru/kbd_qwerty.xml
@@ -21,7 +21,8 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="50%p"
+ latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
+ latin:minKeyboardHeight="@fraction/minKeyboardHeight"
latin:rowHeight="25%p"
latin:horizontalGap="@dimen/key_horizontal_gap"
latin:verticalGap="@dimen/key_bottom_gap"
diff --git a/java/res/xml-sr/kbd_qwerty.xml b/java/res/xml-sr/kbd_qwerty.xml
index 9782cd5eb..6116c7536 100644
--- a/java/res/xml-sr/kbd_qwerty.xml
+++ b/java/res/xml-sr/kbd_qwerty.xml
@@ -21,7 +21,8 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="50%p"
+ latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
+ latin:minKeyboardHeight="@fraction/minKeyboardHeight"
latin:rowHeight="25%p"
latin:horizontalGap="@dimen/key_horizontal_gap"
latin:verticalGap="@dimen/key_bottom_gap"
diff --git a/java/res/xml-sv/kbd_qwerty.xml b/java/res/xml-sv/kbd_qwerty.xml
index 3ff1679a2..69f0b3fa0 100644
--- a/java/res/xml-sv/kbd_qwerty.xml
+++ b/java/res/xml-sv/kbd_qwerty.xml
@@ -21,7 +21,8 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="50%p"
+ latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
+ latin:minKeyboardHeight="@fraction/minKeyboardHeight"
latin:rowHeight="25%p"
latin:horizontalGap="@dimen/key_horizontal_gap"
latin:verticalGap="@dimen/key_bottom_gap"
diff --git a/java/res/xml-xlarge/kbd_number.xml b/java/res/xml-xlarge/kbd_number.xml
index 012b75115..7cb77ea00 100644
--- a/java/res/xml-xlarge/kbd_number.xml
+++ b/java/res/xml-xlarge/kbd_number.xml
@@ -21,7 +21,8 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="50%p"
+ latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
+ latin:minKeyboardHeight="@fraction/minKeyboardHeight"
latin:rowHeight="25%p"
latin:keyWidth="11.949%p"
latin:horizontalGap="@dimen/key_horizontal_gap"
diff --git a/java/res/xml-xlarge/kbd_phone.xml b/java/res/xml-xlarge/kbd_phone.xml
index 9122176a9..60edcf2bd 100644
--- a/java/res/xml-xlarge/kbd_phone.xml
+++ b/java/res/xml-xlarge/kbd_phone.xml
@@ -21,7 +21,8 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="50%p"
+ latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
+ latin:minKeyboardHeight="@fraction/minKeyboardHeight"
latin:rowHeight="25%p"
latin:keyWidth="11.949%p"
latin:horizontalGap="@dimen/key_horizontal_gap"
diff --git a/java/res/xml-xlarge/kbd_phone_symbols.xml b/java/res/xml-xlarge/kbd_phone_symbols.xml
index 055c14867..c388a4667 100644
--- a/java/res/xml-xlarge/kbd_phone_symbols.xml
+++ b/java/res/xml-xlarge/kbd_phone_symbols.xml
@@ -21,7 +21,8 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="50%p"
+ latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
+ latin:minKeyboardHeight="@fraction/minKeyboardHeight"
latin:rowHeight="25%p"
latin:keyWidth="11.949%p"
latin:horizontalGap="@dimen/key_horizontal_gap"
diff --git a/java/res/xml-xlarge/kbd_symbols.xml b/java/res/xml-xlarge/kbd_symbols.xml
index 312eb139b..41e8522dc 100644
--- a/java/res/xml-xlarge/kbd_symbols.xml
+++ b/java/res/xml-xlarge/kbd_symbols.xml
@@ -21,7 +21,8 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="50%p"
+ latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
+ latin:minKeyboardHeight="@fraction/minKeyboardHeight"
latin:rowHeight="25%p"
latin:horizontalGap="@dimen/key_horizontal_gap"
latin:verticalGap="@dimen/key_bottom_gap"
diff --git a/java/res/xml-xlarge/kbd_symbols_shift.xml b/java/res/xml-xlarge/kbd_symbols_shift.xml
index cc23358a5..d7f5958b7 100644
--- a/java/res/xml-xlarge/kbd_symbols_shift.xml
+++ b/java/res/xml-xlarge/kbd_symbols_shift.xml
@@ -21,7 +21,8 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="50%p"
+ latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
+ latin:minKeyboardHeight="@fraction/minKeyboardHeight"
latin:rowHeight="25%p"
latin:horizontalGap="@dimen/key_horizontal_gap"
latin:verticalGap="@dimen/key_bottom_gap"
diff --git a/java/res/xml/kbd_number.xml b/java/res/xml/kbd_number.xml
index 7bd679bce..2556f6830 100644
--- a/java/res/xml/kbd_number.xml
+++ b/java/res/xml/kbd_number.xml
@@ -21,7 +21,8 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="50%p"
+ latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
+ latin:minKeyboardHeight="@fraction/minKeyboardHeight"
latin:rowHeight="25%p"
latin:keyWidth="26.67%p"
latin:horizontalGap="@dimen/key_horizontal_gap"
diff --git a/java/res/xml/kbd_phone.xml b/java/res/xml/kbd_phone.xml
index 62fbdeeec..ca591c72d 100644
--- a/java/res/xml/kbd_phone.xml
+++ b/java/res/xml/kbd_phone.xml
@@ -21,7 +21,8 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="50%p"
+ latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
+ latin:minKeyboardHeight="@fraction/minKeyboardHeight"
latin:rowHeight="25%p"
latin:keyWidth="26.67%p"
latin:horizontalGap="@dimen/key_horizontal_gap"
diff --git a/java/res/xml/kbd_phone_symbols.xml b/java/res/xml/kbd_phone_symbols.xml
index 67cd330e7..99db23ef1 100644
--- a/java/res/xml/kbd_phone_symbols.xml
+++ b/java/res/xml/kbd_phone_symbols.xml
@@ -21,7 +21,8 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="50%p"
+ latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
+ latin:minKeyboardHeight="@fraction/minKeyboardHeight"
latin:rowHeight="25%p"
latin:keyWidth="26.67%p"
latin:horizontalGap="@dimen/key_horizontal_gap"
diff --git a/java/res/xml/kbd_qwerty.xml b/java/res/xml/kbd_qwerty.xml
index a4251c0bd..fd43740a7 100644
--- a/java/res/xml/kbd_qwerty.xml
+++ b/java/res/xml/kbd_qwerty.xml
@@ -21,7 +21,8 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="50%p"
+ latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
+ latin:minKeyboardHeight="@fraction/minKeyboardHeight"
latin:rowHeight="25%p"
latin:keyWidth="10%p"
latin:horizontalGap="@dimen/key_horizontal_gap"
diff --git a/java/res/xml/kbd_symbols.xml b/java/res/xml/kbd_symbols.xml
index 76508f489..0a8068991 100644
--- a/java/res/xml/kbd_symbols.xml
+++ b/java/res/xml/kbd_symbols.xml
@@ -21,7 +21,8 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="50%p"
+ latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
+ latin:minKeyboardHeight="@fraction/minKeyboardHeight"
latin:rowHeight="25%p"
latin:keyWidth="10%p"
latin:horizontalGap="@dimen/key_horizontal_gap"
diff --git a/java/res/xml/kbd_symbols_shift.xml b/java/res/xml/kbd_symbols_shift.xml
index 3978f1776..cde07333b 100644
--- a/java/res/xml/kbd_symbols_shift.xml
+++ b/java/res/xml/kbd_symbols_shift.xml
@@ -21,7 +21,8 @@
<Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:keyboardHeight="@dimen/keyboardHeight"
- latin:maxKeyboardHeight="50%p"
+ latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
+ latin:minKeyboardHeight="@fraction/minKeyboardHeight"
latin:rowHeight="25%p"
latin:keyWidth="10%p"
latin:horizontalGap="@dimen/key_horizontal_gap"
diff --git a/java/src/com/android/inputmethod/keyboard/Key.java b/java/src/com/android/inputmethod/keyboard/Key.java
index 5c59d4441..33b55b5d3 100644
--- a/java/src/com/android/inputmethod/keyboard/Key.java
+++ b/java/src/com/android/inputmethod/keyboard/Key.java
@@ -143,9 +143,9 @@ public class Key {
* This constructor is being used only for key in mini popup keyboard.
*/
public Key(Resources res, Keyboard keyboard, CharSequence popupCharacter, int x, int y,
- int width, int edgeFlags) {
+ int width, int height, int edgeFlags) {
mKeyboard = keyboard;
- mHeight = keyboard.getRowHeight() - keyboard.getVerticalGap();
+ mHeight = height - keyboard.getVerticalGap();
mGap = keyboard.getHorizontalGap();
mVisualInsetsLeft = mVisualInsetsRight = 0;
mWidth = width - mGap;
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardParser.java b/java/src/com/android/inputmethod/keyboard/KeyboardParser.java
index 69ae7886a..31fd0bfa3 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardParser.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardParser.java
@@ -196,9 +196,20 @@ public class KeyboardParser {
final int keyboardHeight = (int)keyboardAttr.getDimension(
R.styleable.Keyboard_keyboardHeight, displayHeight / 2);
final int maxKeyboardHeight = getDimensionOrFraction(keyboardAttr,
- R.styleable.Keyboard_maxKeyboardHeight, displayHeight, displayHeight / 2);
- // Keyboard height will not exceed maxKeyboardHeight.
- final int height = Math.min(keyboardHeight, maxKeyboardHeight);
+ R.styleable.Keyboard_maxKeyboardHeight, displayHeight, displayHeight / 2);
+ int minKeyboardHeight = getDimensionOrFraction(keyboardAttr,
+ R.styleable.Keyboard_minKeyboardHeight, displayHeight, displayHeight / 2);
+ if (minKeyboardHeight < 0) {
+ // Specified fraction was negative, so it should be calculated against display
+ // width.
+ final int displayWidth = keyboard.getDisplayWidth();
+ minKeyboardHeight = -getDimensionOrFraction(keyboardAttr,
+ R.styleable.Keyboard_minKeyboardHeight, displayWidth, displayWidth / 2);
+ }
+ // Keyboard height will not exceed maxKeyboardHeight and will not be less than
+ // minKeyboardHeight.
+ final int height = Math.max(
+ Math.min(keyboardHeight, maxKeyboardHeight), minKeyboardHeight);
final int width = keyboard.getDisplayWidth();
keyboard.setKeyboardHeight(height);
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardView.java b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
index c551ed49f..1ea1436d3 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardView.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardView.java
@@ -86,10 +86,12 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
private static final int HINT_ICON_VERTICAL_ADJUSTMENT_PIXEL = -1;
// XML attribute
+ private float mKeyLetterRatio;
private int mKeyLetterSize;
private int mKeyTextColor;
private int mKeyTextColorDisabled;
private Typeface mKeyLetterStyle = Typeface.DEFAULT;
+ private float mLabelTextRatio;
private int mLabelTextSize;
private int mColorScheme = COLOR_SCHEME_WHITE;
private int mShadowColor;
@@ -108,7 +110,8 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
// Key preview
private boolean mInForeground;
private TextView mPreviewText;
- private int mPreviewTextSizeLarge;
+ private float mPreviewTextRatio;
+ private int mPreviewTextSize;
private boolean mShowKeyPreview = true;
private int mKeyPreviewDisplayedY;
private final int mDelayBeforePreview;
@@ -327,8 +330,8 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
case R.styleable.KeyboardView_keyPreviewHeight:
mPreviewHeight = a.getDimensionPixelSize(attr, 80);
break;
- case R.styleable.KeyboardView_keyLetterSize:
- mKeyLetterSize = a.getDimensionPixelSize(attr, 18);
+ case R.styleable.KeyboardView_keyLetterRatio:
+ mKeyLetterRatio = getRatio(a, attr);
break;
case R.styleable.KeyboardView_keyTextColor:
mKeyTextColor = a.getColor(attr, 0xFF000000);
@@ -336,8 +339,8 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
case R.styleable.KeyboardView_keyTextColorDisabled:
mKeyTextColorDisabled = a.getColor(attr, 0xFF000000);
break;
- case R.styleable.KeyboardView_labelTextSize:
- mLabelTextSize = a.getDimensionPixelSize(attr, 14);
+ case R.styleable.KeyboardView_labelTextRatio:
+ mLabelTextRatio = getRatio(a, attr);
break;
case R.styleable.KeyboardView_popupLayout:
mPopupLayout = a.getResourceId(attr, 0);
@@ -365,7 +368,7 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
if (previewLayout != 0) {
mPreviewText = (TextView) LayoutInflater.from(context).inflate(previewLayout, null);
- mPreviewTextSizeLarge = (int) res.getDimension(R.dimen.key_preview_text_size_large);
+ mPreviewTextRatio = getRatio(res, R.fraction.key_preview_text_ratio);
} else {
mShowKeyPreview = false;
}
@@ -460,6 +463,16 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
mKeyRepeatInterval = res.getInteger(R.integer.config_key_repeat_interval);
}
+ // Read fraction value in TypedArray as float.
+ private static float getRatio(TypedArray a, int index) {
+ return a.getFraction(index, 1000, 1000, 1) / 1000.0f;
+ }
+
+ // Read fraction value in resource as float.
+ private static float getRatio(Resources res, int id) {
+ return res.getFraction(id, 1000, 1000) / 1000.0f;
+ }
+
public void startIgnoringDoubleTap() {
if (ENABLE_CAPSLOCK_BY_DOUBLETAP)
mHandler.startIgnoringDoubleTap();
@@ -506,6 +519,10 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
invalidateAllKeys();
mKeyDetector.setProximityThreshold(keyboard.getMostCommonKeyWidth());
mPopupPanelCache.clear();
+ final int keyHeight = keyboard.getRowHeight() - keyboard.getVerticalGap();
+ mKeyLetterSize = (int)(keyHeight * mKeyLetterRatio);
+ mLabelTextSize = (int)(keyHeight * mLabelTextRatio);
+ mPreviewTextSize = (int)(keyHeight * mPreviewTextRatio);
}
/**
@@ -938,7 +955,7 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
previewText.setTextSize(TypedValue.COMPLEX_UNIT_PX, mKeyLetterSize);
previewText.setTypeface(Typeface.DEFAULT_BOLD);
} else {
- previewText.setTextSize(TypedValue.COMPLEX_UNIT_PX, mPreviewTextSizeLarge);
+ previewText.setTextSize(TypedValue.COMPLEX_UNIT_PX, mPreviewTextSize);
previewText.setTypeface(mKeyLetterStyle);
}
} else {
@@ -1078,7 +1095,7 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
});
final Keyboard keyboard = new MiniKeyboardBuilder(this, mKeyboard.getPopupKeyboardResId(),
- parentKey).build();
+ parentKey, mKeyboard).build();
miniKeyboardView.setKeyboard(keyboard);
container.measure(MeasureSpec.makeMeasureSpec(getWidth(), MeasureSpec.AT_MOST),
diff --git a/java/src/com/android/inputmethod/keyboard/MiniKeyboardBuilder.java b/java/src/com/android/inputmethod/keyboard/MiniKeyboardBuilder.java
index e540fa106..2b83c3ff5 100644
--- a/java/src/com/android/inputmethod/keyboard/MiniKeyboardBuilder.java
+++ b/java/src/com/android/inputmethod/keyboard/MiniKeyboardBuilder.java
@@ -181,7 +181,8 @@ public class MiniKeyboardBuilder {
}
}
- public MiniKeyboardBuilder(KeyboardView view, int layoutTemplateResId, Key parentKey) {
+ public MiniKeyboardBuilder(KeyboardView view, int layoutTemplateResId, Key parentKey,
+ Keyboard parentKeyboard) {
final Context context = view.getContext();
mRes = context.getResources();
final MiniKeyboard keyboard = new MiniKeyboard(context, layoutTemplateResId, null);
@@ -191,12 +192,13 @@ public class MiniKeyboardBuilder {
final int keyWidth = getMaxKeyWidth(view, mPopupCharacters, keyboard.getKeyWidth());
final MiniKeyboardLayoutParams params = new MiniKeyboardLayoutParams(
mPopupCharacters.length, parentKey.mMaxPopupColumn,
- keyWidth, keyboard.getRowHeight(),
+ keyWidth, parentKeyboard.getRowHeight(),
parentKey.mX + (parentKey.mWidth + parentKey.mGap) / 2 - keyWidth / 2,
view.getMeasuredWidth());
mParams = params;
- keyboard.setHeight(params.mNumRows * params.mRowHeight - keyboard.getVerticalGap());
+ keyboard.setRowHeight(params.mRowHeight);
+ keyboard.setHeight(params.mNumRows * params.mRowHeight);
keyboard.setMinWidth(params.mNumColumns * params.mKeyWidth);
keyboard.setDefaultCoordX(params.getDefaultKeyCoordX() + params.mKeyWidth / 2);
}
@@ -235,7 +237,7 @@ public class MiniKeyboardBuilder {
final CharSequence label = mPopupCharacters[n];
final int row = n / params.mNumColumns;
final Key key = new Key(mRes, keyboard, label, params.getX(n, row), params.getY(row),
- params.mKeyWidth, params.getRowFlags(row));
+ params.mKeyWidth, params.mRowHeight, params.getRowFlags(row));
keys.add(key);
}
return keyboard;