Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0a498cf8 authored by satok's avatar satok Committed by Android (Google) Code Review
Browse files

Merge "Extend space LED for autocompletion" into gingerbread

parents e8f45ab5 1bf265d1
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -687,6 +687,7 @@ public class LatinIME extends InputMethodService
        super.onFinishInput();

        LatinImeLogger.commit();
        onAutoCompletionStateChanged(false);

        if (VOICE_INSTALLED && !mConfigurationChanging) {
            if (mAfterVoiceInput) {
@@ -791,6 +792,7 @@ public class LatinIME extends InputMethodService
    @Override
    public void hideWindow() {
        LatinImeLogger.commit();
        onAutoCompletionStateChanged(false);

        if (TRACE) Debug.stopMethodTracing();
        if (mOptionsDialog != null && mOptionsDialog.isShowing()) {
+42 −33
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ public class LatinKeyboard extends Keyboard {
    private static final boolean DEBUG_PREFERRED_LETTER = false;
    private static final String TAG = "LatinKeyboard";
    private static final int OPACITY_FULLY_OPAQUE = 255;
    private static final int SPACE_LED_LENGTH_PERCENT = 80;

    private Drawable mShiftLockIcon;
    private Drawable mShiftLockPreviewIcon;
@@ -345,16 +346,20 @@ public class LatinKeyboard extends Keyboard {
    }

    private void updateSpaceBarForLocale(boolean isAutoCompletion, boolean isBlack) {
        // If application locales are explicitly selected.
        if (mLocale != null) {
            Bitmap buffer = drawSpaceBar(OPACITY_FULLY_OPAQUE, isAutoCompletion, isBlack);
            mSpaceKey.icon = new BitmapDrawable(mRes, buffer);
            mSpaceKey.icon = new BitmapDrawable(mRes,
                    drawSpaceBar(OPACITY_FULLY_OPAQUE, isAutoCompletion, isBlack));
            mSpaceKey.repeatable = mLanguageSwitcher.getLocaleCount() < 2;
        } else {
            // sym_keyboard_space_led can be shared with Black and White symbol themes.
            mSpaceKey.icon =
                isAutoCompletion ? mRes.getDrawable(R.drawable.sym_keyboard_space_led)
                        : isBlack ? mRes.getDrawable(R.drawable.sym_bkeyboard_space)
            if (isAutoCompletion) {
                mSpaceKey.icon = new BitmapDrawable(mRes,
                        drawSpaceBar(OPACITY_FULLY_OPAQUE, isAutoCompletion, isBlack));
            } else {
                mSpaceKey.icon = isBlack ? mRes.getDrawable(R.drawable.sym_bkeyboard_space)
                        : mRes.getDrawable(R.drawable.sym_keyboard_space);
            }
            mSpaceKey.repeatable = true;
        }
    }
@@ -365,6 +370,8 @@ public class LatinKeyboard extends Keyboard {
        Bitmap buffer = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
        Canvas canvas = new Canvas(buffer);
        canvas.drawColor(mRes.getColor(R.color.latinkeyboard_transparent), PorterDuff.Mode.CLEAR);
        // If application locales are explicitly selected.
        if (mLocale != null) {
            Paint paint = new Paint();
            paint.setAntiAlias(true);
            paint.setAlpha(opacity);
@@ -374,7 +381,8 @@ public class LatinKeyboard extends Keyboard {
            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_black)
                    : mRes.getColor(R.color.latinkeyboard_bar_language_shadow_white);

            paint.setColor(shadowColor);
@@ -392,9 +400,10 @@ public class LatinKeyboard extends Keyboard {
                drawButtonArrow(mButtonArrowRightIcon, canvas,
                        (mSpaceKey.width + bounds.right) / 2, (int) paint.getTextSize());
            }
        }
        // Draw the spacebar icon at the bottom
        if (isAutoCompletion) {
            final int iconWidth = mSpaceAutoCompletionIndicator.getIntrinsicWidth();
            final int iconWidth = width * SPACE_LED_LENGTH_PERCENT / 100;
            final int iconHeight = mSpaceAutoCompletionIndicator.getIntrinsicHeight();
            int x = (width - iconWidth) / 2;
            int y = height - iconHeight;