Merge "Add minKeyboardHeight attribute to Keyboard layout"

main
Tadashi G. Takaoka 2011-05-13 02:41:50 -07:00 committed by Android (Google) Code Review
commit 13e6725a78
32 changed files with 83 additions and 38 deletions

View File

@ -21,6 +21,7 @@
<resources> <resources>
<!-- keyboardHeight = key_height*4 + key_bottom_gap*3, key_height=0.260in --> <!-- keyboardHeight = key_height*4 + key_bottom_gap*3, key_height=0.260in -->
<dimen name="keyboardHeight">1.100in</dimen> <dimen name="keyboardHeight">1.100in</dimen>
<fraction name="minKeyboardHeight">45%p</fraction>
<!-- key_height + key_bottom_gap = popup_key_height --> <!-- key_height + key_bottom_gap = popup_key_height -->
<!-- <dimen name="key_height">0.260in</dimen>--> <!-- <dimen name="key_height">0.260in</dimen>-->
<dimen name="key_bottom_gap">0.020in</dimen> <dimen name="key_bottom_gap">0.020in</dimen>

View File

@ -80,6 +80,9 @@
<attr name="keyboardHeight" format="dimension" /> <attr name="keyboardHeight" format="dimension" />
<!-- Maximum keyboard height, in pixels or percentage of display height --> <!-- Maximum keyboard height, in pixels or percentage of display height -->
<attr name="maxKeyboardHeight" format="dimension|fraction" /> <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. --> <!-- Default width of a key, in pixels or percentage of display width. -->
<attr name="keyWidth" format="dimension|fraction" /> <attr name="keyWidth" format="dimension|fraction" />
<!-- Default height of a row (key height + vertical gap), in pixels or percentage of <!-- Default height of a row (key height + vertical gap), in pixels or percentage of

View File

@ -21,6 +21,8 @@
<resources> <resources>
<!-- keyboardHeight = key_height*4 + key_bottom_gap*3, key_height=0.295in --> <!-- keyboardHeight = key_height*4 + key_bottom_gap*3, key_height=0.295in -->
<dimen name="keyboardHeight">1.285in</dimen> <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 --> <!-- key_height + key_bottom_gap = popup_key_height -->
<!-- <dimen name="key_height">0.295in</dimen> --> <!-- <dimen name="key_height">0.295in</dimen> -->
<dimen name="key_bottom_gap">0.035in</dimen> <dimen name="key_bottom_gap">0.035in</dimen>
@ -41,10 +43,11 @@
to user's finger. --> to user's finger. -->
<dimen name="keyboard_vertical_correction">-0.05in</dimen> <dimen name="keyboard_vertical_correction">-0.05in</dimen>
<dimen name="key_letter_size">0.13in</dimen> <!-- TODO: use fraction for key letter size and etc. -->
<dimen name="key_label_text_size">0.083in</dimen> <dimen name="key_letter_size">21dip</dimen>
<dimen name="key_label_text_size">13dip</dimen>
<!-- left or right padding of label alignment --> <!-- 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_height">80sp</dimen>
<dimen name="key_preview_offset">0.000in</dimen> <dimen name="key_preview_offset">0.000in</dimen>
<dimen name="key_preview_text_size_large">36sp</dimen> <dimen name="key_preview_text_size_large">36sp</dimen>

View File

@ -21,7 +21,8 @@
<Keyboard <Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:keyboardHeight="@dimen/keyboardHeight" latin:keyboardHeight="@dimen/keyboardHeight"
latin:maxKeyboardHeight="50%p" latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
latin:minKeyboardHeight="@fraction/minKeyboardHeight"
latin:rowHeight="25%p" latin:rowHeight="25%p"
latin:keyWidth="10%p" latin:keyWidth="10%p"
latin:horizontalGap="@dimen/key_horizontal_gap" latin:horizontalGap="@dimen/key_horizontal_gap"

View File

@ -21,7 +21,8 @@
<Keyboard <Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:keyboardHeight="@dimen/keyboardHeight" latin:keyboardHeight="@dimen/keyboardHeight"
latin:maxKeyboardHeight="50%p" latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
latin:minKeyboardHeight="@fraction/minKeyboardHeight"
latin:rowHeight="25%p" latin:rowHeight="25%p"
latin:keyWidth="10%p" latin:keyWidth="10%p"
latin:horizontalGap="@dimen/key_horizontal_gap" latin:horizontalGap="@dimen/key_horizontal_gap"

View File

@ -21,7 +21,8 @@
<Keyboard <Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:keyboardHeight="@dimen/keyboardHeight" latin:keyboardHeight="@dimen/keyboardHeight"
latin:maxKeyboardHeight="50%p" latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
latin:minKeyboardHeight="@fraction/minKeyboardHeight"
latin:rowHeight="25%p" latin:rowHeight="25%p"
latin:horizontalGap="@dimen/key_horizontal_gap" latin:horizontalGap="@dimen/key_horizontal_gap"
latin:verticalGap="@dimen/key_bottom_gap" latin:verticalGap="@dimen/key_bottom_gap"

View File

@ -21,7 +21,8 @@
<Keyboard <Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:keyboardHeight="@dimen/keyboardHeight" latin:keyboardHeight="@dimen/keyboardHeight"
latin:maxKeyboardHeight="50%p" latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
latin:minKeyboardHeight="@fraction/minKeyboardHeight"
latin:rowHeight="25%p" latin:rowHeight="25%p"
latin:keyWidth="10%p" latin:keyWidth="10%p"
latin:horizontalGap="@dimen/key_horizontal_gap" latin:horizontalGap="@dimen/key_horizontal_gap"

View File

@ -21,7 +21,8 @@
<Keyboard <Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:keyboardHeight="@dimen/keyboardHeight" latin:keyboardHeight="@dimen/keyboardHeight"
latin:maxKeyboardHeight="50%p" latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
latin:minKeyboardHeight="@fraction/minKeyboardHeight"
latin:rowHeight="25%p" latin:rowHeight="25%p"
latin:horizontalGap="@dimen/key_horizontal_gap" latin:horizontalGap="@dimen/key_horizontal_gap"
latin:verticalGap="@dimen/key_bottom_gap" latin:verticalGap="@dimen/key_bottom_gap"

View File

@ -21,7 +21,8 @@
<Keyboard <Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:keyboardHeight="@dimen/keyboardHeight" latin:keyboardHeight="@dimen/keyboardHeight"
latin:maxKeyboardHeight="50%p" latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
latin:minKeyboardHeight="@fraction/minKeyboardHeight"
latin:rowHeight="25%p" latin:rowHeight="25%p"
latin:keyWidth="10%p" latin:keyWidth="10%p"
latin:horizontalGap="@dimen/key_horizontal_gap" latin:horizontalGap="@dimen/key_horizontal_gap"

View File

@ -21,7 +21,8 @@
<Keyboard <Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:keyboardHeight="@dimen/keyboardHeight" latin:keyboardHeight="@dimen/keyboardHeight"
latin:maxKeyboardHeight="50%p" latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
latin:minKeyboardHeight="@fraction/minKeyboardHeight"
latin:rowHeight="25%p" latin:rowHeight="25%p"
latin:keyWidth="10%p" latin:keyWidth="10%p"
latin:horizontalGap="@dimen/key_horizontal_gap" latin:horizontalGap="@dimen/key_horizontal_gap"

View File

@ -21,7 +21,8 @@
<Keyboard <Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:keyboardHeight="@dimen/keyboardHeight" latin:keyboardHeight="@dimen/keyboardHeight"
latin:maxKeyboardHeight="50%p" latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
latin:minKeyboardHeight="@fraction/minKeyboardHeight"
latin:rowHeight="25%p" latin:rowHeight="25%p"
latin:keyWidth="10%p" latin:keyWidth="10%p"
latin:horizontalGap="@dimen/key_horizontal_gap" latin:horizontalGap="@dimen/key_horizontal_gap"

View File

@ -21,7 +21,8 @@
<Keyboard <Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:keyboardHeight="@dimen/keyboardHeight" latin:keyboardHeight="@dimen/keyboardHeight"
latin:maxKeyboardHeight="50%p" latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
latin:minKeyboardHeight="@fraction/minKeyboardHeight"
latin:rowHeight="25%p" latin:rowHeight="25%p"
latin:keyWidth="10%p" latin:keyWidth="10%p"
latin:horizontalGap="@dimen/key_horizontal_gap" latin:horizontalGap="@dimen/key_horizontal_gap"

View File

@ -21,7 +21,8 @@
<Keyboard <Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:keyboardHeight="@dimen/keyboardHeight" latin:keyboardHeight="@dimen/keyboardHeight"
latin:maxKeyboardHeight="50%p" latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
latin:minKeyboardHeight="@fraction/minKeyboardHeight"
latin:rowHeight="25%p" latin:rowHeight="25%p"
latin:keyWidth="10%p" latin:keyWidth="10%p"
latin:horizontalGap="@dimen/key_horizontal_gap" latin:horizontalGap="@dimen/key_horizontal_gap"

View File

