am 84a963d5: am 9d446fc1: Merge "Place language name at center of spacebar if no space icon" into honeycomb
* commit '84a963d5637b3eadd5fad6914f4986d58f81c746': Place language name at center of spacebar if no space iconmain
commit
47b3042d1e
|
@ -35,6 +35,7 @@
|
||||||
<!-- 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">-1</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_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">10</integer>
|
||||||
<integer name="config_preview_fadein_anim_time">0</integer>
|
<integer name="config_preview_fadein_anim_time">0</integer>
|
||||||
|
|
|
@ -70,7 +70,6 @@ public class LatinKeyboard extends Keyboard {
|
||||||
private static final float SPACEBAR_POPUP_MIN_RATIO = 0.4f;
|
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)
|
// Height in space key the language name will be drawn. (proportional to space key height)
|
||||||
public static final float SPACEBAR_LANGUAGE_BASELINE = 0.6f;
|
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,
|
// 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.
|
// its short language name will be used instead.
|
||||||
private static final float MINIMUM_SCALE_OF_LANGUAGE_NAME = 0.8f;
|
private static final float MINIMUM_SCALE_OF_LANGUAGE_NAME = 0.8f;
|
||||||
|
@ -225,9 +224,12 @@ public class LatinKeyboard extends Keyboard {
|
||||||
allowVariableTextSize);
|
allowVariableTextSize);
|
||||||
|
|
||||||
// Draw language text with shadow
|
// Draw language text with shadow
|
||||||
final float baseline = height * (mSpaceIcon != null ? SPACEBAR_LANGUAGE_BASELINE
|
// In case there is no space icon, we will place the language text at the center of
|
||||||
: SPACEBAR_LANGUAGE_BASELINE_WITHOUT_ICON);
|
// spacebar.
|
||||||
final float descent = paint.descent();
|
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));
|
paint.setColor(getSpacebarTextColor(mSpacebarTextShadowColor, mSpacebarTextFadeFactor));
|
||||||
canvas.drawText(language, width / 2, baseline - descent - 1, paint);
|
canvas.drawText(language, width / 2, baseline - descent - 1, paint);
|
||||||
paint.setColor(getSpacebarTextColor(mSpacebarTextColor, mSpacebarTextFadeFactor));
|
paint.setColor(getSpacebarTextColor(mSpacebarTextColor, mSpacebarTextFadeFactor));
|
||||||
|
|
|
@ -154,6 +154,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
private boolean mConfigSwipeDownDismissKeyboardEnabled;
|
private boolean mConfigSwipeDownDismissKeyboardEnabled;
|
||||||
private int mConfigDelayBeforeFadeoutLanguageOnSpacebar;
|
private int mConfigDelayBeforeFadeoutLanguageOnSpacebar;
|
||||||
private int mConfigDurationOfFadeoutLanguageOnSpacebar;
|
private int mConfigDurationOfFadeoutLanguageOnSpacebar;
|
||||||
|
private float mConfigFinalFadeoutFactorOfLanugageOnSpacebar;
|
||||||
|
|
||||||
private int mCorrectionMode;
|
private int mCorrectionMode;
|
||||||
private int mCommittedLength;
|
private int mCommittedLength;
|
||||||
|
@ -267,13 +268,16 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
break;
|
break;
|
||||||
case MSG_FADEOUT_LANGUAGE_ON_SPACEBAR:
|
case MSG_FADEOUT_LANGUAGE_ON_SPACEBAR:
|
||||||
if (inputView != null)
|
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),
|
sendMessageDelayed(obtainMessage(MSG_DISMISS_LANGUAGE_ON_SPACEBAR, msg.obj),
|
||||||
mConfigDurationOfFadeoutLanguageOnSpacebar);
|
mConfigDurationOfFadeoutLanguageOnSpacebar);
|
||||||
break;
|
break;
|
||||||
case MSG_DISMISS_LANGUAGE_ON_SPACEBAR:
|
case MSG_DISMISS_LANGUAGE_ON_SPACEBAR:
|
||||||
if (inputView != null)
|
if (inputView != null)
|
||||||
inputView.setSpacebarTextFadeFactor(0.0f, (LatinKeyboard)msg.obj);
|
inputView.setSpacebarTextFadeFactor(
|
||||||
|
mConfigFinalFadeoutFactorOfLanugageOnSpacebar, (LatinKeyboard)msg.obj);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -356,6 +360,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
R.integer.config_delay_before_fadeout_language_on_spacebar);
|
R.integer.config_delay_before_fadeout_language_on_spacebar);
|
||||||
mConfigDurationOfFadeoutLanguageOnSpacebar = res.getInteger(
|
mConfigDurationOfFadeoutLanguageOnSpacebar = res.getInteger(
|
||||||
R.integer.config_duration_of_fadeout_language_on_spacebar);
|
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();
|
Utils.GCUtils.getInstance().reset();
|
||||||
boolean tryGC = true;
|
boolean tryGC = true;
|
||||||
|
|
Loading…
Reference in New Issue