Fix NPE and addded logOnWarning
Change-Id: I4cca905ce044c014490ada6d00a76d79a20ed885main
parent
8edbaf0433
commit
0eaca7aa99
|
@ -28,6 +28,7 @@ import android.preference.PreferenceManager;
|
|||
|
||||
public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
|
||||
public static final int MODE_NONE = 0;
|
||||
public static final int MODE_TEXT = 1;
|
||||
public static final int MODE_SYMBOLS = 2;
|
||||
public static final int MODE_PHONE = 3;
|
||||
|
@ -74,7 +75,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
|
|||
private KeyboardId mCurrentId;
|
||||
private Map<KeyboardId, LatinKeyboard> mKeyboards;
|
||||
|
||||
private int mMode = MODE_TEXT; /** One of the MODE_XXX values */
|
||||
private int mMode = MODE_NONE; /** One of the MODE_XXX values */
|
||||
private int mImeOptions;
|
||||
private int mTextMode = MODE_TEXT_QWERTY;
|
||||
private boolean mIsSymbols;
|
||||
|
@ -276,6 +277,10 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
|
|||
? new KeyboardId(R.xml.kbd_phone_symbols, hasVoice) : makeSymbolsId(hasVoice);
|
||||
}
|
||||
switch (mode) {
|
||||
case MODE_NONE:
|
||||
LatinImeLogger.logOnWarning(
|
||||
"getKeyboardId:" + mode + "," + imeOptions + "," + isSymbols);
|
||||
/* fall through */
|
||||
case MODE_TEXT:
|
||||
if (mTextMode == MODE_TEXT_ALPHA) {
|
||||
return new KeyboardId(R.xml.kbd_alpha, KEYBOARDMODE_NORMAL, true, hasVoice);
|
||||
|
|
|
@ -812,7 +812,8 @@ public class LatinIME extends InputMethodService
|
|||
mKeyboardSwitcher = new KeyboardSwitcher(this, this);
|
||||
}
|
||||
mKeyboardSwitcher.setLanguageSwitcher(mLanguageSwitcher);
|
||||
if (mKeyboardSwitcher.getInputView() != null) {
|
||||
if (mKeyboardSwitcher.getInputView() != null
|
||||
&& mKeyboardSwitcher.getKeyboardMode() != KeyboardSwitcher.MODE_NONE) {
|
||||
mKeyboardSwitcher.setVoiceMode(mEnableVoice && mEnableVoiceButton, mVoiceOnPrimary);
|
||||
}
|
||||
mKeyboardSwitcher.makeKeyboards(true);
|
||||
|
|
|
@ -570,6 +570,13 @@ public class LatinImeLogger implements SharedPreferences.OnSharedPreferenceChang
|
|||
}
|
||||
}
|
||||
|
||||
public static void logOnWarning(String warning) {
|
||||
if (sLogEnabled) {
|
||||
sLatinImeLogger.sendLogToDropBox(
|
||||
ID_EXCEPTION, new String[] {warning, ""});
|
||||
}
|
||||
}
|
||||
|
||||
public static void onStartSuggestion() {
|
||||
if (sLogEnabled) {
|
||||
sSuggestDicMap.clear();
|
||||
|
|
Loading…
Reference in New Issue