@ -21,7 +21,8 @@
<Keyboard <Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:keyboardHeight="@dimen/keyboardHeight" latin:keyboardHeight="@dimen/keyboardHeight"
latin:maxKeyboardHeight="50%p" latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
latin:minKeyboardHeight="@fraction/minKeyboardHeight"
latin:rowHeight="25%p" latin:rowHeight="25%p"
latin:horizontalGap="@dimen/key_horizontal_gap" latin:horizontalGap="@dimen/key_horizontal_gap"
latin:verticalGap="@dimen/key_bottom_gap" latin:verticalGap="@dimen/key_bottom_gap"

View File

@ -21,7 +21,8 @@
<Keyboard <Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:keyboardHeight="@dimen/keyboardHeight" latin:keyboardHeight="@dimen/keyboardHeight"
latin:maxKeyboardHeight="50%p" latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
latin:minKeyboardHeight="@fraction/minKeyboardHeight"
latin:rowHeight="25%p" latin:rowHeight="25%p"
latin:horizontalGap="@dimen/key_horizontal_gap" latin:horizontalGap="@dimen/key_horizontal_gap"
latin:verticalGap="@dimen/key_bottom_gap" latin:verticalGap="@dimen/key_bottom_gap"

View File

@ -21,7 +21,8 @@
<Keyboard <Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:keyboardHeight="@dimen/keyboardHeight" latin:keyboardHeight="@dimen/keyboardHeight"
latin:maxKeyboardHeight="50%p" latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
latin:minKeyboardHeight="@fraction/minKeyboardHeight"
latin:rowHeight="25%p" latin:rowHeight="25%p"
latin:horizontalGap="@dimen/key_horizontal_gap" latin:horizontalGap="@dimen/key_horizontal_gap"
latin:verticalGap="@dimen/key_bottom_gap" latin:verticalGap="@dimen/key_bottom_gap"

View File

@ -21,7 +21,8 @@
<Keyboard <Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:keyboardHeight="@dimen/keyboardHeight" latin:keyboardHeight="@dimen/keyboardHeight"
latin:maxKeyboardHeight="50%p" latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
latin:minKeyboardHeight="@fraction/minKeyboardHeight"
latin:rowHeight="25%p" latin:rowHeight="25%p"
latin:horizontalGap="@dimen/key_horizontal_gap" latin:horizontalGap="@dimen/key_horizontal_gap"
latin:verticalGap="@dimen/key_bottom_gap" latin:verticalGap="@dimen/key_bottom_gap"

View File

@ -21,7 +21,8 @@
<Keyboard <Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:keyboardHeight="@dimen/keyboardHeight" latin:keyboardHeight="@dimen/keyboardHeight"
latin:maxKeyboardHeight="50%p" latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
latin:minKeyboardHeight="@fraction/minKeyboardHeight"
latin:rowHeight="25%p" latin:rowHeight="25%p"
latin:keyWidth="11.949%p" latin:keyWidth="11.949%p"
latin:horizontalGap="@dimen/key_horizontal_gap" latin:horizontalGap="@dimen/key_horizontal_gap"

View File

@ -21,7 +21,8 @@
<Keyboard <Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:keyboardHeight="@dimen/keyboardHeight" latin:keyboardHeight="@dimen/keyboardHeight"
latin:maxKeyboardHeight="50%p" latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
latin:minKeyboardHeight="@fraction/minKeyboardHeight"
latin:rowHeight="25%p" latin:rowHeight="25%p"
latin:keyWidth="11.949%p" latin:keyWidth="11.949%p"
latin:horizontalGap="@dimen/key_horizontal_gap" latin:horizontalGap="@dimen/key_horizontal_gap"

View File

@ -21,7 +21,8 @@
<Keyboard <Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:keyboardHeight="@dimen/keyboardHeight" latin:keyboardHeight="@dimen/keyboardHeight"
latin:maxKeyboardHeight="50%p" latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
latin:minKeyboardHeight="@fraction/minKeyboardHeight"
latin:rowHeight="25%p" latin:rowHeight="25%p"
latin:keyWidth="11.949%p" latin:keyWidth="11.949%p"
latin:horizontalGap="@dimen/key_horizontal_gap" latin:horizontalGap="@dimen/key_horizontal_gap"

View File

@ -21,7 +21,8 @@
<Keyboard <Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:keyboardHeight="@dimen/keyboardHeight" latin:keyboardHeight="@dimen/keyboardHeight"
latin:maxKeyboardHeight="50%p" latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
latin:minKeyboardHeight="@fraction/minKeyboardHeight"
latin:rowHeight="25%p" latin:rowHeight="25%p"
latin:horizontalGap="@dimen/key_horizontal_gap" latin:horizontalGap="@dimen/key_horizontal_gap"
latin:verticalGap="@dimen/key_bottom_gap" latin:verticalGap="@dimen/key_bottom_gap"

