Browser text fields should suggest but not auto correct.
Only if the browser explicitly specifies the AUTO_CORRECT flag, IME will enable auto correction.
This commit is contained in:
parent
5e8a2fc5d5
commit
6c7c8f5b47
1 changed files with 21 additions and 6 deletions
|
@ -113,7 +113,6 @@ public class LatinIME extends InputMethodService
|
||||||
private boolean mAutoCap;
|
private boolean mAutoCap;
|
||||||
private boolean mQuickFixes;
|
private boolean mQuickFixes;
|
||||||
private boolean mShowSuggestions;
|
private boolean mShowSuggestions;
|
||||||
private boolean mAutoComplete;
|
|
||||||
private int mCorrectionMode;
|
private int mCorrectionMode;
|
||||||
// Indicates whether the suggestion strip is to be on in landscape
|
// Indicates whether the suggestion strip is to be on in landscape
|
||||||
private boolean mJustAccepted;
|
private boolean mJustAccepted;
|
||||||
|
@ -226,6 +225,7 @@ public class LatinIME extends InputMethodService
|
||||||
|
|
||||||
TextEntryState.newSession(this);
|
TextEntryState.newSession(this);
|
||||||
|
|
||||||
|
boolean disableAutoCorrect = false;
|
||||||
mPredictionOn = false;
|
mPredictionOn = false;
|
||||||
mCompletionOn = false;
|
mCompletionOn = false;
|
||||||
mCompletions = null;
|
mCompletions = null;
|
||||||
|
@ -271,6 +271,12 @@ public class LatinIME extends InputMethodService
|
||||||
attribute.imeOptions);
|
attribute.imeOptions);
|
||||||
} else if (variation == EditorInfo.TYPE_TEXT_VARIATION_FILTER) {
|
} else if (variation == EditorInfo.TYPE_TEXT_VARIATION_FILTER) {
|
||||||
mPredictionOn = false;
|
mPredictionOn = false;
|
||||||
|
} else if (variation == EditorInfo.TYPE_TEXT_VARIATION_WEB_EDIT_TEXT) {
|
||||||
|
// If it's a browser edit field and auto correct is not ON explicitly, then
|
||||||
|
// disable auto correction, but keep suggestions on.
|
||||||
|
if ((attribute.inputType & EditorInfo.TYPE_TEXT_FLAG_AUTO_CORRECT) == 0) {
|
||||||
|
disableAutoCorrect = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ((attribute.inputType&EditorInfo.TYPE_TEXT_FLAG_AUTO_COMPLETE) != 0) {
|
if ((attribute.inputType&EditorInfo.TYPE_TEXT_FLAG_AUTO_COMPLETE) != 0) {
|
||||||
mPredictionOn = false;
|
mPredictionOn = false;
|
||||||
|
@ -290,6 +296,13 @@ public class LatinIME extends InputMethodService
|
||||||
setCandidatesViewShown(false);
|
setCandidatesViewShown(false);
|
||||||
if (mCandidateView != null) mCandidateView.setSuggestions(null, false, false, false);
|
if (mCandidateView != null) mCandidateView.setSuggestions(null, false, false, false);
|
||||||
loadSettings();
|
loadSettings();
|
||||||
|
// Override auto correct
|
||||||
|
if (disableAutoCorrect) {
|
||||||
|
mAutoCorrectOn = false;
|
||||||
|
if (mCorrectionMode == Suggest.CORRECTION_FULL) {
|
||||||
|
mCorrectionMode = Suggest.CORRECTION_BASIC;
|
||||||
|
}
|
||||||
|
}
|
||||||
mInputView.setProximityCorrectionEnabled(true);
|
mInputView.setProximityCorrectionEnabled(true);
|
||||||
if (mSuggest != null) {
|
if (mSuggest != null) {
|
||||||
mSuggest.setCorrectionMode(mCorrectionMode);
|
mSuggest.setCorrectionMode(mCorrectionMode);
|
||||||
|
@ -1005,10 +1018,12 @@ public class LatinIME extends InputMethodService
|
||||||
// will continue to work
|
// will continue to work
|
||||||
if (AutoText.getSize(mInputView) < 1) mQuickFixes = true;
|
if (AutoText.getSize(mInputView) < 1) mQuickFixes = true;
|
||||||
mShowSuggestions = sp.getBoolean(PREF_SHOW_SUGGESTIONS, true) & mQuickFixes;
|
mShowSuggestions = sp.getBoolean(PREF_SHOW_SUGGESTIONS, true) & mQuickFixes;
|
||||||
mAutoComplete = sp.getBoolean(PREF_AUTO_COMPLETE,
|
boolean autoComplete = sp.getBoolean(PREF_AUTO_COMPLETE,
|
||||||
getResources().getBoolean(R.bool.enable_autocorrect)) & mShowSuggestions;
|
getResources().getBoolean(R.bool.enable_autocorrect)) & mShowSuggestions;
|
||||||
mAutoCorrectOn = mSuggest != null && (mAutoComplete || mQuickFixes);
|
mAutoCorrectOn = mSuggest != null && (autoComplete || mQuickFixes);
|
||||||
mCorrectionMode = mAutoComplete ? 2 : (mQuickFixes ? 1 : 0);
|
mCorrectionMode = autoComplete
|
||||||
|
? Suggest.CORRECTION_FULL
|
||||||
|
: (mQuickFixes ? Suggest.CORRECTION_BASIC : Suggest.CORRECTION_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showOptionsMenu() {
|
private void showOptionsMenu() {
|
||||||
|
|
Loading…
Reference in a new issue