aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/com/android/inputmethod')
-rw-r--r--java/src/com/android/inputmethod/keyboard/Keyboard.java7
-rw-r--r--java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java5
-rw-r--r--java/src/com/android/inputmethod/keyboard/ProximityInfo.java28
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java28
4 files changed, 40 insertions, 28 deletions
diff --git a/java/src/com/android/inputmethod/keyboard/Keyboard.java b/java/src/com/android/inputmethod/keyboard/Keyboard.java
index 85dfea4e7..d35c8fae1 100644
--- a/java/src/com/android/inputmethod/keyboard/Keyboard.java
+++ b/java/src/com/android/inputmethod/keyboard/Keyboard.java
@@ -108,10 +108,9 @@ public class Keyboard {
mAltCodeKeysWhileTyping = Collections.unmodifiableList(params.mAltCodeKeysWhileTyping);
mIconsSet = params.mIconsSet;
- mProximityInfo = new ProximityInfo(params.mId.mLocale.toString(),
- params.GRID_WIDTH, params.GRID_HEIGHT, mOccupiedWidth, mOccupiedHeight,
- mMostCommonKeyWidth, mMostCommonKeyHeight, mSortedKeys,
- params.mTouchPositionCorrection);
+ mProximityInfo = new ProximityInfo(params.GRID_WIDTH, params.GRID_HEIGHT,
+ mOccupiedWidth, mOccupiedHeight, mMostCommonKeyWidth, mMostCommonKeyHeight,
+ mSortedKeys, params.mTouchPositionCorrection);
mProximityCharsCorrectionEnabled = params.mProximityCharsCorrectionEnabled;
}
diff --git a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
index 246d11bac..7f2957fff 100644
--- a/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
+++ b/java/src/com/android/inputmethod/keyboard/KeyboardSwitcher.java
@@ -254,8 +254,9 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
}
public void onToggleEmojiKeyboard() {
- if (mKeyboardLayoutSet == null || !isShowingEmojiPalettes()) {
- mLatinIME.startShowingInputView();
+ final boolean needsToLoadKeyboard = (mKeyboardLayoutSet == null);
+ if (needsToLoadKeyboard || !isShowingEmojiPalettes()) {
+ mLatinIME.startShowingInputView(needsToLoadKeyboard);
setEmojiKeyboard();
} else {
mLatinIME.stopShowingInputView();
diff --git a/java/src/com/android/inputmethod/keyboard/ProximityInfo.java b/java/src/com/android/inputmethod/keyboard/ProximityInfo.java
index c19cd671a..9c5abcd71 100644
--- a/java/src/com/android/inputmethod/keyboard/ProximityInfo.java
+++ b/java/src/com/android/inputmethod/keyboard/ProximityInfo.java
@@ -52,18 +52,11 @@ public class ProximityInfo {
private final int mMostCommonKeyHeight;
private final List<Key> mSortedKeys;
private final List<Key>[] mGridNeighbors;
- private final String mLocaleStr;
@SuppressWarnings("unchecked")
- ProximityInfo(final String localeStr, final int gridWidth, final int gridHeight,
- final int minWidth, final int height, final int mostCommonKeyWidth,
- final int mostCommonKeyHeight, final List<Key> sortedKeys,
+ ProximityInfo(final int gridWidth, final int gridHeight, final int minWidth, final int height,
+ final int mostCommonKeyWidth, final int mostCommonKeyHeight, final List<Key> sortedKeys,
final TouchPositionCorrection touchPositionCorrection) {
- if (TextUtils.isEmpty(localeStr)) {
- mLocaleStr = "";
- } else {
- mLocaleStr = localeStr;
- }
mGridWidth = gridWidth;
mGridHeight = gridHeight;
mGridSize = mGridWidth * mGridHeight;
@@ -89,11 +82,10 @@ public class ProximityInfo {
}
// TODO: Stop passing proximityCharsArray
- private static native long setProximityInfoNative(String locale,
- int displayWidth, int displayHeight, int gridWidth, int gridHeight,
- int mostCommonKeyWidth, int mostCommonKeyHeight, int[] proximityCharsArray,
- int keyCount, int[] keyXCoordinates, int[] keyYCoordinates, int[] keyWidths,
- int[] keyHeights, int[] keyCharCodes, float[] sweetSpotCenterXs,
+ private static native long setProximityInfoNative(int displayWidth, int displayHeight,
+ int gridWidth, int gridHeight, int mostCommonKeyWidth, int mostCommonKeyHeight,
+ int[] proximityCharsArray, int keyCount, int[] keyXCoordinates, int[] keyYCoordinates,
+ int[] keyWidths, int[] keyHeights, int[] keyCharCodes, float[] sweetSpotCenterXs,
float[] sweetSpotCenterYs, float[] sweetSpotRadii);
private static native void releaseProximityInfoNative(long nativeProximityInfo);
@@ -221,10 +213,10 @@ public class ProximityInfo {
}
// TODO: Stop passing proximityCharsArray
- return setProximityInfoNative(mLocaleStr, mKeyboardMinWidth, mKeyboardHeight,
- mGridWidth, mGridHeight, mMostCommonKeyWidth, mMostCommonKeyHeight,
- proximityCharsArray, keyCount, keyXCoordinates, keyYCoordinates, keyWidths,
- keyHeights, keyCharCodes, sweetSpotCenterXs, sweetSpotCenterYs, sweetSpotRadii);
+ return setProximityInfoNative(mKeyboardMinWidth, mKeyboardHeight, mGridWidth, mGridHeight,
+ mMostCommonKeyWidth, mMostCommonKeyHeight, proximityCharsArray, keyCount,
+ keyXCoordinates, keyYCoordinates, keyWidths, keyHeights, keyCharCodes,
+ sweetSpotCenterXs, sweetSpotCenterYs, sweetSpotRadii);
}
public long getNativeProximityInfo() {
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 861a8903e..be2efb2dc 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -733,6 +733,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
public void setInputView(final View view) {
super.setInputView(view);
mInputView = view;
+ updateSoftInputWindowLayoutParameters();
mSuggestionStripView = (SuggestionStripView)view.findViewById(R.id.suggestion_strip_view);
if (hasSuggestionStripView()) {
mSuggestionStripView.setListener(this, view);
@@ -1147,6 +1148,10 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
@Override
public void onComputeInsets(final InputMethodService.Insets outInsets) {
super.onComputeInsets(outInsets);
+ // This method may be called before {@link #setInputView(View)}.
+ if (mInputView == null) {
+ return;
+ }
final SettingsValues settingsValues = mSettings.getCurrent();
final View visibleKeyboardView = mKeyboardSwitcher.getVisibleKeyboardView();
if (visibleKeyboardView == null || !hasSuggestionStripView()) {
@@ -1181,12 +1186,15 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
outInsets.visibleTopInsets = visibleTopY;
}
- public void startShowingInputView() {
+ public void startShowingInputView(final boolean needsToLoadKeyboard) {
mIsExecutingStartShowingInputView = true;
// This {@link #showWindow(boolean)} will eventually call back
// {@link #onEvaluateInputViewShown()}.
showWindow(true /* showInput */);
mIsExecutingStartShowingInputView = false;
+ if (needsToLoadKeyboard) {
+ loadKeyboard();
+ }
}
public void stopShowingInputView() {
@@ -1194,6 +1202,14 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
}
@Override
+ public boolean onShowInputRequested(final int flags, final boolean configChange) {
+ if (Settings.getInstance().getCurrent().mHasHardwareKeyboard) {
+ return true;
+ }
+ return super.onShowInputRequested(flags, configChange);
+ }
+
+ @Override
public boolean onEvaluateInputViewShown() {
if (mIsExecutingStartShowingInputView) {
return true;
@@ -1223,8 +1239,14 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
@Override
public void updateFullscreenMode() {
+ super.updateFullscreenMode();
+ mInputLogic.onUpdateFullscreenMode(isFullscreenMode());
+ updateSoftInputWindowLayoutParameters();
+ }
+
+ private void updateSoftInputWindowLayoutParameters() {
// 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)}.
final Window window = getWindow().getWindow();
ViewLayoutUtils.updateLayoutHeightOf(window, LayoutParams.MATCH_PARENT);
@@ -1243,8 +1265,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
ViewLayoutUtils.updateLayoutGravityOf(inputArea, Gravity.BOTTOM);
ViewLayoutUtils.updateLayoutHeightOf(mInputView, layoutHeight);
}
- super.updateFullscreenMode();
- mInputLogic.onUpdateFullscreenMode(isFullscreenMode());
}
private int getCurrentAutoCapsState() {