aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/LatinIME.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/com/android/inputmethod/latin/LatinIME.java')
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java44
1 files changed, 21 insertions, 23 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 05aa305f5..d57154ad5 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -28,7 +28,6 @@ import android.content.res.Resources;
import android.inputmethodservice.InputMethodService;
import android.media.AudioManager;
import android.net.ConnectivityManager;
-import android.os.Build;
import android.os.Debug;
import android.os.Message;
import android.os.SystemClock;
@@ -182,7 +181,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
// TODO: Create an inner class to group options and pseudo-options to improve readability.
// These variables are initialized according to the {@link EditorInfo#inputType}.
- private boolean mShouldInsertMagicSpace;
+ private boolean mInsertSpaceOnPickSuggestionManually;
private boolean mInputTypeNoAutoCorrect;
private boolean mIsSettingsSuggestionStripOn;
private boolean mApplicationSpecifiedCompletionOn;
@@ -373,6 +372,8 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
private boolean mHasPendingFinishInput;
public void startOrientationChanging() {
+ removeMessages(MSG_PENDING_IMS_CALLBACK);
+ resetPendingImsCallback();
mIsOrientationChanging = true;
final LatinIME latinIme = getOuterInstance();
latinIme.mKeyboardSwitcher.saveKeyboardState();
@@ -718,6 +719,9 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
voiceIme.resetVoiceStates(InputTypeCompatUtils.isPasswordInputType(inputType)
|| InputTypeCompatUtils.isVisiblePasswordInputType(inputType));
+ // The EditorInfo might have a flag that affects fullscreen mode.
+ // Note: This call should be done by InputMethodService?
+ updateFullscreenMode();
initializeInputAttributes(attribute);
inputView.closing();
@@ -734,7 +738,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
if (mSuggest != null && mSettingsValues.mAutoCorrectEnabled) {
mSuggest.setAutoCorrectionThreshold(mSettingsValues.mAutoCorrectionThreshold);
- }
+ }
mVoiceProxy.loadSettings(attribute, mPrefs);
// This will work only when the subtype is not supported.
LanguageSwitcherProxy.loadSettings();
@@ -745,8 +749,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
if (mSuggestionsView != null)
mSuggestionsView.clear();
- // The EditorInfo might have a flag that affects fullscreen mode.
- updateFullscreenMode();
setSuggestionStripShownInternal(
isSuggestionsStripVisible(), /* needsInputViewShown */ false);
// Delay updating suggestions because keyboard input view may not be shown at this point.
@@ -776,7 +778,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
inputType, attribute.imeOptions));
}
- mShouldInsertMagicSpace = false;
+ mInsertSpaceOnPickSuggestionManually = false;
mInputTypeNoAutoCorrect = false;
mIsSettingsSuggestionStripOn = false;
mApplicationSpecifiedCompletionOn = false;
@@ -791,9 +793,11 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
}
if (InputTypeCompatUtils.isEmailVariation(variation)
|| variation == InputType.TYPE_TEXT_VARIATION_PERSON_NAME) {
- mShouldInsertMagicSpace = false;
+ // The point in turning this off is that we don't want to insert a space after
+ // a name when filling a form: we can't delete trailing spaces when changing fields
+ mInsertSpaceOnPickSuggestionManually = false;
} else {
- mShouldInsertMagicSpace = true;
+ mInsertSpaceOnPickSuggestionManually = true;
}
if (InputTypeCompatUtils.isEmailVariation(variation)) {
mIsSettingsSuggestionStripOn = false;
@@ -1058,9 +1062,9 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
super.updateFullscreenMode();
if (mKeyPreviewBackingView == null) return;
- // In extract mode, no need to have extra space to show the key preview.
+ // In fullscreen mode, no need to have extra space to show the key preview.
// If not, we should have extra space above the keyboard to show the key preview.
- mKeyPreviewBackingView.setVisibility(isExtractViewShown() ? View.GONE : View.VISIBLE);
+ mKeyPreviewBackingView.setVisibility(isFullscreenMode() ? View.GONE : View.VISIBLE);
}
@Override
@@ -1589,6 +1593,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
}
public boolean isShowingPunctuationList() {
+ if (mSuggestionsView == null) return false;
return mSettingsValues.mSuggestPuncList == mSuggestionsView.getSuggestions();
}
@@ -1815,8 +1820,8 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
final int rawPrimaryCode = suggestion.charAt(0);
// Maybe apply the "bidi mirrored" conversions for parentheses
final LatinKeyboard keyboard = mKeyboardSwitcher.getLatinKeyboard();
- final int primaryCode = Key.getRtlParenthesisCode(
- rawPrimaryCode, keyboard.mIsRtlKeyboard);
+ final boolean isRtl = keyboard != null && keyboard.mIsRtlKeyboard;
+ final int primaryCode = Key.getRtlParenthesisCode(rawPrimaryCode, isRtl);
final CharSequence beforeText = ic != null ? ic.getTextBeforeCursor(1, 0) : "";
final int toLeft = (ic == null || TextUtils.isEmpty(beforeText))
@@ -1850,7 +1855,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
suggestion.toString(), index, suggestions.mWords);
TextEntryState.acceptedSuggestion(mComposingStringBuilder.toString(), suggestion);
// Follow it with a space
- if (mShouldInsertMagicSpace && !recorrecting) {
+ if (mInsertSpaceOnPickSuggestionManually && !recorrecting) {
sendMagicSpace();
}
@@ -2144,16 +2149,9 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
}
};
- // update sound effect volume
+ // update keypress sound volume
private void updateSoundEffectVolume() {
- final String[] volumePerHardwareList = mResources.getStringArray(R.array.keypress_volumes);
- final String hardwarePrefix = Build.HARDWARE + ",";
- for (final String element : volumePerHardwareList) {
- if (element.startsWith(hardwarePrefix)) {
- mFxVolume = Float.parseFloat(element.substring(element.lastIndexOf(',') + 1));
- break;
- }
- }
+ mFxVolume = Utils.getCurrentKeypressSoundVolume(mPrefs, mResources);
}
// update flags for silent mode
@@ -2334,7 +2332,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
p.println(" mCorrectionMode=" + mCorrectionMode);
p.println(" mHasUncommittedTypedChars=" + mHasUncommittedTypedChars);
p.println(" mAutoCorrectEnabled=" + mSettingsValues.mAutoCorrectEnabled);
- p.println(" mShouldInsertMagicSpace=" + mShouldInsertMagicSpace);
+ p.println(" mInsertSpaceOnPickSuggestionManually=" + mInsertSpaceOnPickSuggestionManually);
p.println(" mApplicationSpecifiedCompletionOn=" + mApplicationSpecifiedCompletionOn);
p.println(" TextEntryState.state=" + TextEntryState.getState());
p.println(" mSoundOn=" + mSettingsValues.mSoundOn);