am 6d915037: Merge "Fix a bug where emojis would remove the suggestion strip." into klp-dev

* commit '6d91503727a6d5b4eb942c56ee3f640984ae31a4':
  Fix a bug where emojis would remove the suggestion strip.
This commit is contained in:
Satoshi Kataoka 2013-10-11 05:05:09 -07:00 committed by Android Git Automerger
commit ac6d0c656e
2 changed files with 15 additions and 9 deletions

View file

@ -155,7 +155,7 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
} }
public void saveKeyboardState() { public void saveKeyboardState() {
if (getKeyboard() != null || isShowingEmojiKeyboard()) { if (getKeyboard() != null || isShowingEmojiPalettes()) {
mState.onSaveKeyboardState(); mState.onSaveKeyboardState();
} }
} }
@ -316,19 +316,23 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
mState.onCodeInput(code, mLatinIME.getCurrentAutoCapsState()); mState.onCodeInput(code, mLatinIME.getCurrentAutoCapsState());
} }
public boolean isShowingEmojiKeyboard() { private boolean isShowingMainKeyboard() {
return mEmojiPalettesView != null && mEmojiPalettesView.getVisibility() == View.VISIBLE; return null != mKeyboardView && mKeyboardView.isShown();
}
public boolean isShowingEmojiPalettes() {
return mEmojiPalettesView != null && mEmojiPalettesView.isShown();
} }
public boolean isShowingMoreKeysPanel() { public boolean isShowingMoreKeysPanel() {
if (isShowingEmojiKeyboard()) { if (isShowingEmojiPalettes()) {
return false; return false;
} }
return mKeyboardView.isShowingMoreKeysPanel(); return mKeyboardView.isShowingMoreKeysPanel();
} }
public View getVisibleKeyboardView() { public View getVisibleKeyboardView() {
if (isShowingEmojiKeyboard()) { if (isShowingEmojiPalettes()) {
return mEmojiPalettesView; return mEmojiPalettesView;
} }
return mKeyboardView; return mKeyboardView;
@ -348,6 +352,10 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
} }
} }
public boolean isShowingMainKeyboardOrEmojiPalettes() {
return isShowingMainKeyboard() || isShowingEmojiPalettes();
}
public View onCreateInputView(final boolean isHardwareAcceleratedDrawingEnabled) { public View onCreateInputView(final boolean isHardwareAcceleratedDrawingEnabled) {
if (mKeyboardView != null) { if (mKeyboardView != null) {
mKeyboardView.closing(); mKeyboardView.closing();

View file

@ -1261,9 +1261,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
final boolean needsInputViewShown) { final boolean needsInputViewShown) {
// TODO: Modify this if we support suggestions with hard keyboard // TODO: Modify this if we support suggestions with hard keyboard
if (onEvaluateInputViewShown() && mSuggestionStripView != null) { if (onEvaluateInputViewShown() && mSuggestionStripView != null) {
final MainKeyboardView mainKeyboardView = mKeyboardSwitcher.getMainKeyboardView(); final boolean inputViewShown = mKeyboardSwitcher.isShowingMainKeyboardOrEmojiPalettes();
final boolean inputViewShown = (mainKeyboardView != null)
? mainKeyboardView.isShown() : false;
final boolean shouldShowSuggestions = shown final boolean shouldShowSuggestions = shown
&& (needsInputViewShown ? inputViewShown : true); && (needsInputViewShown ? inputViewShown : true);
if (isFullscreenMode()) { if (isFullscreenMode()) {
@ -1329,7 +1327,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
if (visibleKeyboardView.isShown()) { if (visibleKeyboardView.isShown()) {
// Note that the height of Emoji layout is the same as the height of the main keyboard // Note that the height of Emoji layout is the same as the height of the main keyboard
// and the suggestion strip // and the suggestion strip
if (mKeyboardSwitcher.isShowingEmojiKeyboard() if (mKeyboardSwitcher.isShowingEmojiPalettes()
|| mSuggestionStripView.getVisibility() == View.VISIBLE) { || mSuggestionStripView.getVisibility() == View.VISIBLE) {
visibleTopY -= suggestionsHeight; visibleTopY -= suggestionsHeight;
} }