aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java
diff options
context:
space:
mode:
authorsatok <satok@google.com>2010-06-01 01:11:57 -0700
committerGerrit Code Review <gerrit2@ppgnte-ubiq63.twd.corp.google.com>2010-06-01 01:11:57 -0700
commitac2b332e94acbed25739adb5e74c0ba5e2553ff3 (patch)
treecb30eda97535b79ec36612a832aae163286bb53c /java/src/com/android/inputmethod/latin/KeyboardSwitcher.java
parenta146069dbd9fb3f0ecdbd2d80a43225ed9f48d66 (diff)
parente607db631d33b15c4ce451782023f8c5f7ef5044 (diff)
downloadlatinime-ac2b332e94acbed25739adb5e74c0ba5e2553ff3.tar.gz
latinime-ac2b332e94acbed25739adb5e74c0ba5e2553ff3.tar.xz
latinime-ac2b332e94acbed25739adb5e74c0ba5e2553ff3.zip
Merge "Get the log of exceptions. And delete the gradient background."
Diffstat (limited to 'java/src/com/android/inputmethod/latin/KeyboardSwitcher.java')
-rw-r--r--java/src/com/android/inputmethod/latin/KeyboardSwitcher.java39
1 files changed, 18 insertions, 21 deletions
diff --git a/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java b/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java
index fefe1cc42..3eb135ebe 100644
--- a/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java
+++ b/java/src/com/android/inputmethod/latin/KeyboardSwitcher.java
@@ -212,8 +212,12 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
mInputView.setPreviewEnabled(true);
KeyboardId id = getKeyboardId(mode, imeOptions, isSymbols);
-
- LatinKeyboard keyboard = getKeyboard(id);
+ LatinKeyboard keyboard = null;
+ try {
+ keyboard = getKeyboard(id);
+ } catch (RuntimeException e) {
+ LatinImeLogger.logOnException(mode + "," + imeOptions + "," + isSymbols, e);
+ }
if (mode == MODE_PHONE) {
mInputView.setPhoneKeyboard(keyboard);
@@ -271,12 +275,11 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
}
switch (mode) {
case MODE_TEXT:
- if (mTextMode == MODE_TEXT_QWERTY) {
- return new KeyboardId(keyboardRowsResId, KEYBOARDMODE_NORMAL, true, hasVoice);
- } else if (mTextMode == MODE_TEXT_ALPHA) {
+ if (mTextMode == MODE_TEXT_ALPHA) {
return new KeyboardId(R.xml.kbd_alpha, KEYBOARDMODE_NORMAL, true, hasVoice);
}
- break;
+ // Normally mTextMode should be MODE_TEXT_QWERTY.
+ return new KeyboardId(keyboardRowsResId, KEYBOARDMODE_NORMAL, true, hasVoice);
case MODE_SYMBOLS:
return makeSymbolsId(hasVoice);
case MODE_PHONE:
@@ -301,19 +304,6 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
return mMode == MODE_TEXT;
}
- int getTextMode() {
- return mTextMode;
- }
-
- void setTextMode(int position) {
- if (position < MODE_TEXT_COUNT && position >= 0) {
- mTextMode = position;
- }
- if (isTextMode()) {
- setKeyboardMode(MODE_TEXT, mImeOptions, mHasVoice);
- }
- }
-
int getTextModeCount() {
return MODE_TEXT_COUNT;
}
@@ -387,11 +377,18 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
private void changeLatinKeyboardView(int newLayout, boolean forceReset) {
if (mLayoutId != newLayout || mInputView == null || forceReset) {
+ if (mInputView != null) {
+ mInputView.closing();
+ }
if (LAYOUTS.length <= newLayout) {
newLayout = Integer.valueOf(DEFAULT_LAYOUT_ID);
}
- mInputView = (LatinKeyboardView) mInputMethodService.getLayoutInflater().inflate(
- LAYOUTS[newLayout], null);
+ try {
+ mInputView = (LatinKeyboardView) mInputMethodService.getLayoutInflater().inflate(
+ LAYOUTS[newLayout], null);
+ } catch (RuntimeException e) {
+ LatinImeLogger.logOnException(mLayoutId + "," + newLayout, e);
+ }
mInputView.setExtentionLayoutResId(LAYOUTS[newLayout]);
mInputView.setOnKeyboardActionListener(mInputMethodService);
mLayoutId = newLayout;