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.java30
1 files changed, 12 insertions, 18 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 05aa305f5..cedf3c4b6 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;
@@ -776,7 +775,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
inputType, attribute.imeOptions));
}
- mShouldInsertMagicSpace = false;
+ mInsertSpaceOnPickSuggestionManually = false;
mInputTypeNoAutoCorrect = false;
mIsSettingsSuggestionStripOn = false;
mApplicationSpecifiedCompletionOn = false;
@@ -791,9 +790,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;
@@ -1815,8 +1816,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 +1851,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 +2145,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 +2328,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);