diff --git a/java/res/values/config.xml b/java/res/values/config.xml
index adfec4c25..11b92e7c3 100644
--- a/java/res/values/config.xml
+++ b/java/res/values/config.xml
@@ -35,6 +35,7 @@
-1
50
+ 15
0
10
0
diff --git a/java/src/com/android/inputmethod/keyboard/LatinKeyboard.java b/java/src/com/android/inputmethod/keyboard/LatinKeyboard.java
index db8934049..888375b93 100644
--- a/java/src/com/android/inputmethod/keyboard/LatinKeyboard.java
+++ b/java/src/com/android/inputmethod/keyboard/LatinKeyboard.java
@@ -70,7 +70,6 @@ public class LatinKeyboard extends Keyboard {
private static final float SPACEBAR_POPUP_MIN_RATIO = 0.4f;
// Height in space key the language name will be drawn. (proportional to space key height)
public static final float SPACEBAR_LANGUAGE_BASELINE = 0.6f;
- private static final float SPACEBAR_LANGUAGE_BASELINE_WITHOUT_ICON = 0.65f;
// If the full language name needs to be smaller than this value to be drawn on space key,
// its short language name will be used instead.
private static final float MINIMUM_SCALE_OF_LANGUAGE_NAME = 0.8f;
@@ -225,9 +224,12 @@ public class LatinKeyboard extends Keyboard {
allowVariableTextSize);
// Draw language text with shadow
- final float baseline = height * (mSpaceIcon != null ? SPACEBAR_LANGUAGE_BASELINE
- : SPACEBAR_LANGUAGE_BASELINE_WITHOUT_ICON);
+ // In case there is no space icon, we will place the language text at the center of
+ // spacebar.
final float descent = paint.descent();
+ final float textHeight = -paint.ascent() + descent;
+ final float baseline = (mSpaceIcon != null) ? height * SPACEBAR_LANGUAGE_BASELINE
+ : height / 2 + textHeight / 2;
paint.setColor(getSpacebarTextColor(mSpacebarTextShadowColor, mSpacebarTextFadeFactor));
canvas.drawText(language, width / 2, baseline - descent - 1, paint);
paint.setColor(getSpacebarTextColor(mSpacebarTextColor, mSpacebarTextFadeFactor));
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index b93b07ffb..bea44eef2 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -154,6 +154,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
private boolean mConfigSwipeDownDismissKeyboardEnabled;
private int mConfigDelayBeforeFadeoutLanguageOnSpacebar;
private int mConfigDurationOfFadeoutLanguageOnSpacebar;
+ private float mConfigFinalFadeoutFactorOfLanugageOnSpacebar;
private int mCorrectionMode;
private int mCommittedLength;
@@ -267,13 +268,16 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
break;
case MSG_FADEOUT_LANGUAGE_ON_SPACEBAR:
if (inputView != null)
- inputView.setSpacebarTextFadeFactor(0.5f, (LatinKeyboard)msg.obj);
+ inputView.setSpacebarTextFadeFactor(
+ (1.0f + mConfigFinalFadeoutFactorOfLanugageOnSpacebar) / 2,
+ (LatinKeyboard)msg.obj);
sendMessageDelayed(obtainMessage(MSG_DISMISS_LANGUAGE_ON_SPACEBAR, msg.obj),
mConfigDurationOfFadeoutLanguageOnSpacebar);
break;
case MSG_DISMISS_LANGUAGE_ON_SPACEBAR:
if (inputView != null)
- inputView.setSpacebarTextFadeFactor(0.0f, (LatinKeyboard)msg.obj);
+ inputView.setSpacebarTextFadeFactor(
+ mConfigFinalFadeoutFactorOfLanugageOnSpacebar, (LatinKeyboard)msg.obj);
break;
}
}
@@ -356,6 +360,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
R.integer.config_delay_before_fadeout_language_on_spacebar);
mConfigDurationOfFadeoutLanguageOnSpacebar = res.getInteger(
R.integer.config_duration_of_fadeout_language_on_spacebar);
+ mConfigFinalFadeoutFactorOfLanugageOnSpacebar = res.getInteger(
+ R.integer.config_final_fadeout_percentage_of_language_on_spacebar) / 100.0f;
Utils.GCUtils.getInstance().reset();
boolean tryGC = true;