resolved conflicts for merge of fd64e47c
to master
Change-Id: I07434c251fafa5eee548a54dae30d91df3a24085main
commit
39004972b1
|
@ -0,0 +1,27 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
/*
|
||||||
|
**
|
||||||
|
** Copyright 2010, The Android Open Source Project
|
||||||
|
**
|
||||||
|
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
** you may not use this file except in compliance with the License.
|
||||||
|
** You may obtain a copy of the License at
|
||||||
|
**
|
||||||
|
** http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
**
|
||||||
|
** Unless required by applicable law or agreed to in writing, software
|
||||||
|
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
** See the License for the specific language governing permissions and
|
||||||
|
** limitations under the License.
|
||||||
|
*/
|
||||||
|
-->
|
||||||
|
|
||||||
|
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:keyWidth="9.45%p"
|
||||||
|
android:horizontalGap="0px"
|
||||||
|
android:verticalGap="0px"
|
||||||
|
android:keyHeight="@dimen/key_height"
|
||||||
|
>
|
||||||
|
</Keyboard>
|
|
@ -70,7 +70,7 @@
|
||||||
<Key
|
<Key
|
||||||
latin:keyLabel="o"
|
latin:keyLabel="o"
|
||||||
latin:keyHintIcon="@drawable/keyboard_hint_9"
|
latin:keyHintIcon="@drawable/keyboard_hint_9"
|
||||||
latin:popupKeyboard="@xml/kbd_popup_template"
|
latin:popupKeyboard="@xml/kbd_popup_narrow_template"
|
||||||
latin:popupCharacters="@string/alternates_for_o" />
|
latin:popupCharacters="@string/alternates_for_o" />
|
||||||
<Key
|
<Key
|
||||||
latin:keyLabel="p"
|
latin:keyLabel="p"
|
||||||
|
|
|
@ -70,7 +70,7 @@
|
||||||
<Key
|
<Key
|
||||||
latin:keyLabel="o"
|
latin:keyLabel="o"
|
||||||
latin:keyHintIcon="@drawable/keyboard_hint_9"
|
latin:keyHintIcon="@drawable/keyboard_hint_9"
|
||||||
latin:popupKeyboard="@xml/kbd_popup_template"
|
latin:popupKeyboard="@xml/kbd_popup_narrow_template"
|
||||||
latin:popupCharacters="@string/alternates_for_o" />
|
latin:popupCharacters="@string/alternates_for_o" />
|
||||||
<Key
|
<Key
|
||||||
latin:keyLabel="p"
|
latin:keyLabel="p"
|
||||||
|
|
|
@ -1101,8 +1101,7 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
|
||||||
return container;
|
return container;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isOneRowKeyboard(BaseKeyboard keyboard) {
|
private static boolean isOneRowKeys(List<Key> keys) {
|
||||||
final List<Key> keys = keyboard.getKeys();
|
|
||||||
if (keys.size() == 0) return false;
|
if (keys.size() == 0) return false;
|
||||||
final int edgeFlags = keys.get(0).edgeFlags;
|
final int edgeFlags = keys.get(0).edgeFlags;
|
||||||
// HACK: The first key of mini keyboard which was inflated from xml and has multiple rows,
|
// HACK: The first key of mini keyboard which was inflated from xml and has multiple rows,
|
||||||
|
@ -1140,24 +1139,35 @@ public class LatinKeyboardBaseView extends View implements PointerTracker.UIProx
|
||||||
getLocationInWindow(mWindowOffset);
|
getLocationInWindow(mWindowOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get width of a key in the mini popup keyboard = "miniKeyWidth".
|
||||||
|
// On the other hand, "popupKey.width" is width of the pressed key on the main keyboard.
|
||||||
|
// We adjust the position of mini popup keyboard with the edge key in it:
|
||||||
|
// a) When we have the leftmost key in popup keyboard directly above the pressed key
|
||||||
|
// Right edges of both keys should be aligned for consistent default selection
|
||||||
|
// b) When we have the rightmost key in popup keyboard directly above the pressed key
|
||||||
|
// Left edges of both keys should be aligned for consistent default selection
|
||||||
|
final List<Key> miniKeys = mMiniKeyboard.getKeyboard().getKeys();
|
||||||
|
final int miniKeyWidth = miniKeys.size() > 0 ? miniKeys.get(0).width : 0;
|
||||||
|
|
||||||
// HACK: Have the leftmost number in the popup characters right above the key
|
// HACK: Have the leftmost number in the popup characters right above the key
|
||||||
boolean isNumberAtLeftmost =
|
boolean isNumberAtLeftmost =
|
||||||
hasMultiplePopupChars(popupKey) && isNumberAtLeftmostPopupChar(popupKey);
|
hasMultiplePopupChars(popupKey) && isNumberAtLeftmostPopupChar(popupKey);
|
||||||
int popupX = popupKey.x + mWindowOffset[0];
|
int popupX = popupKey.x + mWindowOffset[0];
|
||||||
int popupY = popupKey.y + mWindowOffset[1];
|
popupX += getPaddingLeft();
|
||||||
if (isNumberAtLeftmost) {
|
if (isNumberAtLeftmost) {
|
||||||
|
popupX += popupKey.width - miniKeyWidth; // adjustment for a) described above
|
||||||
popupX -= container.getPaddingLeft();
|
popupX -= container.getPaddingLeft();
|
||||||
} else {
|
} else {
|
||||||
popupX += popupKey.width + getPaddingLeft();
|
popupX += miniKeyWidth; // adjustment for b) described above
|
||||||
popupX -= container.getMeasuredWidth();
|
popupX -= container.getMeasuredWidth();
|
||||||
popupX += container.getPaddingRight();
|
popupX += container.getPaddingRight();
|
||||||
}
|
}
|
||||||
|
int popupY = popupKey.y + mWindowOffset[1];
|
||||||
popupY += getPaddingTop();
|
popupY += getPaddingTop();
|
||||||
popupY -= container.getMeasuredHeight();
|
popupY -= container.getMeasuredHeight();
|
||||||
popupY += container.getPaddingBottom();
|
popupY += container.getPaddingBottom();
|
||||||
final int x = popupX;
|
final int x = popupX;
|
||||||
final int y = mShowPreview && isOneRowKeyboard(mMiniKeyboard.getKeyboard())
|
final int y = mShowPreview && isOneRowKeys(miniKeys) ? mPopupPreviewDisplayedY : popupY;
|
||||||
? mPopupPreviewDisplayedY : popupY;
|
|
||||||
|
|
||||||
int adjustedX = x;
|
int adjustedX = x;
|
||||||
if (x < 0) {
|
if (x < 0) {
|
||||||
|
|
Loading…
Reference in New Issue