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

This commit is contained in:
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_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">15</integer>
<integer name="config_delay_before_preview">0</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_fadein_anim_time">0</integer>
<integer name="config_mini_keyboard_fadeout_anim_time">100</integer> <integer name="config_mini_keyboard_fadeout_anim_time">100</integer>
<integer name="config_delay_before_key_repeat_start">400</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. // we should reset the text fade factor. It is also applicable to shortcut key.
keyboard.setSpacebarTextFadeFactor(0.0f, null); keyboard.setSpacebarTextFadeFactor(0.0f, null);
keyboard.updateShortcutKey(mSubtypeSwitcher.isShortcutImeReady(), null); keyboard.updateShortcutKey(mSubtypeSwitcher.isShortcutImeReady(), null);
keyboard.setSpacebarSlidingLanguageSwitchDiff(0);
return keyboard; return keyboard;
} }

View file

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

View file

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