View File

@ -21,7 +21,8 @@
<Keyboard <Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:keyboardHeight="@dimen/keyboardHeight" latin:keyboardHeight="@dimen/keyboardHeight"
latin:maxKeyboardHeight="50%p" latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
latin:minKeyboardHeight="@fraction/minKeyboardHeight"
latin:rowHeight="25%p" latin:rowHeight="25%p"
latin:horizontalGap="@dimen/key_horizontal_gap" latin:horizontalGap="@dimen/key_horizontal_gap"
latin:verticalGap="@dimen/key_bottom_gap" latin:verticalGap="@dimen/key_bottom_gap"

View File

@ -21,7 +21,8 @@
<Keyboard <Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:keyboardHeight="@dimen/keyboardHeight" latin:keyboardHeight="@dimen/keyboardHeight"
latin:maxKeyboardHeight="50%p" latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
latin:minKeyboardHeight="@fraction/minKeyboardHeight"
latin:rowHeight="25%p" latin:rowHeight="25%p"
latin:keyWidth="26.67%p" latin:keyWidth="26.67%p"
latin:horizontalGap="@dimen/key_horizontal_gap" latin:horizontalGap="@dimen/key_horizontal_gap"

View File

@ -21,7 +21,8 @@
<Keyboard <Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:keyboardHeight="@dimen/keyboardHeight" latin:keyboardHeight="@dimen/keyboardHeight"
latin:maxKeyboardHeight="50%p" latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
latin:minKeyboardHeight="@fraction/minKeyboardHeight"
latin:rowHeight="25%p" latin:rowHeight="25%p"
latin:keyWidth="26.67%p" latin:keyWidth="26.67%p"
latin:horizontalGap="@dimen/key_horizontal_gap" latin:horizontalGap="@dimen/key_horizontal_gap"

View File

@ -21,7 +21,8 @@
<Keyboard <Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:keyboardHeight="@dimen/keyboardHeight" latin:keyboardHeight="@dimen/keyboardHeight"
latin:maxKeyboardHeight="50%p" latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
latin:minKeyboardHeight="@fraction/minKeyboardHeight"
latin:rowHeight="25%p" latin:rowHeight="25%p"
latin:keyWidth="26.67%p" latin:keyWidth="26.67%p"
latin:horizontalGap="@dimen/key_horizontal_gap" latin:horizontalGap="@dimen/key_horizontal_gap"

View File

@ -21,7 +21,8 @@
<Keyboard <Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:keyboardHeight="@dimen/keyboardHeight" latin:keyboardHeight="@dimen/keyboardHeight"
latin:maxKeyboardHeight="50%p" latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
latin:minKeyboardHeight="@fraction/minKeyboardHeight"
latin:rowHeight="25%p" latin:rowHeight="25%p"
latin:keyWidth="10%p" latin:keyWidth="10%p"
latin:horizontalGap="@dimen/key_horizontal_gap" latin:horizontalGap="@dimen/key_horizontal_gap"

View File

@ -21,7 +21,8 @@
<Keyboard <Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:keyboardHeight="@dimen/keyboardHeight" latin:keyboardHeight="@dimen/keyboardHeight"
latin:maxKeyboardHeight="50%p" latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
latin:minKeyboardHeight="@fraction/minKeyboardHeight"
latin:rowHeight="25%p" latin:rowHeight="25%p"
latin:keyWidth="10%p" latin:keyWidth="10%p"
latin:horizontalGap="@dimen/key_horizontal_gap" latin:horizontalGap="@dimen/key_horizontal_gap"

View File

@ -21,7 +21,8 @@
<Keyboard <Keyboard
xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin" xmlns:latin="http://schemas.android.com/apk/res/com.android.inputmethod.latin"
latin:keyboardHeight="@dimen/keyboardHeight" latin:keyboardHeight="@dimen/keyboardHeight"
latin:maxKeyboardHeight="50%p" latin:maxKeyboardHeight="@fraction/maxKeyboardHeight"
latin:minKeyboardHeight="@fraction/minKeyboardHeight"
latin:rowHeight="25%p" latin:rowHeight="25%p"
latin:keyWidth="10%p" latin:keyWidth="10%p"
latin:horizontalGap="@dimen/key_horizontal_gap" latin:horizontalGap="@dimen/key_horizontal_gap"

View File

