am 9d446fc1: Merge "Place language name at center of spacebar if no space icon" into honeycomb
* commit '9d446fc13ff57c05c1944054605299a727ae8a9b': Place language name at center of spacebar if no space iconmain
commit
84a963d563
|
@ -35,6 +35,7 @@
|
|||
<!-- 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_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_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;
|
||||
// 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));
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue