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) {
|
boolean voiceButtonOnPrimary) {
|
||||||
mAutoModeSwitchState = AUTO_MODE_SWITCH_STATE_ALPHA;
|
mAutoModeSwitchState = AUTO_MODE_SWITCH_STATE_ALPHA;
|
||||||
try {
|
try {
|
||||||
if (mInputView == null) return;
|
|
||||||
final Keyboard oldKeyboard = mInputView.getKeyboard();
|
|
||||||
loadKeyboardInternal(mode, attribute, voiceKeyEnabled, voiceButtonOnPrimary, false);
|
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) {
|
} catch (RuntimeException e) {
|
||||||
// Get KeyboardId to record which keyboard has been failed to load.
|
// Get KeyboardId to record which keyboard has been failed to load.
|
||||||
final KeyboardId id = getKeyboardId(mode, attribute, false);
|
final KeyboardId id = getKeyboardId(mode, attribute, false);
|
||||||
|
@ -192,7 +184,15 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
|
||||||
makeSymbolsKeyboardIds();
|
makeSymbolsKeyboardIds();
|
||||||
mCurrentId = id;
|
mCurrentId = id;
|
||||||
mInputView.setPreviewEnabled(mInputMethodService.getPopupOn());
|
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) {
|
private LatinKeyboard getKeyboard(KeyboardId id) {
|
||||||
|
@ -278,13 +278,16 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
|
||||||
|
|
||||||
public boolean isKeyboardAvailable() {
|
public boolean isKeyboardAvailable() {
|
||||||
if (mInputView != null)
|
if (mInputView != null)
|
||||||
return mInputView.getLatinKeyboard() != null;
|
return mInputView.getKeyboard() != null;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private LatinKeyboard getLatinKeyboard() {
|
public LatinKeyboard getLatinKeyboard() {
|
||||||
if (mInputView != null)
|
if (mInputView != null) {
|
||||||
return mInputView.getLatinKeyboard();
|
final Keyboard keyboard = mInputView.getKeyboard();
|
||||||
|
if (keyboard instanceof LatinKeyboard)
|
||||||
|
return (LatinKeyboard)keyboard;
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -550,7 +553,7 @@ public class KeyboardSwitcher implements SharedPreferences.OnSharedPreferenceCha
|
||||||
// indicator, we need to call enableShiftLock() and setShiftLocked(false).
|
// indicator, we need to call enableShiftLock() and setShiftLocked(false).
|
||||||
keyboard.setShifted(false);
|
keyboard.setShifted(false);
|
||||||
}
|
}
|
||||||
mInputView.setKeyboard(keyboard);
|
setKeyboard(keyboard);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isInMomentaryAutoModeSwitchState() {
|
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();
|
final LatinKeyboard oldKeyboard = getLatinKeyboard();
|
||||||
if (oldKeyboard != null) {
|
if (oldKeyboard != null) {
|
||||||
// Reset old keyboard state before switching to new keyboard.
|
// Reset old keyboard state before switching to new keyboard.
|
||||||
|
@ -80,7 +81,7 @@ public class LatinKeyboardView extends KeyboardView {
|
||||||
mLastRowY = (newKeyboard.getHeight() * 3) / 4;
|
mLastRowY = (newKeyboard.getHeight() * 3) / 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LatinKeyboard getLatinKeyboard() {
|
private LatinKeyboard getLatinKeyboard() {
|
||||||
Keyboard keyboard = getKeyboard();
|
Keyboard keyboard = getKeyboard();
|
||||||
if (keyboard instanceof LatinKeyboard) {
|
if (keyboard instanceof LatinKeyboard) {
|
||||||
return (LatinKeyboard)keyboard;
|
return (LatinKeyboard)keyboard;
|
||||||
|
|
|
@ -321,7 +321,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
removeMessages(MSG_DISMISS_LANGUAGE_ON_SPACEBAR);
|
removeMessages(MSG_DISMISS_LANGUAGE_ON_SPACEBAR);
|
||||||
final LatinKeyboardView inputView = mKeyboardSwitcher.getInputView();
|
final LatinKeyboardView inputView = mKeyboardSwitcher.getInputView();
|
||||||
if (inputView != null) {
|
if (inputView != null) {
|
||||||
final LatinKeyboard keyboard = inputView.getLatinKeyboard();
|
final LatinKeyboard keyboard = mKeyboardSwitcher.getLatinKeyboard();
|
||||||
// The language is never displayed when the delay is zero.
|
// The language is never displayed when the delay is zero.
|
||||||
if (mConfigDelayBeforeFadeoutLanguageOnSpacebar != 0)
|
if (mConfigDelayBeforeFadeoutLanguageOnSpacebar != 0)
|
||||||
inputView.setSpacebarTextFadeFactor(localeChanged ? 1.0f
|
inputView.setSpacebarTextFadeFactor(localeChanged ? 1.0f
|
||||||
|
|
|
@ -371,12 +371,10 @@ public class SubtypeSwitcher {
|
||||||
ConnectivityManager.EXTRA_NO_CONNECTIVITY, false);
|
ConnectivityManager.EXTRA_NO_CONNECTIVITY, false);
|
||||||
mIsNetworkConnected = !noConnection;
|
mIsNetworkConnected = !noConnection;
|
||||||
|
|
||||||
final LatinKeyboardView inputView = KeyboardSwitcher.getInstance().getInputView();
|
final KeyboardSwitcher switcher = KeyboardSwitcher.getInstance();
|
||||||
if (inputView != null) {
|
final LatinKeyboard keyboard = switcher.getLatinKeyboard();
|
||||||
final LatinKeyboard keyboard = inputView.getLatinKeyboard();
|
if (keyboard != null) {
|
||||||
if (keyboard != null) {
|
keyboard.updateShortcutKey(isShortcutAvailable(), switcher.getInputView());
|
||||||
keyboard.updateShortcutKey(isShortcutAvailable(), inputView);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue