am 0a498cf8
: Merge "Extend space LED for autocompletion" into gingerbread
Merge commit '0a498cf8d89ce33f7deceebcfb74a9f5fbb10f68' into gingerbread-plus-aosp * commit '0a498cf8d89ce33f7deceebcfb74a9f5fbb10f68': Extend space LED for autocompletion
This commit is contained in:
commit
34830114e6
2 changed files with 42 additions and 31 deletions
|
@ -687,6 +687,7 @@ public class LatinIME extends InputMethodService
|
||||||
super.onFinishInput();
|
super.onFinishInput();
|
||||||
|
|
||||||
LatinImeLogger.commit();
|
LatinImeLogger.commit();
|
||||||
|
onAutoCompletionStateChanged(false);
|
||||||
|
|
||||||
if (VOICE_INSTALLED && !mConfigurationChanging) {
|
if (VOICE_INSTALLED && !mConfigurationChanging) {
|
||||||
if (mAfterVoiceInput) {
|
if (mAfterVoiceInput) {
|
||||||
|
@ -791,6 +792,7 @@ public class LatinIME extends InputMethodService
|
||||||
@Override
|
@Override
|
||||||
public void hideWindow() {
|
public void hideWindow() {
|
||||||
LatinImeLogger.commit();
|
LatinImeLogger.commit();
|
||||||
|
onAutoCompletionStateChanged(false);
|
||||||
|
|
||||||
if (TRACE) Debug.stopMethodTracing();
|
if (TRACE) Debug.stopMethodTracing();
|
||||||
if (mOptionsDialog != null && mOptionsDialog.isShowing()) {
|
if (mOptionsDialog != null && mOptionsDialog.isShowing()) {
|
||||||
|
|
|
@ -44,6 +44,7 @@ public class LatinKeyboard extends Keyboard {
|
||||||
private static final boolean DEBUG_PREFERRED_LETTER = false;
|
private static final boolean DEBUG_PREFERRED_LETTER = false;
|
||||||
private static final String TAG = "LatinKeyboard";
|
private static final String TAG = "LatinKeyboard";
|
||||||
private static final int OPACITY_FULLY_OPAQUE = 255;
|
private static final int OPACITY_FULLY_OPAQUE = 255;
|
||||||
|
private static final int SPACE_LED_LENGTH_PERCENT = 80;
|
||||||
|
|
||||||
private Drawable mShiftLockIcon;
|
private Drawable mShiftLockIcon;
|
||||||
private Drawable mShiftLockPreviewIcon;
|
private Drawable mShiftLockPreviewIcon;
|
||||||
|
@ -345,16 +346,20 @@ public class LatinKeyboard extends Keyboard {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateSpaceBarForLocale(boolean isAutoCompletion, boolean isBlack) {
|
private void updateSpaceBarForLocale(boolean isAutoCompletion, boolean isBlack) {
|
||||||
|
// If application locales are explicitly selected.
|
||||||
if (mLocale != null) {
|
if (mLocale != null) {
|
||||||
Bitmap buffer = drawSpaceBar(OPACITY_FULLY_OPAQUE, isAutoCompletion, isBlack);
|
mSpaceKey.icon = new BitmapDrawable(mRes,
|
||||||
mSpaceKey.icon = new BitmapDrawable(mRes, buffer);
|
drawSpaceBar(OPACITY_FULLY_OPAQUE, isAutoCompletion, isBlack));
|
||||||
mSpaceKey.repeatable = mLanguageSwitcher.getLocaleCount() < 2;
|
mSpaceKey.repeatable = mLanguageSwitcher.getLocaleCount() < 2;
|
||||||
} else {
|
} else {
|
||||||
// sym_keyboard_space_led can be shared with Black and White symbol themes.
|
// sym_keyboard_space_led can be shared with Black and White symbol themes.
|
||||||
mSpaceKey.icon =
|
if (isAutoCompletion) {
|
||||||
isAutoCompletion ? mRes.getDrawable(R.drawable.sym_keyboard_space_led)
|
mSpaceKey.icon = new BitmapDrawable(mRes,
|
||||||
: isBlack ? mRes.getDrawable(R.drawable.sym_bkeyboard_space)
|
drawSpaceBar(OPACITY_FULLY_OPAQUE, isAutoCompletion, isBlack));
|
||||||
: mRes.getDrawable(R.drawable.sym_keyboard_space);
|
} else {
|
||||||
|
mSpaceKey.icon = isBlack ? mRes.getDrawable(R.drawable.sym_bkeyboard_space)
|
||||||
|
: mRes.getDrawable(R.drawable.sym_keyboard_space);
|
||||||
|
}
|
||||||
mSpaceKey.repeatable = true;
|
mSpaceKey.repeatable = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -365,36 +370,40 @@ public class LatinKeyboard extends Keyboard {
|
||||||
Bitmap buffer = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
|
Bitmap buffer = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
|
||||||
Canvas canvas = new Canvas(buffer);
|
Canvas canvas = new Canvas(buffer);
|
||||||
canvas.drawColor(mRes.getColor(R.color.latinkeyboard_transparent), PorterDuff.Mode.CLEAR);
|
canvas.drawColor(mRes.getColor(R.color.latinkeyboard_transparent), PorterDuff.Mode.CLEAR);
|
||||||
Paint paint = new Paint();
|
// If application locales are explicitly selected.
|
||||||
paint.setAntiAlias(true);
|
if (mLocale != null) {
|
||||||
paint.setAlpha(opacity);
|
Paint paint = new Paint();
|
||||||
// Get the text size from the theme
|
paint.setAntiAlias(true);
|
||||||
paint.setTextSize(getTextSizeFromTheme(android.R.style.TextAppearance_Small, 14));
|
paint.setAlpha(opacity);
|
||||||
paint.setTextAlign(Align.CENTER);
|
// Get the text size from the theme
|
||||||
final String language = getInputLanguage(mSpaceKey.width, paint);
|
paint.setTextSize(getTextSizeFromTheme(android.R.style.TextAppearance_Small, 14));
|
||||||
final int ascent = (int) -paint.ascent();
|
paint.setTextAlign(Align.CENTER);
|
||||||
|
final String language = getInputLanguage(mSpaceKey.width, paint);
|
||||||
|
final int ascent = (int) -paint.ascent();
|
||||||
|
|
||||||
int shadowColor = isBlack ? mRes.getColor(R.color.latinkeyboard_bar_language_shadow_black)
|
int shadowColor = isBlack ?
|
||||||
: mRes.getColor(R.color.latinkeyboard_bar_language_shadow_white);
|
mRes.getColor(R.color.latinkeyboard_bar_language_shadow_black)
|
||||||
|
: mRes.getColor(R.color.latinkeyboard_bar_language_shadow_white);
|
||||||
|
|
||||||
paint.setColor(shadowColor);
|
paint.setColor(shadowColor);
|
||||||
canvas.drawText(language, width / 2, ascent - 1, paint);
|
canvas.drawText(language, width / 2, ascent - 1, paint);
|
||||||
paint.setColor(mRes.getColor(R.color.latinkeyboard_bar_language_text));
|
paint.setColor(mRes.getColor(R.color.latinkeyboard_bar_language_text));
|
||||||
canvas.drawText(language, width / 2, ascent, paint);
|
canvas.drawText(language, width / 2, ascent, paint);
|
||||||
// Put arrows on either side of the text
|
// Put arrows on either side of the text
|
||||||
if (mLanguageSwitcher.getLocaleCount() > 1) {
|
if (mLanguageSwitcher.getLocaleCount() > 1) {
|
||||||
Rect bounds = new Rect();
|
Rect bounds = new Rect();
|
||||||
paint.getTextBounds(language, 0, language.length(), bounds);
|
paint.getTextBounds(language, 0, language.length(), bounds);
|
||||||
drawButtonArrow(mButtonArrowLeftIcon, canvas,
|
drawButtonArrow(mButtonArrowLeftIcon, canvas,
|
||||||
(mSpaceKey.width - bounds.right) / 2
|
(mSpaceKey.width - bounds.right) / 2
|
||||||
- mButtonArrowLeftIcon.getIntrinsicWidth(),
|
- mButtonArrowLeftIcon.getIntrinsicWidth(),
|
||||||
(int) paint.getTextSize());
|
(int) paint.getTextSize());
|
||||||
drawButtonArrow(mButtonArrowRightIcon, canvas,
|
drawButtonArrow(mButtonArrowRightIcon, canvas,
|
||||||
(mSpaceKey.width + bounds.right) / 2, (int) paint.getTextSize());
|
(mSpaceKey.width + bounds.right) / 2, (int) paint.getTextSize());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Draw the spacebar icon at the bottom
|
// Draw the spacebar icon at the bottom
|
||||||
if (isAutoCompletion) {
|
if (isAutoCompletion) {
|
||||||
final int iconWidth = mSpaceAutoCompletionIndicator.getIntrinsicWidth();
|
final int iconWidth = width * SPACE_LED_LENGTH_PERCENT / 100;
|
||||||
final int iconHeight = mSpaceAutoCompletionIndicator.getIntrinsicHeight();
|
final int iconHeight = mSpaceAutoCompletionIndicator.getIntrinsicHeight();
|
||||||
int x = (width - iconWidth) / 2;
|
int x = (width - iconWidth) / 2;
|
||||||
int y = height - iconHeight;
|
int y = height - iconHeight;
|
||||||
|
|
Loading…
Reference in a new issue