Merge remote-tracking branch 'goog/master' into merge

main
satok 2011-04-22 18:35:19 +09:00
commit a055c82ee9
4 changed files with 14 additions and 9 deletions

View File

@ -53,7 +53,7 @@
<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_delay_before_preview">0</integer>
<integer name="config_delay_after_preview">10</integer>
<integer name="config_delay_after_preview">60</integer>
<integer name="config_mini_keyboard_fadein_anim_time">0</integer>
<integer name="config_mini_keyboard_fadeout_anim_time">100</integer>
<integer name="config_delay_before_key_repeat_start">400</integer>

View File

@ -190,6 +190,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
// we should reset the text fade factor. It is also applicable to shortcut key.
keyboard.setSpacebarTextFadeFactor(0.0f, null);
keyboard.updateShortcutKey(mSubtypeSwitcher.isShortcutImeReady(), null);
keyboard.setSpacebarSlidingLanguageSwitchDiff(0);
return keyboard;
}

View File

@ -64,7 +64,7 @@ public class LatinKeyboard extends Keyboard {
private final int mSpacebarTextShadowColor;
private float mSpacebarTextFadeFactor = 0.0f;
private final int mSpacebarLanguageSwitchThreshold;
private int mSpacebarLanguageSwitchDiff;
private int mSpacebarSlidingLanguageSwitchDiff;
private SlidingLocaleDrawable mSlidingLocaleIcon;
private final HashMap<Integer, SoftReference<BitmapDrawable>> mSpaceDrawableCache =
new HashMap<Integer, SoftReference<BitmapDrawable>>();
@ -323,10 +323,14 @@ public class LatinKeyboard extends Keyboard {
return buffer;
}
public void setSpacebarSlidingLanguageSwitchDiff(int diff) {
mSpacebarSlidingLanguageSwitchDiff = diff;
}
public void updateSpacebarPreviewIcon(int diff) {
if (mSpacebarLanguageSwitchDiff == diff)
if (mSpacebarSlidingLanguageSwitchDiff == diff)
return;
mSpacebarLanguageSwitchDiff = diff;
mSpacebarSlidingLanguageSwitchDiff = diff;
if (mSlidingLocaleIcon == null) {
final int width = Math.max(mSpaceKey.mWidth,
(int)(getMinWidth() * SPACEBAR_POPUP_MIN_RATIO));
@ -366,15 +370,16 @@ public class LatinKeyboard extends Keyboard {
return false;
// The language switcher will be displayed only when the dragging distance is greater
// than the threshold.
return shouldTriggerSpacebarSlidingLanguageSwitch(mSpacebarLanguageSwitchDiff);
return shouldTriggerSpacebarSlidingLanguageSwitch(mSpacebarSlidingLanguageSwitchDiff);
}
public int getLanguageChangeDirection() {
if (mSpaceKey == null || mSubtypeSwitcher.getEnabledKeyboardLocaleCount() <= 1 || Math.abs(
mSpacebarLanguageSwitchDiff) < getMostCommonKeyWidth() * SPACEBAR_DRAG_WIDTH) {
if (mSpaceKey == null || mSubtypeSwitcher.getEnabledKeyboardLocaleCount() <= 1
|| Math.abs(mSpacebarSlidingLanguageSwitchDiff)
< getMostCommonKeyWidth() * SPACEBAR_DRAG_WIDTH) {
return 0; // No change
}
return mSpacebarLanguageSwitchDiff > 0 ? 1 : -1;
return mSpacebarSlidingLanguageSwitchDiff > 0 ? 1 : -1;
}
@Override

View File

@ -541,7 +541,6 @@ public class PointerTracker {
// This will change keyboard layout.
mListener.onCodeInput(code, new int[] {code}, keyX, keyY);
}
((LatinKeyboard)mKeyboard).updateSpacebarPreviewIcon(0);
mIsInSlidingLanguageSwitch = false;
return;
}