Merge remote-tracking branch 'goog/master' into merge
This commit is contained in:
commit
c55aaaf26e
7 changed files with 45 additions and 25 deletions
|
@ -49,9 +49,9 @@
|
||||||
<!-- Showing mini keyboard, just above the touched point if true, aligned to the key if false -->
|
<!-- Showing mini keyboard, just above the touched point if true, aligned to the key if false -->
|
||||||
<bool name="config_show_mini_keyboard_at_touched_point">false</bool>
|
<bool name="config_show_mini_keyboard_at_touched_point">false</bool>
|
||||||
<!-- The language is never displayed if == 0, always displayed if < 0 -->
|
<!-- The language is never displayed if == 0, always displayed if < 0 -->
|
||||||
<integer name="config_delay_before_fadeout_language_on_spacebar">-1</integer>
|
<integer name="config_delay_before_fadeout_language_on_spacebar">1200</integer>
|
||||||
<integer name="config_duration_of_fadeout_language_on_spacebar">50</integer>
|
<integer name="config_duration_of_fadeout_language_on_spacebar">50</integer>
|
||||||
<integer name="config_final_fadeout_percentage_of_language_on_spacebar">15</integer>
|
<integer name="config_final_fadeout_percentage_of_language_on_spacebar">50</integer>
|
||||||
<integer name="config_delay_before_preview">0</integer>
|
<integer name="config_delay_before_preview">0</integer>
|
||||||
<integer name="config_delay_after_preview">60</integer>
|
<integer name="config_delay_after_preview">60</integer>
|
||||||
<integer name="config_mini_keyboard_fadein_anim_time">0</integer>
|
<integer name="config_mini_keyboard_fadein_anim_time">0</integer>
|
||||||
|
|
|
@ -87,7 +87,7 @@
|
||||||
latin:keyEdgeFlags="right" />
|
latin:keyEdgeFlags="right" />
|
||||||
</Row>
|
</Row>
|
||||||
<Row
|
<Row
|
||||||
latin:keyWidth="10%p"
|
latin:keyWidth="9.7%p"
|
||||||
>
|
>
|
||||||
<Key
|
<Key
|
||||||
latin:keyLabel="ظ"
|
latin:keyLabel="ظ"
|
||||||
|
@ -112,7 +112,7 @@
|
||||||
latin:keyLabel="ث" />
|
latin:keyLabel="ث" />
|
||||||
<Key
|
<Key
|
||||||
latin:keyStyle="deleteKeyStyle"
|
latin:keyStyle="deleteKeyStyle"
|
||||||
latin:visualInsetsLeft="2%p"
|
latin:keyWidth="12%p"
|
||||||
latin:keyEdgeFlags="right" />
|
latin:keyEdgeFlags="right" />
|
||||||
</Row>
|
</Row>
|
||||||
<include latin:keyboardLayout="@xml/kbd_qwerty_row4" />
|
<include latin:keyboardLayout="@xml/kbd_qwerty_row4" />
|
||||||
|
|
|
@ -83,6 +83,7 @@ public class LanguageSwitcher {
|
||||||
String currentLanguage = sp.getString(Settings.PREF_INPUT_LANGUAGE, null);
|
String currentLanguage = sp.getString(Settings.PREF_INPUT_LANGUAGE, null);
|
||||||
if (TextUtils.isEmpty(selectedLanguages)) {
|
if (TextUtils.isEmpty(selectedLanguages)) {
|
||||||
mSelectedLanguageArray = EMPTY_STIRNG_ARRAY;
|
mSelectedLanguageArray = EMPTY_STIRNG_ARRAY;
|
||||||
|
mSelectedLanguages = null;
|
||||||
loadDefaults();
|
loadDefaults();
|
||||||
if (mLocales.size() == 0) {
|
if (mLocales.size() == 0) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -139,6 +139,7 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
|
||||||
|
|
||||||
private final boolean mHasDistinctMultitouch;
|
private final boolean mHasDistinctMultitouch;
|
||||||
private int mOldPointerCount = 1;
|
private int mOldPointerCount = 1;
|
||||||
|
private int mOldKeyIndex;
|
||||||
|
|
||||||
// Accessibility
|
// Accessibility
|
||||||
private boolean mIsAccessibilityEnabled;
|
private boolean mIsAccessibilityEnabled;
|
||||||
|
@ -202,7 +203,7 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
|
||||||
break;
|
break;
|
||||||
case MSG_REPEAT_KEY: {
|
case MSG_REPEAT_KEY: {
|
||||||
final PointerTracker tracker = (PointerTracker)msg.obj;
|
final PointerTracker tracker = (PointerTracker)msg.obj;
|
||||||
tracker.repeatKey(msg.arg1);
|
tracker.onRepeatKey(msg.arg1);
|
||||||
startKeyRepeatTimer(mKeyRepeatInterval, msg.arg1, tracker);
|
startKeyRepeatTimer(mKeyRepeatInterval, msg.arg1, tracker);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1270,10 +1271,6 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mHandler.isInKeyRepeat()) {
|
if (mHandler.isInKeyRepeat()) {
|
||||||
// It will keep being in the key repeating mode while the key is being pressed.
|
|
||||||
if (action == MotionEvent.ACTION_MOVE) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
final PointerTracker tracker = getPointerTracker(id);
|
final PointerTracker tracker = getPointerTracker(id);
|
||||||
// Key repeating timer will be canceled if 2 or more keys are in action, and current
|
// Key repeating timer will be canceled if 2 or more keys are in action, and current
|
||||||
// event (UP or DOWN) is non-modifier key.
|
// event (UP or DOWN) is non-modifier key.
|
||||||
|
@ -1291,12 +1288,21 @@ public class KeyboardView extends View implements PointerTracker.UIProxy {
|
||||||
PointerTracker tracker = getPointerTracker(0);
|
PointerTracker tracker = getPointerTracker(0);
|
||||||
if (pointerCount == 1 && oldPointerCount == 2) {
|
if (pointerCount == 1 && oldPointerCount == 2) {
|
||||||
// Multi-touch to single touch transition.
|
// Multi-touch to single touch transition.
|
||||||
// Send a down event for the latest pointer.
|
// Send a down event for the latest pointer if the key is different from the
|
||||||
|
// previous key.
|
||||||
|
final int newKeyIndex = tracker.getKeyIndexOn(x, y);
|
||||||
|
if (mOldKeyIndex != newKeyIndex) {
|
||||||
tracker.onDownEvent(x, y, eventTime, null);
|
tracker.onDownEvent(x, y, eventTime, null);
|
||||||
|
if (action == MotionEvent.ACTION_UP)
|
||||||
|
tracker.onUpEvent(x, y, eventTime, null);
|
||||||
|
}
|
||||||
} else if (pointerCount == 2 && oldPointerCount == 1) {
|
} else if (pointerCount == 2 && oldPointerCount == 1) {
|
||||||
// Single-touch to multi-touch transition.
|
// Single-touch to multi-touch transition.
|
||||||
// Send an up event for the last pointer.
|
// Send an up event for the last pointer.
|
||||||
tracker.onUpEvent(tracker.getLastX(), tracker.getLastY(), eventTime, null);
|
final int lastX = tracker.getLastX();
|
||||||
|
final int lastY = tracker.getLastY();
|
||||||
|
mOldKeyIndex = tracker.getKeyIndexOn(lastX, lastY);
|
||||||
|
tracker.onUpEvent(lastX, lastY, eventTime, null);
|
||||||
} else if (pointerCount == 1 && oldPointerCount == 1) {
|
} else if (pointerCount == 1 && oldPointerCount == 1) {
|
||||||
tracker.onTouchEvent(action, x, y, eventTime, null);
|
tracker.onTouchEvent(action, x, y, eventTime, null);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -131,8 +131,8 @@ public class LatinKeyboard extends Keyboard {
|
||||||
mSpaceAutoCorrectionIndicator = res.getDrawable(R.drawable.sym_keyboard_space_led);
|
mSpaceAutoCorrectionIndicator = res.getDrawable(R.drawable.sym_keyboard_space_led);
|
||||||
mButtonArrowLeftIcon = res.getDrawable(R.drawable.sym_keyboard_language_arrows_left);
|
mButtonArrowLeftIcon = res.getDrawable(R.drawable.sym_keyboard_language_arrows_left);
|
||||||
mButtonArrowRightIcon = res.getDrawable(R.drawable.sym_keyboard_language_arrows_right);
|
mButtonArrowRightIcon = res.getDrawable(R.drawable.sym_keyboard_language_arrows_right);
|
||||||
// The threshold is "key width" x 1.5
|
// The threshold is "key width" x 1.25
|
||||||
mSpacebarLanguageSwitchThreshold = (getMostCommonKeyWidth() * 3) / 2;
|
mSpacebarLanguageSwitchThreshold = (getMostCommonKeyWidth() * 5) / 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSpacebarTextFadeFactor(float fadeFactor, LatinKeyboardView view) {
|
public void setSpacebarTextFadeFactor(float fadeFactor, LatinKeyboardView view) {
|
||||||
|
|
|
@ -251,6 +251,10 @@ public class PointerTracker {
|
||||||
return key != null && key.mCode == Keyboard.CODE_SHIFT;
|
return key != null && key.mCode == Keyboard.CODE_SHIFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getKeyIndexOn(int x, int y) {
|
||||||
|
return mKeyDetector.getKeyIndexAndNearbyCodes(x, y, null);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isSpaceKey(int keyIndex) {
|
public boolean isSpaceKey(int keyIndex) {
|
||||||
Key key = getKey(keyIndex);
|
Key key = getKey(keyIndex);
|
||||||
return key != null && key.mCode == Keyboard.CODE_SPACE;
|
return key != null && key.mCode == Keyboard.CODE_SPACE;
|
||||||
|
@ -355,14 +359,7 @@ public class PointerTracker {
|
||||||
if (callListenerOnPressAndCheckKeyboardLayoutChange(getKey(keyIndex), false))
|
if (callListenerOnPressAndCheckKeyboardLayoutChange(getKey(keyIndex), false))
|
||||||
keyIndex = mKeyState.onDownKey(x, y, eventTime);
|
keyIndex = mKeyState.onDownKey(x, y, eventTime);
|
||||||
|
|
||||||
// Accessibility disables key repeat because users may need to pause on a key to hear
|
startRepeatKey(keyIndex);
|
||||||
// its spoken description.
|
|
||||||
final Key key = getKey(keyIndex);
|
|
||||||
if (key != null && key.mRepeatable && !mIsAccessibilityEnabled) {
|
|
||||||
repeatKey(keyIndex);
|
|
||||||
mHandler.startKeyRepeatTimer(mDelayBeforeKeyRepeatStart, keyIndex, this);
|
|
||||||
mIsRepeatableKey = true;
|
|
||||||
}
|
|
||||||
startLongPressTimer(keyIndex);
|
startLongPressTimer(keyIndex);
|
||||||
showKeyPreview(keyIndex);
|
showKeyPreview(keyIndex);
|
||||||
setPressedKeyGraphics(keyIndex);
|
setPressedKeyGraphics(keyIndex);
|
||||||
|
@ -414,7 +411,8 @@ public class PointerTracker {
|
||||||
setReleasedKeyGraphics(oldKeyIndex);
|
setReleasedKeyGraphics(oldKeyIndex);
|
||||||
callListenerOnRelease(oldKey, oldKey.mCode, true);
|
callListenerOnRelease(oldKey, oldKey.mCode, true);
|
||||||
startSlidingKeyInput(oldKey);
|
startSlidingKeyInput(oldKey);
|
||||||
mHandler.cancelLongPressTimers();
|
mHandler.cancelKeyTimers();
|
||||||
|
startRepeatKey(keyIndex);
|
||||||
if (mIsAllowedSlidingKeyInput) {
|
if (mIsAllowedSlidingKeyInput) {
|
||||||
// This onPress call may have changed keyboard layout. Those cases are detected
|
// This onPress call may have changed keyboard layout. Those cases are detected
|
||||||
// at {@link #setKeyboard}. In those cases, we should update keyIndex according
|
// at {@link #setKeyboard}. In those cases, we should update keyIndex according
|
||||||
|
@ -542,6 +540,7 @@ public class PointerTracker {
|
||||||
mListener.onCodeInput(code, new int[] {code}, keyX, keyY);
|
mListener.onCodeInput(code, new int[] {code}, keyX, keyY);
|
||||||
}
|
}
|
||||||
mIsInSlidingLanguageSwitch = false;
|
mIsInSlidingLanguageSwitch = false;
|
||||||
|
((LatinKeyboard)mKeyboard).setSpacebarSlidingLanguageSwitchDiff(0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!mIsRepeatableKey) {
|
if (!mIsRepeatableKey) {
|
||||||
|
@ -575,7 +574,21 @@ public class PointerTracker {
|
||||||
mIsInSlidingKeyInput = false;
|
mIsInSlidingKeyInput = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void repeatKey(int keyIndex) {
|
private void startRepeatKey(int keyIndex) {
|
||||||
|
// Accessibility disables key repeat because users may need to pause on a key to hear
|
||||||
|
// its spoken description.
|
||||||
|
final Key key = getKey(keyIndex);
|
||||||
|
if (key != null && key.mRepeatable && !mIsAccessibilityEnabled) {
|
||||||
|
dismissKeyPreview();
|
||||||
|
onRepeatKey(keyIndex);
|
||||||
|
mHandler.startKeyRepeatTimer(mDelayBeforeKeyRepeatStart, keyIndex, this);
|
||||||
|
mIsRepeatableKey = true;
|
||||||
|
} else {
|
||||||
|
mIsRepeatableKey = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onRepeatKey(int keyIndex) {
|
||||||
Key key = getKey(keyIndex);
|
Key key = getKey(keyIndex);
|
||||||
if (key != null) {
|
if (key != null) {
|
||||||
detectAndSendKey(keyIndex, key.mX, key.mY);
|
detectAndSendKey(keyIndex, key.mX, key.mY);
|
||||||
|
|
|
@ -35,7 +35,7 @@ public class PointerTrackerQueue {
|
||||||
if (t.isModifier()) {
|
if (t.isModifier()) {
|
||||||
oldestPos++;
|
oldestPos++;
|
||||||
} else {
|
} else {
|
||||||
t.onPhantomUpEvent(t.getLastX(), t.getLastY(), eventTime, false);
|
t.onPhantomUpEvent(t.getLastX(), t.getLastY(), eventTime, true);
|
||||||
queue.remove(oldestPos);
|
queue.remove(oldestPos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue