am 96d31df8: Fix when to show input view
* commit '96d31df8c452a2a6230a5e8c03b0cab1ab13ff80': Fix when to show input viewmain
commit
3e72459135
|
@ -254,8 +254,9 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onToggleEmojiKeyboard() {
|
public void onToggleEmojiKeyboard() {
|
||||||
if (mKeyboardLayoutSet == null || !isShowingEmojiPalettes()) {
|
final boolean needsToLoadKeyboard = (mKeyboardLayoutSet == null);
|
||||||
mLatinIME.startShowingInputView();
|
if (needsToLoadKeyboard || !isShowingEmojiPalettes()) {
|
||||||
|
mLatinIME.startShowingInputView(needsToLoadKeyboard);
|
||||||
setEmojiKeyboard();
|
setEmojiKeyboard();
|
||||||
} else {
|
} else {
|
||||||
mLatinIME.stopShowingInputView();
|
mLatinIME.stopShowingInputView();
|
||||||
|
|
|
@ -733,6 +733,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
public void setInputView(final View view) {
|
public void setInputView(final View view) {
|
||||||
super.setInputView(view);
|
super.setInputView(view);
|
||||||
mInputView = view;
|
mInputView = view;
|
||||||
|
updateSoftInputWindowLayoutParameters();
|
||||||
mSuggestionStripView = (SuggestionStripView)view.findViewById(R.id.suggestion_strip_view);
|
mSuggestionStripView = (SuggestionStripView)view.findViewById(R.id.suggestion_strip_view);
|
||||||
if (hasSuggestionStripView()) {
|
if (hasSuggestionStripView()) {
|
||||||
mSuggestionStripView.setListener(this, view);
|
mSuggestionStripView.setListener(this, view);
|
||||||
|
@ -1147,6 +1148,10 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
@Override
|
@Override
|
||||||
public void onComputeInsets(final InputMethodService.Insets outInsets) {
|
public void onComputeInsets(final InputMethodService.Insets outInsets) {
|
||||||
super.onComputeInsets(outInsets);
|
super.onComputeInsets(outInsets);
|
||||||
|
// This method may be called before {@link #setInputView(View)}.
|
||||||
|
if (mInputView == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
final SettingsValues settingsValues = mSettings.getCurrent();
|
final SettingsValues settingsValues = mSettings.getCurrent();
|
||||||
final View visibleKeyboardView = mKeyboardSwitcher.getVisibleKeyboardView();
|
final View visibleKeyboardView = mKeyboardSwitcher.getVisibleKeyboardView();
|
||||||
if (visibleKeyboardView == null || !hasSuggestionStripView()) {
|
if (visibleKeyboardView == null || !hasSuggestionStripView()) {
|
||||||
|
@ -1181,18 +1186,29 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
outInsets.visibleTopInsets = visibleTopY;
|
outInsets.visibleTopInsets = visibleTopY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startShowingInputView() {
|
public void startShowingInputView(final boolean needsToLoadKeyboard) {
|
||||||
mIsExecutingStartShowingInputView = true;
|
mIsExecutingStartShowingInputView = true;
|
||||||
// This {@link #showWindow(boolean)} will eventually call back
|
// This {@link #showWindow(boolean)} will eventually call back
|
||||||
// {@link #onEvaluateInputViewShown()}.
|
// {@link #onEvaluateInputViewShown()}.
|
||||||
showWindow(true /* showInput */);
|
showWindow(true /* showInput */);
|
||||||
mIsExecutingStartShowingInputView = false;
|
mIsExecutingStartShowingInputView = false;
|
||||||
|
if (needsToLoadKeyboard) {
|
||||||
|
loadKeyboard();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void stopShowingInputView() {
|
public void stopShowingInputView() {
|
||||||
showWindow(false /* showInput */);
|
showWindow(false /* showInput */);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onShowInputRequested(final int flags, final boolean configChange) {
|
||||||
|
if (Settings.getInstance().getCurrent().mHasHardwareKeyboard) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return super.onShowInputRequested(flags, configChange);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onEvaluateInputViewShown() {
|
public boolean onEvaluateInputViewShown() {
|
||||||
if (mIsExecutingStartShowingInputView) {
|
if (mIsExecutingStartShowingInputView) {
|
||||||
|
@ -1223,8 +1239,14 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateFullscreenMode() {
|
public void updateFullscreenMode() {
|
||||||
|
super.updateFullscreenMode();
|
||||||
|
mInputLogic.onUpdateFullscreenMode(isFullscreenMode());
|
||||||
|
updateSoftInputWindowLayoutParameters();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateSoftInputWindowLayoutParameters() {
|
||||||
// Override layout parameters to expand {@link SoftInputWindow} to the entire screen.
|
// Override layout parameters to expand {@link SoftInputWindow} to the entire screen.
|
||||||
// See {@link InputMethodService#setinputView(View) and
|
// See {@link InputMethodService#setinputView(View)} and
|
||||||
// {@link SoftInputWindow#updateWidthHeight(WindowManager.LayoutParams)}.
|
// {@link SoftInputWindow#updateWidthHeight(WindowManager.LayoutParams)}.
|
||||||
final Window window = getWindow().getWindow();
|
final Window window = getWindow().getWindow();
|
||||||
ViewLayoutUtils.updateLayoutHeightOf(window, LayoutParams.MATCH_PARENT);
|
ViewLayoutUtils.updateLayoutHeightOf(window, LayoutParams.MATCH_PARENT);
|
||||||
|
@ -1243,8 +1265,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
ViewLayoutUtils.updateLayoutGravityOf(inputArea, Gravity.BOTTOM);
|
ViewLayoutUtils.updateLayoutGravityOf(inputArea, Gravity.BOTTOM);
|
||||||
ViewLayoutUtils.updateLayoutHeightOf(mInputView, layoutHeight);
|
ViewLayoutUtils.updateLayoutHeightOf(mInputView, layoutHeight);
|
||||||
}
|
}
|
||||||
super.updateFullscreenMode();
|
|
||||||
mInputLogic.onUpdateFullscreenMode(isFullscreenMode());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getCurrentAutoCapsState() {
|
private int getCurrentAutoCapsState() {
|
||||||
|
|
Loading…
Reference in New Issue