@ -143,9 +143,9 @@ public class Key {
* This constructor is being used only for key in mini popup keyboard. * This constructor is being used only for key in mini popup keyboard.
*/ */
public Key(Resources res, Keyboard keyboard, CharSequence popupCharacter, int x, int y, public Key(Resources res, Keyboard keyboard, CharSequence popupCharacter, int x, int y,
int width, int edgeFlags) { int width, int height, int edgeFlags) {
mKeyboard = keyboard; mKeyboard = keyboard;
mHeight = keyboard.getRowHeight() - keyboard.getVerticalGap(); mHeight = height - keyboard.getVerticalGap();
mGap = keyboard.getHorizontalGap(); mGap = keyboard.getHorizontalGap();
mVisualInsetsLeft = mVisualInsetsRight = 0; mVisualInsetsLeft = mVisualInsetsRight = 0;
mWidth = width - mGap; mWidth = width - mGap;

View File

@ -196,9 +196,20 @@ public class KeyboardParser {
final int keyboardHeight = (int)keyboardAttr.getDimension( final int keyboardHeight = (int)keyboardAttr.getDimension(
R.styleable.Keyboard_keyboardHeight, displayHeight / 2); R.styleable.Keyboard_keyboardHeight, displayHeight / 2);
final int maxKeyboardHeight = getDimensionOrFraction(keyboardAttr, final int maxKeyboardHeight = getDimensionOrFraction(keyboardAttr,
R.styleable.Keyboard_maxKeyboardHeight, displayHeight, displayHeight / 2); R.styleable.Keyboard_maxKeyboardHeight, displayHeight, displayHeight / 2);
// Keyboard height will not exceed maxKeyboardHeight. int minKeyboardHeight = getDimensionOrFraction(keyboardAttr,
final int height = Math.min(keyboardHeight, maxKeyboardHeight); 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(); final int width = keyboard.getDisplayWidth();
keyboard.setKeyboardHeight(height); keyboard.setKeyboardHeight(height);

View File

@ -1078,7 +1078,7 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
}); });
final Keyboard keyboard = new MiniKeyboardBuilder(this, mKeyboard.getPopupKeyboardResId(), final Keyboard keyboard = new MiniKeyboardBuilder(this, mKeyboard.getPopupKeyboardResId(),
parentKey).build(); parentKey, mKeyboard).build();
miniKeyboardView.setKeyboard(keyboard); miniKeyboardView.setKeyboard(keyboard);
container.measure(MeasureSpec.makeMeasureSpec(getWidth(), MeasureSpec.AT_MOST), container.measure(MeasureSpec.makeMeasureSpec(getWidth(), MeasureSpec.AT_MOST),

View File

@ -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(); final Context context = view.getContext();
mRes = context.getResources(); mRes = context.getResources();
final MiniKeyboard keyboard = new MiniKeyboard(context, layoutTemplateResId, null); final MiniKeyboard keyboard = new MiniKeyboard(context, layoutTemplateResId, null);
@ -191,12 +192,13 @@ public class MiniKeyboardBuilder {
final int keyWidth = getMaxKeyWidth(view, mPopupCharacters, keyboard.getKeyWidth()); final int keyWidth = getMaxKeyWidth(view, mPopupCharacters, keyboard.getKeyWidth());
final MiniKeyboardLayoutParams params = new MiniKeyboardLayoutParams( final MiniKeyboardLayoutParams params = new MiniKeyboardLayoutParams(
mPopupCharacters.length, parentKey.mMaxPopupColumn, mPopupCharacters.length, parentKey.mMaxPopupColumn,
keyWidth, keyboard.getRowHeight(), keyWidth, parentKeyboard.getRowHeight(),
parentKey.mX + (parentKey.mWidth + parentKey.mGap) / 2 - keyWidth / 2, parentKey.mX + (parentKey.mWidth + parentKey.mGap) / 2 - keyWidth / 2,
view.getMeasuredWidth()); view.getMeasuredWidth());
mParams = params; 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.setMinWidth(params.mNumColumns * params.mKeyWidth);
keyboard.setDefaultCoordX(params.getDefaultKeyCoordX() + params.mKeyWidth / 2); keyboard.setDefaultCoordX(params.getDefaultKeyCoordX() + params.mKeyWidth / 2);
} }
@ -235,7 +237,7 @@ public class MiniKeyboardBuilder {
final CharSequence label = mPopupCharacters[n]; final CharSequence label = mPopupCharacters[n];
final int row = n / params.mNumColumns; final int row = n / params.mNumColumns;
final Key key = new Key(mRes, keyboard, label, params.getX(n, row), params.getY(row), 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); keys.add(key);
} }
return keyboard; return keyboard;