Merge "Add an option to prevent insertion of suggestion spans"
This commit is contained in:
commit
66a5884ad8
4 changed files with 23 additions and 3 deletions
|
@ -75,6 +75,11 @@
|
||||||
<!-- Description for option enabling or disabling the use of names of people in Contacts for suggestion and correction [CHAR LIMIT=65] -->
|
<!-- Description for option enabling or disabling the use of names of people in Contacts for suggestion and correction [CHAR LIMIT=65] -->
|
||||||
<string name="use_contacts_dict_summary">Use names from Contacts for suggestions and corrections</string>
|
<string name="use_contacts_dict_summary">Use names from Contacts for suggestions and corrections</string>
|
||||||
|
|
||||||
|
<!-- Option name for enabling insertion of suggestion spans (advanced option) [CHAR LIMIT=25] -->
|
||||||
|
<string name="enable_span_insert">Enable recorrections</string>
|
||||||
|
<!-- Option summary for enabling insertion of suggestion spans (advanced option) [CHAR LIMIT=65] -->
|
||||||
|
<string name="enable_span_insert_summary">Set suggestions for recorrections</string>
|
||||||
|
|
||||||
<!-- Option to enable auto capitalization of sentences -->
|
<!-- Option to enable auto capitalization of sentences -->
|
||||||
<string name="auto_cap">Auto-capitalization</string>
|
<string name="auto_cap">Auto-capitalization</string>
|
||||||
|
|
||||||
|
|
|
@ -132,6 +132,12 @@
|
||||||
android:summary="@string/bigram_suggestion_summary"
|
android:summary="@string/bigram_suggestion_summary"
|
||||||
android:persistent="true"
|
android:persistent="true"
|
||||||
android:defaultValue="true" />
|
android:defaultValue="true" />
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:key="enable_span_insert"
|
||||||
|
android:title="@string/enable_span_insert"
|
||||||
|
android:summary="@string/enable_span_insert_summary"
|
||||||
|
android:persistent="true"
|
||||||
|
android:defaultValue="true" />
|
||||||
<!-- TODO: evaluate results and revive this option. The code already supports it. -->
|
<!-- TODO: evaluate results and revive this option. The code already supports it. -->
|
||||||
<!-- <CheckBoxPreference -->
|
<!-- <CheckBoxPreference -->
|
||||||
<!-- android:key="bigram_prediction" -->
|
<!-- android:key="bigram_prediction" -->
|
||||||
|
|
|
@ -1807,9 +1807,13 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
||||||
final InputConnection ic = getCurrentInputConnection();
|
final InputConnection ic = getCurrentInputConnection();
|
||||||
if (ic != null) {
|
if (ic != null) {
|
||||||
mVoiceProxy.rememberReplacedWord(bestWord, mSettingsValues.mWordSeparators);
|
mVoiceProxy.rememberReplacedWord(bestWord, mSettingsValues.mWordSeparators);
|
||||||
SuggestedWords suggestedWords = mSuggestionsView.getSuggestions();
|
if (mSettingsValues.mEnableSuggestionSpanInsertion) {
|
||||||
ic.commitText(SuggestionSpanUtils.getTextWithSuggestionSpan(
|
final SuggestedWords suggestedWords = mSuggestionsView.getSuggestions();
|
||||||
this, bestWord, suggestedWords), 1);
|
ic.commitText(SuggestionSpanUtils.getTextWithSuggestionSpan(
|
||||||
|
this, bestWord, suggestedWords), 1);
|
||||||
|
} else {
|
||||||
|
ic.commitText(bestWord, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
mRecorrection.saveRecorrectionSuggestion(mWordComposer, bestWord);
|
mRecorrection.saveRecorrectionSuggestion(mWordComposer, bestWord);
|
||||||
mHasUncommittedTypedChars = false;
|
mHasUncommittedTypedChars = false;
|
||||||
|
|
|
@ -82,6 +82,8 @@ public class Settings extends InputMethodSettingsActivity
|
||||||
"pref_key_preview_popup_dismiss_delay";
|
"pref_key_preview_popup_dismiss_delay";
|
||||||
public static final String PREF_KEY_USE_CONTACTS_DICT =
|
public static final String PREF_KEY_USE_CONTACTS_DICT =
|
||||||
"pref_key_use_contacts_dict";
|
"pref_key_use_contacts_dict";
|
||||||
|
public static final String PREF_KEY_ENABLE_SPAN_INSERT =
|
||||||
|
"enable_span_insert";
|
||||||
|
|
||||||
public static final String PREF_USABILITY_STUDY_MODE = "usability_study_mode";
|
public static final String PREF_USABILITY_STUDY_MODE = "usability_study_mode";
|
||||||
|
|
||||||
|
@ -117,6 +119,7 @@ public class Settings extends InputMethodSettingsActivity
|
||||||
// Prediction: use bigrams to predict the next word when there is no input for it yet
|
// Prediction: use bigrams to predict the next word when there is no input for it yet
|
||||||
public final boolean mBigramPredictionEnabled;
|
public final boolean mBigramPredictionEnabled;
|
||||||
public final boolean mUseContactsDict;
|
public final boolean mUseContactsDict;
|
||||||
|
public final boolean mEnableSuggestionSpanInsertion;
|
||||||
|
|
||||||
private final boolean mShowSettingsKey;
|
private final boolean mShowSettingsKey;
|
||||||
private final boolean mVoiceKeyEnabled;
|
private final boolean mVoiceKeyEnabled;
|
||||||
|
@ -179,6 +182,8 @@ public class Settings extends InputMethodSettingsActivity
|
||||||
&& isBigramPredictionEnabled(prefs, res);
|
&& isBigramPredictionEnabled(prefs, res);
|
||||||
mAutoCorrectionThreshold = getAutoCorrectionThreshold(prefs, res);
|
mAutoCorrectionThreshold = getAutoCorrectionThreshold(prefs, res);
|
||||||
mUseContactsDict = prefs.getBoolean(Settings.PREF_KEY_USE_CONTACTS_DICT, true);
|
mUseContactsDict = prefs.getBoolean(Settings.PREF_KEY_USE_CONTACTS_DICT, true);
|
||||||
|
mEnableSuggestionSpanInsertion =
|
||||||
|
prefs.getBoolean(Settings.PREF_KEY_ENABLE_SPAN_INSERT, true);
|
||||||
final boolean defaultShowSettingsKey = res.getBoolean(
|
final boolean defaultShowSettingsKey = res.getBoolean(
|
||||||
R.bool.config_default_show_settings_key);
|
R.bool.config_default_show_settings_key);
|
||||||
mShowSettingsKey = isShowSettingsKeyOption(res)
|
mShowSettingsKey = isShowSettingsKeyOption(res)
|
||||||
|
|
Loading…
Reference in a new issue