Loading src/com/android/inputmethod/latin/LatinIME.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -893,7 +893,7 @@ public class LatinIME extends InputMethodService case LatinKeyboardView.KEYCODE_OPTIONS: case LatinKeyboardView.KEYCODE_OPTIONS: showOptionsMenu(); showOptionsMenu(); break; break; case LatinKeyboardView.KEYCODE_F1: case LatinKeyboardView.KEYCODE_NEXT_LANGUAGE: toggleLanguage(false); toggleLanguage(false); break; break; case LatinKeyboardView.KEYCODE_SHIFT_LONGPRESS: case LatinKeyboardView.KEYCODE_SHIFT_LONGPRESS: Loading src/com/android/inputmethod/latin/LatinKeyboard.java +31 −26 Original line number Original line Diff line number Diff line Loading @@ -42,7 +42,7 @@ public class LatinKeyboard extends Keyboard { private Key mEnterKey; private Key mEnterKey; private Key mF1Key; private Key mF1Key; private Key mSpaceKey; private Key mSpaceKey; private Locale mLocale; /* package */ Locale mLocale; private Resources mRes; private Resources mRes; private int mMode; private int mMode; Loading Loading @@ -227,17 +227,40 @@ public class LatinKeyboard extends Keyboard { } } private void setF1Key() { private void setF1Key() { if (mF1Key == null) return; // No function key on this keyboard // TODO // else { // mSpaceKey.icon = mRes.getDrawable(R.drawable.sym_keyboard_space); // switch (mMode) { // case KeyboardSwitcher.KEYBOARDMODE_NORMAL: // case KeyboardSwitcher.KEYBOARDMODE_IM: // mF1Key.label = ","; // mF1Key.codes = new int[] { ',' }; // mF1Key.icon = null; // mF1Key.iconPreview = null; // break; // case KeyboardSwitcher.KEYBOARDMODE_EMAIL: // case KeyboardSwitcher.KEYBOARDMODE_URL: // mF1Key.label = mRes.getString(R.string.popular_domain_0); // mF1Key.codes = new int[] { '.' }; // mF1Key.text = mF1Key.label; // mF1Key.icon = null; // mF1Key.iconPreview = null; // mF1Key.popupResId = R.xml.popup_domains; // break; // } // } } private void updateSpaceBarForLocale() { if (mLocale != null) { if (mLocale != null) { // Create the graphic for spacebar // Create the graphic for spacebar mF1Key.label = null; mF1Key.icon = mRes.getDrawable(R.drawable.sym_keyboard_globe); Bitmap buffer = Bitmap.createBitmap(mSpaceKey.width, mSpaceIcon.getIntrinsicHeight(), Bitmap buffer = Bitmap.createBitmap(mSpaceKey.width, mSpaceIcon.getIntrinsicHeight(), Bitmap.Config.ARGB_8888); Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(buffer); Canvas canvas = new Canvas(buffer); canvas.drawColor(0x00000000, PorterDuff.Mode.CLEAR); canvas.drawColor(0x00000000, PorterDuff.Mode.CLEAR); Paint paint = new Paint(); Paint paint = new Paint(); paint.setAntiAlias(true); paint.setAntiAlias(true); // TODO: Make the text size a customizable attribute paint.setTextSize(22); paint.setTextSize(22); paint.setTextAlign(Align.CENTER); paint.setTextAlign(Align.CENTER); // Draw a drop shadow for the text // Draw a drop shadow for the text Loading @@ -251,35 +274,17 @@ public class LatinKeyboard extends Keyboard { x + mSpaceIcon.getIntrinsicWidth(), y + mSpaceIcon.getIntrinsicHeight()); x + mSpaceIcon.getIntrinsicWidth(), y + mSpaceIcon.getIntrinsicHeight()); mSpaceIcon.draw(canvas); mSpaceIcon.draw(canvas); mSpaceKey.icon = new BitmapDrawable(mRes, buffer); mSpaceKey.icon = new BitmapDrawable(mRes, buffer); mSpaceKey.repeatable = false; } else { } else { mSpaceKey.icon = mRes.getDrawable(R.drawable.sym_keyboard_space); mSpaceKey.icon = mRes.getDrawable(R.drawable.sym_keyboard_space); switch (mMode) { mSpaceKey.repeatable = true; case KeyboardSwitcher.KEYBOARDMODE_NORMAL: case KeyboardSwitcher.KEYBOARDMODE_IM: mF1Key.label = ","; mF1Key.codes = new int[] { ',' }; mF1Key.icon = null; mF1Key.iconPreview = null; break; case KeyboardSwitcher.KEYBOARDMODE_EMAIL: case KeyboardSwitcher.KEYBOARDMODE_URL: mF1Key.label = mRes.getString(R.string.popular_domain_0); mF1Key.codes = new int[] { '.' }; mF1Key.text = mF1Key.label; mF1Key.icon = null; mF1Key.iconPreview = null; mF1Key.popupResId = R.xml.popup_domains; break; } } } } } public void setLanguage(Locale locale) { public void setLanguage(Locale locale) { if (mLocale != null && mLocale.equals(locale)) return; if (mLocale != null && mLocale.equals(locale)) return; mLocale = locale; mLocale = locale; setF1Key(); updateSpaceBarForLocale(); if (mF1Key != null) { } } } static class LatinKey extends Keyboard.Key { static class LatinKey extends Keyboard.Key { Loading src/com/android/inputmethod/latin/LatinKeyboardView.java +5 −0 Original line number Original line Diff line number Diff line Loading @@ -37,6 +37,8 @@ public class LatinKeyboardView extends KeyboardView { static final int KEYCODE_SHIFT_LONGPRESS = -101; static final int KEYCODE_SHIFT_LONGPRESS = -101; static final int KEYCODE_VOICE = -102; static final int KEYCODE_VOICE = -102; static final int KEYCODE_F1 = -103; static final int KEYCODE_F1 = -103; static final int KEYCODE_NEXT_LANGUAGE = -104; private Keyboard mPhoneKeyboard; private Keyboard mPhoneKeyboard; public LatinKeyboardView(Context context, AttributeSet attrs) { public LatinKeyboardView(Context context, AttributeSet attrs) { Loading Loading @@ -64,6 +66,9 @@ public class LatinKeyboardView extends KeyboardView { // Long pressing on 0 in phone number keypad gives you a '+'. // Long pressing on 0 in phone number keypad gives you a '+'. getOnKeyboardActionListener().onKey('+', null); getOnKeyboardActionListener().onKey('+', null); return true; return true; } else if (key.codes[0] == ' ' && ((LatinKeyboard)getKeyboard()).mLocale != null) { getOnKeyboardActionListener().onKey(KEYCODE_NEXT_LANGUAGE, null); return true; } else { } else { return super.onLongPress(key); return super.onLongPress(key); } } Loading Loading
src/com/android/inputmethod/latin/LatinIME.java +1 −1 Original line number Original line Diff line number Diff line Loading @@ -893,7 +893,7 @@ public class LatinIME extends InputMethodService case LatinKeyboardView.KEYCODE_OPTIONS: case LatinKeyboardView.KEYCODE_OPTIONS: showOptionsMenu(); showOptionsMenu(); break; break; case LatinKeyboardView.KEYCODE_F1: case LatinKeyboardView.KEYCODE_NEXT_LANGUAGE: toggleLanguage(false); toggleLanguage(false); break; break; case LatinKeyboardView.KEYCODE_SHIFT_LONGPRESS: case LatinKeyboardView.KEYCODE_SHIFT_LONGPRESS: Loading
src/com/android/inputmethod/latin/LatinKeyboard.java +31 −26 Original line number Original line Diff line number Diff line Loading @@ -42,7 +42,7 @@ public class LatinKeyboard extends Keyboard { private Key mEnterKey; private Key mEnterKey; private Key mF1Key; private Key mF1Key; private Key mSpaceKey; private Key mSpaceKey; private Locale mLocale; /* package */ Locale mLocale; private Resources mRes; private Resources mRes; private int mMode; private int mMode; Loading Loading @@ -227,17 +227,40 @@ public class LatinKeyboard extends Keyboard { } } private void setF1Key() { private void setF1Key() { if (mF1Key == null) return; // No function key on this keyboard // TODO // else { // mSpaceKey.icon = mRes.getDrawable(R.drawable.sym_keyboard_space); // switch (mMode) { // case KeyboardSwitcher.KEYBOARDMODE_NORMAL: // case KeyboardSwitcher.KEYBOARDMODE_IM: // mF1Key.label = ","; // mF1Key.codes = new int[] { ',' }; // mF1Key.icon = null; // mF1Key.iconPreview = null; // break; // case KeyboardSwitcher.KEYBOARDMODE_EMAIL: // case KeyboardSwitcher.KEYBOARDMODE_URL: // mF1Key.label = mRes.getString(R.string.popular_domain_0); // mF1Key.codes = new int[] { '.' }; // mF1Key.text = mF1Key.label; // mF1Key.icon = null; // mF1Key.iconPreview = null; // mF1Key.popupResId = R.xml.popup_domains; // break; // } // } } private void updateSpaceBarForLocale() { if (mLocale != null) { if (mLocale != null) { // Create the graphic for spacebar // Create the graphic for spacebar mF1Key.label = null; mF1Key.icon = mRes.getDrawable(R.drawable.sym_keyboard_globe); Bitmap buffer = Bitmap.createBitmap(mSpaceKey.width, mSpaceIcon.getIntrinsicHeight(), Bitmap buffer = Bitmap.createBitmap(mSpaceKey.width, mSpaceIcon.getIntrinsicHeight(), Bitmap.Config.ARGB_8888); Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(buffer); Canvas canvas = new Canvas(buffer); canvas.drawColor(0x00000000, PorterDuff.Mode.CLEAR); canvas.drawColor(0x00000000, PorterDuff.Mode.CLEAR); Paint paint = new Paint(); Paint paint = new Paint(); paint.setAntiAlias(true); paint.setAntiAlias(true); // TODO: Make the text size a customizable attribute paint.setTextSize(22); paint.setTextSize(22); paint.setTextAlign(Align.CENTER); paint.setTextAlign(Align.CENTER); // Draw a drop shadow for the text // Draw a drop shadow for the text Loading @@ -251,35 +274,17 @@ public class LatinKeyboard extends Keyboard { x + mSpaceIcon.getIntrinsicWidth(), y + mSpaceIcon.getIntrinsicHeight()); x + mSpaceIcon.getIntrinsicWidth(), y + mSpaceIcon.getIntrinsicHeight()); mSpaceIcon.draw(canvas); mSpaceIcon.draw(canvas); mSpaceKey.icon = new BitmapDrawable(mRes, buffer); mSpaceKey.icon = new BitmapDrawable(mRes, buffer); mSpaceKey.repeatable = false; } else { } else { mSpaceKey.icon = mRes.getDrawable(R.drawable.sym_keyboard_space); mSpaceKey.icon = mRes.getDrawable(R.drawable.sym_keyboard_space); switch (mMode) { mSpaceKey.repeatable = true; case KeyboardSwitcher.KEYBOARDMODE_NORMAL: case KeyboardSwitcher.KEYBOARDMODE_IM: mF1Key.label = ","; mF1Key.codes = new int[] { ',' }; mF1Key.icon = null; mF1Key.iconPreview = null; break; case KeyboardSwitcher.KEYBOARDMODE_EMAIL: case KeyboardSwitcher.KEYBOARDMODE_URL: mF1Key.label = mRes.getString(R.string.popular_domain_0); mF1Key.codes = new int[] { '.' }; mF1Key.text = mF1Key.label; mF1Key.icon = null; mF1Key.iconPreview = null; mF1Key.popupResId = R.xml.popup_domains; break; } } } } } public void setLanguage(Locale locale) { public void setLanguage(Locale locale) { if (mLocale != null && mLocale.equals(locale)) return; if (mLocale != null && mLocale.equals(locale)) return; mLocale = locale; mLocale = locale; setF1Key(); updateSpaceBarForLocale(); if (mF1Key != null) { } } } static class LatinKey extends Keyboard.Key { static class LatinKey extends Keyboard.Key { Loading
src/com/android/inputmethod/latin/LatinKeyboardView.java +5 −0 Original line number Original line Diff line number Diff line Loading @@ -37,6 +37,8 @@ public class LatinKeyboardView extends KeyboardView { static final int KEYCODE_SHIFT_LONGPRESS = -101; static final int KEYCODE_SHIFT_LONGPRESS = -101; static final int KEYCODE_VOICE = -102; static final int KEYCODE_VOICE = -102; static final int KEYCODE_F1 = -103; static final int KEYCODE_F1 = -103; static final int KEYCODE_NEXT_LANGUAGE = -104; private Keyboard mPhoneKeyboard; private Keyboard mPhoneKeyboard; public LatinKeyboardView(Context context, AttributeSet attrs) { public LatinKeyboardView(Context context, AttributeSet attrs) { Loading Loading @@ -64,6 +66,9 @@ public class LatinKeyboardView extends KeyboardView { // Long pressing on 0 in phone number keypad gives you a '+'. // Long pressing on 0 in phone number keypad gives you a '+'. getOnKeyboardActionListener().onKey('+', null); getOnKeyboardActionListener().onKey('+', null); return true; return true; } else if (key.codes[0] == ' ' && ((LatinKeyboard)getKeyboard()).mLocale != null) { getOnKeyboardActionListener().onKey(KEYCODE_NEXT_LANGUAGE, null); return true; } else { } else { return super.onLongPress(key); return super.onLongPress(key); } } Loading