Display language name on spacebar even in symbol keyboard.
Bug: 3468634 Change-Id: I1a25eb71ddbd7efae6f40ea357714924a9d56dc4
This commit is contained in:
parent
4adf5d9ae5
commit
050c0462dc
4 changed files with 25 additions and 23 deletions
|
@ -155,15 +155,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
|
|||
boolean voiceButtonOnPrimary) {
|
||||
mAutoModeSwitchState = AUTO_MODE_SWITCH_STATE_ALPHA;
|
||||
try {
|
||||
if (mInputView == null) return;
|
||||
final Keyboard oldKeyboard = mInputView.getKeyboard();
|
||||
loadKeyboardInternal(mode, attribute, voiceKeyEnabled, voiceButtonOnPrimary, false);
|
||||
final Keyboard newKeyboard = mInputView.getKeyboard();
|
||||
if (newKeyboard.isAlphaKeyboard()) {
|
||||
final boolean localeChanged = (oldKeyboard == null)
|
||||
|| !newKeyboard.mId.mLocale.equals(oldKeyboard.mId.mLocale);
|
||||
mInputMethodService.mHandler.startDisplayLanguageOnSpacebar(localeChanged);
|
||||
}
|
||||
} catch (RuntimeException e) {
|
||||
// Get KeyboardId to record which keyboard has been failed to load.
|
||||
final KeyboardId id = getKeyboardId(mode, attribute, false);
|
||||
|
@ -192,7 +184,15 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
|
|||
makeSymbolsKeyboardIds();
|
||||
mCurrentId = id;
|
||||
mInputView.setPreviewEnabled(mInputMethodService.getPopupOn());
|
||||
mInputView.setKeyboard(getKeyboard(id));
|
||||
setKeyboard(getKeyboard(id));
|
||||
}
|
||||
|
||||
private void setKeyboard(final Keyboard newKeyboard) {
|
||||
final Keyboard oldKeyboard = mInputView.getKeyboard();
|
||||
mInputView.setKeyboard(newKeyboard);
|
||||
final boolean localeChanged = (oldKeyboard == null)
|
||||
|| !newKeyboard.mId.mLocale.equals(oldKeyboard.mId.mLocale);
|
||||
mInputMethodService.mHandler.startDisplayLanguageOnSpacebar(localeChanged);
|
||||
}
|
||||
|
||||
private LatinKeyboard getKeyboard(KeyboardId id) {
|
||||
|
@ -278,13 +278,16 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
|
|||
|
||||
public boolean isKeyboardAvailable() {
|
||||
if (mInputView != null)
|
||||
return mInputView.getLatinKeyboard() != null;
|
||||
return mInputView.getKeyboard() != null;
|
||||
return false;
|
||||
}
|
||||
|
||||
private LatinKeyboard getLatinKeyboard() {
|
||||
if (mInputView != null)
|
||||
return mInputView.getLatinKeyboard();
|
||||
public LatinKeyboard getLatinKeyboard() {
|
||||
if (mInputView != null) {
|
||||
final Keyboard keyboard = mInputView.getKeyboard();
|
||||
if (keyboard instanceof LatinKeyboard)
|
||||
return (LatinKeyboard)keyboard;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -550,7 +553,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
|
|||
// indicator, we need to call enableShiftLock() and setShiftLocked(false).
|
||||
keyboard.setShifted(false);
|
||||
}
|
||||
mInputView.setKeyboard(keyboard);
|
||||
setKeyboard(keyboard);
|
||||
}
|
||||
|
||||
public boolean isInMomentaryAutoModeSwitchState() {
|
||||
|
|
|
@ -66,7 +66,8 @@ public class LatinKeyboardView extends KeyboardView {
|
|||
}
|
||||
}
|
||||
|
||||
public void setLatinKeyboard(LatinKeyboard newKeyboard) {
|
||||
@Override
|
||||
public void setKeyboard(Keyboard newKeyboard) {
|
||||
final LatinKeyboard oldKeyboard = getLatinKeyboard();
|
||||
if (oldKeyboard != null) {
|
||||
// Reset old keyboard state before switching to new keyboard.
|
||||
|
@ -80,7 +81,7 @@ public class LatinKeyboardView extends KeyboardView {
|
|||
mLastRowY = (newKeyboard.getHeight() * 3) / 4;
|
||||
}
|
||||
|
||||
public LatinKeyboard getLatinKeyboard() {
|
||||
private LatinKeyboard getLatinKeyboard() {
|
||||
Keyboard keyboard = getKeyboard();
|
||||
if (keyboard instanceof LatinKeyboard) {
|
||||
return (LatinKeyboard)keyboard;
|
||||
|
|
|
@ -321,7 +321,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
|||
removeMessages(MSG_DISMISS_LANGUAGE_ON_SPACEBAR);
|
||||
final LatinKeyboardView inputView = mKeyboardSwitcher.getInputView();
|
||||
if (inputView != null) {
|
||||
final LatinKeyboard keyboard = inputView.getLatinKeyboard();
|
||||
final LatinKeyboard keyboard = mKeyboardSwitcher.getLatinKeyboard();
|
||||
// The language is never displayed when the delay is zero.
|
||||
if (mConfigDelayBeforeFadeoutLanguageOnSpacebar != 0)
|
||||
inputView.setSpacebarTextFadeFactor(localeChanged ? 1.0f
|
||||
|
|
|
@ -371,12 +371,10 @@ public class SubtypeSwitcher {
|
|||
ConnectivityManager.EXTRA_NO_CONNECTIVITY, false);
|
||||
mIsNetworkConnected = !noConnection;
|
||||
|
||||
final LatinKeyboardView inputView = KeyboardSwitcher.getInstance().getInputView();
|
||||
if (inputView != null) {
|
||||
final LatinKeyboard keyboard = inputView.getLatinKeyboard();
|
||||
final KeyboardSwitcher switcher = KeyboardSwitcher.getInstance();
|
||||
final LatinKeyboard keyboard = switcher.getLatinKeyboard();
|
||||
if (keyboard != null) {
|
||||
keyboard.updateShortcutKey(isShortcutAvailable(), inputView);
|
||||
}
|
||||
keyboard.updateShortcutKey(isShortcutAvailable(), switcher.getInputView());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue