todos and unused code

show debug settings in the original place in advanced settings
This commit is contained in:
Helium314 2023-09-10 21:39:56 +02:00
parent bc9150b007
commit 8840411039
11 changed files with 39 additions and 188 deletions

View file

@ -136,13 +136,6 @@ public class DictionaryFacilitatorImpl implements DictionaryFacilitator {
* A group of dictionaries that work together for a single language.
*/
private static class DictionaryGroup {
// TODO: Add null analysis annotations.
// TODO: Run evaluation to determine a reasonable value for these constants. The current
// values are ad-hoc and chosen without any particular care or methodology.
public static final float WEIGHT_FOR_MOST_PROBABLE_LANGUAGE = 1.0f;
public static final float WEIGHT_FOR_GESTURING_IN_NOT_MOST_PROBABLE_LANGUAGE = 0.95f;
public static final float WEIGHT_FOR_TYPING_IN_NOT_MOST_PROBABLE_LANGUAGE = 0.6f;
private static final int MAX_CONFIDENCE = 2;
private static final int MIN_CONFIDENCE = 0;
@ -186,26 +179,25 @@ public class DictionaryFacilitatorImpl implements DictionaryFacilitator {
}
}
// TODO: might need some more tuning, maybe more confidence steps
// todo: might need some more tuning, maybe more confidence steps
private void updateWeights() {
mWeightForTypingInLocale = 1f - 0.15f * (MAX_CONFIDENCE - mConfidence);
mWeightForGesturingInLocale = 1f - 0.05f * (MAX_CONFIDENCE - mConfidence);
}
public float mWeightForTypingInLocale = WEIGHT_FOR_MOST_PROBABLE_LANGUAGE;
public float mWeightForGesturingInLocale = WEIGHT_FOR_MOST_PROBABLE_LANGUAGE;
public float mWeightForTypingInLocale = 1f;
public float mWeightForGesturingInLocale = 1f;
public final ConcurrentHashMap<String, ExpandableBinaryDictionary> mSubDictMap =
new ConcurrentHashMap<>();
public DictionaryGroup() {
this(null /* locale */, null /* mainDict */, null /* account */,
Collections.<String, ExpandableBinaryDictionary>emptyMap() /* subDicts */);
this(null /* locale */, null /* mainDict */, null /* account */, Collections.emptyMap() /* subDicts */);
}
public DictionaryGroup(@Nullable final Locale locale,
@Nullable final Dictionary mainDict,
@Nullable final String account,
final Map<String, ExpandableBinaryDictionary> subDicts) {
@NonNull final Map<String, ExpandableBinaryDictionary> subDicts) {
mLocale = locale;
mAccount = account;
// The main dictionary can be asynchronously loaded.
@ -215,13 +207,11 @@ public class DictionaryFacilitatorImpl implements DictionaryFacilitator {
}
}
private void setSubDict(final String dictType, final ExpandableBinaryDictionary dict) {
if (dict != null) {
mSubDictMap.put(dictType, dict);
}
private void setSubDict(@NonNull final String dictType, @NonNull final ExpandableBinaryDictionary dict) {
mSubDictMap.put(dictType, dict);
}
public void setMainDict(final Dictionary mainDict) {
public void setMainDict(@Nullable final Dictionary mainDict) {
// Close old dictionary if exists. Main dictionary can be assigned multiple times.
final Dictionary oldDict = mMainDict;
mMainDict = mainDict;
@ -230,18 +220,18 @@ public class DictionaryFacilitatorImpl implements DictionaryFacilitator {
}
}
public Dictionary getDict(final String dictType) {
public @Nullable Dictionary getDict(@NonNull final String dictType) {
if (Dictionary.TYPE_MAIN.equals(dictType)) {
return mMainDict;
}
return getSubDict(dictType);
}
public ExpandableBinaryDictionary getSubDict(final String dictType) {
public @Nullable ExpandableBinaryDictionary getSubDict(@NonNull final String dictType) {
return mSubDictMap.get(dictType);
}
public boolean hasDict(final String dictType, @Nullable final String account) {
public boolean hasDict(@NonNull final String dictType, @Nullable final String account) {
if (Dictionary.TYPE_MAIN.equals(dictType)) {
return mMainDict != null;
}
@ -255,7 +245,7 @@ public class DictionaryFacilitatorImpl implements DictionaryFacilitator {
return mSubDictMap.containsKey(dictType);
}
public void closeDict(final String dictType) {
public void closeDict(@NonNull final String dictType) {
final Dictionary dict;
if (Dictionary.TYPE_MAIN.equals(dictType)) {
dict = mMainDict;
@ -480,13 +470,8 @@ public class DictionaryFacilitatorImpl implements DictionaryFacilitator {
final List<Locale> locales, final DictionaryInitializationListener listener) {
final CountDownLatch latchForWaitingLoadingMainDictionary = new CountDownLatch(1);
mLatchForWaitingLoadingMainDictionaries = latchForWaitingLoadingMainDictionary;
ExecutorUtils.getBackgroundExecutor(ExecutorUtils.KEYBOARD).execute(new Runnable() {
@Override
public void run() {
doReloadUninitializedMainDictionaries(
context, locales, listener, latchForWaitingLoadingMainDictionary);
}
});
ExecutorUtils.getBackgroundExecutor(ExecutorUtils.KEYBOARD).execute(() ->
doReloadUninitializedMainDictionaries(context, locales, listener, latchForWaitingLoadingMainDictionary));
}
void doReloadUninitializedMainDictionaries(final Context context, final List<Locale> locales,
@ -704,13 +689,9 @@ public class DictionaryFacilitatorImpl implements DictionaryFacilitator {
if (userDict != null && userHistoryDict.isInDictionary(suggestion)) {
if (userDict.isInDictionary(suggestion)) // is this check necessary?
return;
ExecutorUtils.getBackgroundExecutor(ExecutorUtils.KEYBOARD).execute(new Runnable() {
@Override
public void run() {
ExecutorUtils.getBackgroundExecutor(ExecutorUtils.KEYBOARD).execute(() ->
UserDictionary.Words.addWord(userDict.mContext, suggestion,
250 /*FREQUENCY_FOR_USER_DICTIONARY_ADDS*/, null, dictionaryGroup.mLocale);
}
});
250 /*FREQUENCY_FOR_USER_DICTIONARY_ADDS*/, null, dictionaryGroup.mLocale));
}
}
@ -828,6 +809,7 @@ public class DictionaryFacilitatorImpl implements DictionaryFacilitator {
// TODO: Revise the way to fusion suggestion results.
@Override
@SuppressWarnings("unchecked")
@NonNull public SuggestionResults getSuggestionResults(ComposedData composedData,
NgramContext ngramContext, @NonNull final Keyboard keyboard,
SettingsValuesForSuggestion settingsValuesForSuggestion, int sessionId,
@ -888,12 +870,12 @@ public class DictionaryFacilitatorImpl implements DictionaryFacilitator {
int sessionId, long proximityInfoHandle, float[] weightOfLangModelVsSpatialModel,
DictionaryGroup dictGroup) {
final ArrayList<SuggestedWordInfo> suggestions = new ArrayList<>();
final float weightForLocale = composedData.mIsBatchMode
? dictGroup.mWeightForGesturingInLocale
: dictGroup.mWeightForTypingInLocale;
for (final String dictType : ALL_DICTIONARY_TYPES) {
final Dictionary dictionary = dictGroup.getDict(dictType);
if (null == dictionary) continue;
final float weightForLocale = composedData.mIsBatchMode
? dictGroup.mWeightForGesturingInLocale
: dictGroup.mWeightForTypingInLocale;
final ArrayList<SuggestedWordInfo> dictionarySuggestions =
dictionary.getSuggestions(composedData, ngramContext,
proximityInfoHandle, settingsValuesForSuggestion, sessionId,

View file

@ -752,7 +752,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
mInputLogic.mSuggest.setAutoCorrectionThreshold(
settingsValues.mAutoCorrectionThreshold);
}
mInputLogic.mSuggest.setPlausibilityThreshold(settingsValues.mPlausibilityThreshold);
}
/**
@ -1068,8 +1067,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
suggest.setAutoCorrectionThreshold(
currentSettingsValues.mAutoCorrectionThreshold);
}
suggest.setPlausibilityThreshold(currentSettingsValues.mPlausibilityThreshold);
switcher.loadKeyboard(editorInfo, currentSettingsValues, getCurrentAutoCapsState(),
getCurrentRecapitalizeState());
if (needToCallLoadKeyboardLater) {

View file

@ -87,15 +87,6 @@ public final class Suggest {
mAutoCorrectionThreshold = threshold;
}
/**
* Set the normalized-score threshold for what we consider a "plausible" suggestion, in
* the same dimension as the auto-correction threshold.
* @param threshold the threshold
*/
public void setPlausibilityThreshold(final float threshold) {
mPlausibilityThreshold = threshold;
}
public interface OnGetSuggestedWordsCallback {
void onGetSuggestedWords(final SuggestedWords suggestedWords);
}

View file

@ -23,12 +23,14 @@ import android.content.SharedPreferences;
import android.content.res.Resources;
import android.os.Build;
import android.os.Bundle;
import android.os.Process;
import androidx.appcompat.app.AlertDialog;
import androidx.preference.Preference;
import org.dslul.openboard.inputmethod.keyboard.KeyboardLayoutSet;
import org.dslul.openboard.inputmethod.latin.AudioAndHapticFeedbackManager;
import org.dslul.openboard.inputmethod.latin.BuildConfig;
import org.dslul.openboard.inputmethod.latin.R;
import org.dslul.openboard.inputmethod.latin.SystemBroadcastReceiver;
import org.dslul.openboard.inputmethod.latin.common.FileUtils;
@ -63,9 +65,7 @@ public final class AdvancedSettingsFragment extends SubScreenFragment {
// initialization method of these classes here. See {@link LatinIME#onCreate()}.
AudioAndHapticFeedbackManager.init(context);
final SharedPreferences prefs = getSharedPreferences();
if (!Settings.isInternal(prefs)) {
if (!BuildConfig.DEBUG) {
removePreference(Settings.SCREEN_DEBUG);
}
@ -112,7 +112,7 @@ public final class AdvancedSettingsFragment extends SubScreenFragment {
FileUtils.copyStreamToNewFile(in, libfile);
Runtime.getRuntime().exit(0); // exit will restart the app, so library will be loaded
} catch (IOException e) {
// todo: should inform user
// should inform user, but probably the issues will only come when reading the library
}
}
}

View file

@ -19,7 +19,6 @@ package org.dslul.openboard.inputmethod.latin.settings;
import static org.dslul.openboard.inputmethod.latin.permissions.PermissionsManager.get;
import android.Manifest;
import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
@ -112,7 +111,7 @@ public final class CorrectionSettingsFragment extends SubScreenFragment
private void refreshEnabledSettings() {
setPreferenceVisible(Settings.PREF_AUTO_CORRECTION_CONFIDENCE,
Settings.readAutoCorrectEnabled(getSharedPreferences(), getResources()));
Settings.readAutoCorrectEnabled(getSharedPreferences()));
setPreferenceVisible(Settings.PREF_ADD_TO_PERSONAL_DICTIONARY, getSharedPreferences().getBoolean(Settings.PREF_KEY_USE_PERSONALIZED_DICTS, true));
turnOffLookupContactsIfNoPermission();
}

View file

@ -58,7 +58,7 @@ public final class DebugSettingsFragment extends SubScreenFragment
removePreference(DebugSettings.PREF_SHOULD_SHOW_LXX_SUGGESTION_UI);
}
final PreferenceGroup dictDumpPreferenceGroup = (PreferenceGroup)findPreference(PREF_KEY_DUMP_DICTS);
final PreferenceGroup dictDumpPreferenceGroup = findPreference(PREF_KEY_DUMP_DICTS);
for (final String dictName : DictionaryFacilitatorImpl.DICT_TYPE_TO_CLASS.keySet()) {
final Preference pref = new DictDumpPreference(getActivity(), dictName);
pref.setOnPreferenceClickListener(this);
@ -83,7 +83,7 @@ public final class DebugSettingsFragment extends SubScreenFragment
defaultKeyPreviewDismissEndScale);
mServiceNeedsRestart = false;
mDebugMode = (TwoStatePreference) findPreference(DebugSettings.PREF_DEBUG_MODE);
mDebugMode = findPreference(DebugSettings.PREF_DEBUG_MODE);
updateDebugMode();
}
@ -116,7 +116,7 @@ public final class DebugSettingsFragment extends SubScreenFragment
public void onStop() {
super.onStop();
if (mServiceNeedsRestart) {
Process.killProcess(Process.myPid());
Runtime.getRuntime().exit(0);
}
}
@ -147,7 +147,7 @@ public final class DebugSettingsFragment extends SubScreenFragment
private void setupKeyPreviewAnimationScale(final String prefKey, final float defaultValue) {
final SharedPreferences prefs = getSharedPreferences();
final Resources res = getResources();
final SeekBarDialogPreference pref = (SeekBarDialogPreference)findPreference(prefKey);
final SeekBarDialogPreference pref = findPreference(prefKey);
if (pref == null) {
return;
}
@ -199,7 +199,7 @@ public final class DebugSettingsFragment extends SubScreenFragment
private void setupKeyPreviewAnimationDuration(final String prefKey, final int defaultValue) {
final SharedPreferences prefs = getSharedPreferences();
final Resources res = getResources();
final SeekBarDialogPreference pref = (SeekBarDialogPreference)findPreference(prefKey);
final SeekBarDialogPreference pref = findPreference(prefKey);
if (pref == null) {
return;
}

View file

@ -76,16 +76,10 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
public static final String PREF_THEME_USER_DARK_COLOR_BACKGROUND = "theme_dark_color_background";
public static final String PREF_THEME_USER_DARK_COLOR_KEYS = "theme_dark_color_keys";
public static final String PREF_THEME_USER_DARK_COLOR_ACCENT = "theme_dark_color_accent";
// PREF_VOICE_MODE_OBSOLETE is obsolete. Use PREF_VOICE_INPUT_KEY instead.
public static final String PREF_VOICE_MODE_OBSOLETE = "voice_mode";
public static final String PREF_VOICE_INPUT_KEY = "pref_voice_input_key";
public static final String PREF_CLIPBOARD_CLIPBOARD_KEY = "pref_clipboard_clipboard_key";
public static final String PREF_EDIT_PERSONAL_DICTIONARY = "edit_personal_dictionary";
public static final String PREF_ADD_DICTIONARY = "add_dictionary";
public static final String PREF_AUTO_CORRECTION = "pref_key_auto_correction";
public static final String PREF_AUTO_CORRECTION_CONFIDENCE = "pref_key_auto_correction_confidence";
// PREF_SHOW_SUGGESTIONS_SETTING_OBSOLETE is obsolete. Use PREF_SHOW_SUGGESTIONS instead.
public static final String PREF_SHOW_SUGGESTIONS_SETTING_OBSOLETE = "show_suggestions_setting";
public static final String PREF_SHOW_SUGGESTIONS = "show_suggestions";
public static final String PREF_KEY_USE_PERSONALIZED_DICTS = "pref_key_use_personalized_dicts";
public static final String PREF_KEY_USE_DOUBLE_SPACE_PERIOD = "pref_key_use_double_space_period";
@ -116,8 +110,6 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
public static final String PREF_ONE_HANDED_MODE = "pref_one_handed_mode_enabled";
public static final String PREF_ONE_HANDED_GRAVITY = "pref_one_handed_mode_gravity";
public static final String PREF_KEY_IS_INTERNAL = "pref_key_is_internal";
public static final String PREF_SHOW_NUMBER_ROW = "pref_show_number_row";
public static final String PREF_SHOW_HINTS = "pref_show_hints";
@ -234,10 +226,6 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
return mSettingsValues;
}
public boolean isInternal() {
return mSettingsValues.mIsInternal;
}
public static int readScreenMetrics(final Resources res) {
return res.getInteger(R.integer.config_screen_metrics);
}
@ -245,8 +233,7 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
// Accessed from the settings interface, hence public
public static boolean readKeypressSoundEnabled(final SharedPreferences prefs,
final Resources res) {
return prefs.getBoolean(PREF_SOUND_ON,
res.getBoolean(R.bool.config_default_sound_enabled));
return prefs.getBoolean(PREF_SOUND_ON, res.getBoolean(R.bool.config_default_sound_enabled));
}
public static boolean readVibrationEnabled(final SharedPreferences prefs,
@ -256,8 +243,7 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
res.getBoolean(R.bool.config_default_vibration_enabled));
}
public static boolean readAutoCorrectEnabled(final SharedPreferences prefs,
final Resources res) {
public static boolean readAutoCorrectEnabled(final SharedPreferences prefs) {
return prefs.getBoolean(PREF_AUTO_CORRECTION, true);
}
@ -267,10 +253,6 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
res.getString(R.string.auto_correction_threshold_mode_index_modest));
}
public static float readPlausibilityThreshold(final Resources res) {
return Float.parseFloat(res.getString(R.string.plausibility_threshold));
}
public static boolean readBlockPotentiallyOffensive(final SharedPreferences prefs,
final Resources res) {
return prefs.getBoolean(PREF_BLOCK_POTENTIALLY_OFFENSIVE,
@ -393,10 +375,6 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
public static int readDefaultClipboardHistoryRetentionTime(final Resources res) {
return res.getInteger(R.integer.config_clipboard_history_retention_time);
}
public static boolean readShowsNumberRow(final SharedPreferences prefs) {
return prefs.getBoolean(PREF_SHOW_NUMBER_ROW, false);
}
public static float readKeyboardHeight(final SharedPreferences prefs,
final float defaultValue) {
@ -459,10 +437,6 @@ public final class Settings implements SharedPreferences.OnSharedPreferenceChang
&& conf.hardKeyboardHidden != Configuration.HARDKEYBOARDHIDDEN_YES;
}
public static boolean isInternal(final SharedPreferences prefs) {
return prefs.getBoolean(PREF_KEY_IS_INTERNAL, false);
}
public void writeLastUsedPersonalizationToken(byte[] token) {
if (token == null) {
mPrefs.edit().remove(PREF_LAST_USED_PERSONALIZATION_TOKEN).apply();

View file

@ -110,6 +110,7 @@ public class SettingsValues {
public final boolean mAddToPersonalDictionary;
public final boolean mUseContactsDictionary;
public final boolean mCustomNavBarColor;
public final float mKeyboardHeightScale;
// From the input box
@NonNull
@ -121,7 +122,6 @@ public class SettingsValues {
private final boolean mAutoCorrectEnabled;
public final float mAutoCorrectionThreshold;
public final int mScoreLimitForAutocorrect;
public final float mPlausibilityThreshold;
public final boolean mAutoCorrectionEnabledPerUserSettings;
private final boolean mSuggestionsEnabledPerUserSettings;
public final SettingsValuesForSuggestion mSettingsValuesForSuggestion;
@ -132,9 +132,7 @@ public class SettingsValues {
public final Colors mColors;
// Debug settings
public final boolean mIsInternal;
public final boolean mHasCustomKeyPreviewAnimationParams;
public final float mKeyboardHeightScale;
public final int mKeyPreviewShowUpDuration;
public final int mKeyPreviewDismissDuration;
public final float mKeyPreviewShowUpStartXScale;
@ -163,7 +161,7 @@ public class SettingsValues {
mKeyPreviewPopupOn = Settings.readKeyPreviewPopupEnabled(prefs, res);
mSlidingKeyInputPreviewEnabled = prefs.getBoolean(
DebugSettings.PREF_SLIDING_KEY_INPUT_PREVIEW, true);
mShowsVoiceInputKey = needsToShowVoiceInputKey(prefs, res) && mInputAttributes.mShouldShowVoiceInputKey;
mShowsVoiceInputKey = needsToShowVoiceInputKey(prefs) && mInputAttributes.mShouldShowVoiceInputKey;
final String languagePref = prefs.getString(Settings.PREF_LANGUAGE_SWITCH_KEY, "off");
mLanguageSwitchKeyToOtherImes = languagePref.equals("input_method") || languagePref.equals("both");
mLanguageSwitchKeyToOtherSubtypes = languagePref.equals("internal") || languagePref.equals("both");
@ -176,7 +174,7 @@ public class SettingsValues {
mUseDoubleSpacePeriod = prefs.getBoolean(Settings.PREF_KEY_USE_DOUBLE_SPACE_PERIOD, true)
&& inputAttributes.mIsGeneralTextInput;
mBlockPotentiallyOffensive = Settings.readBlockPotentiallyOffensive(prefs, res);
mAutoCorrectEnabled = Settings.readAutoCorrectEnabled(prefs, res);
mAutoCorrectEnabled = Settings.readAutoCorrectEnabled(prefs);
mAutoCorrectionThreshold = mAutoCorrectEnabled
? readAutoCorrectionThreshold(res, prefs)
: AUTO_CORRECTION_DISABLED_THRESHOLD;
@ -198,7 +196,6 @@ public class SettingsValues {
Settings.PREF_ENABLE_EMOJI_ALT_PHYSICAL_KEY, true);
mShowAppIcon = Settings.readShowSetupWizardIcon(prefs, context);
mIsShowAppIconSettingInPreferences = prefs.contains(Settings.PREF_SHOW_SETUP_WIZARD_ICON);
mPlausibilityThreshold = Settings.readPlausibilityThreshold(res);
mGestureInputEnabled = Settings.readGestureInputEnabled(prefs, res);
mGestureTrailEnabled = prefs.getBoolean(Settings.PREF_GESTURE_PREVIEW_TRAIL, true);
mCloudSyncEnabled = prefs.getBoolean(LocalSettingsConstants.PREF_ENABLE_CLOUD_SYNC, false);
@ -212,7 +209,6 @@ public class SettingsValues {
readSuggestionsEnabled(prefs);
mIncognitoModeEnabled = Settings.readAlwaysIncognitoMode(prefs) || mInputAttributes.mNoLearning
|| mInputAttributes.mIsPasswordField;
mIsInternal = Settings.isInternal(prefs);
mHasCustomKeyPreviewAnimationParams = prefs.getBoolean(DebugSettings.PREF_HAS_CUSTOM_KEY_PREVIEW_ANIMATION_PARAMS, false);
mKeyboardHeightScale = Settings.readKeyboardHeight(prefs, DEFAULT_SIZE_SCALE);
mKeyPreviewShowUpDuration = Settings.readKeyPreviewAnimationDuration(
@ -335,17 +331,7 @@ public class SettingsValues {
return mDisplayOrientation == configuration.orientation;
}
private static final String SUGGESTIONS_VISIBILITY_HIDE_VALUE_OBSOLETE = "2";
private static boolean readSuggestionsEnabled(final SharedPreferences prefs) {
if (prefs.contains(Settings.PREF_SHOW_SUGGESTIONS_SETTING_OBSOLETE)) {
final boolean alwaysHide = SUGGESTIONS_VISIBILITY_HIDE_VALUE_OBSOLETE.equals(
prefs.getString(Settings.PREF_SHOW_SUGGESTIONS_SETTING_OBSOLETE, null));
prefs.edit()
.remove(Settings.PREF_SHOW_SUGGESTIONS_SETTING_OBSOLETE)
.putBoolean(Settings.PREF_SHOW_SUGGESTIONS, !alwaysHide)
.apply();
}
return prefs.getBoolean(Settings.PREF_SHOW_SUGGESTIONS, true);
}
@ -387,21 +373,7 @@ public class SettingsValues {
return autoCorrectionThreshold;
}
private static boolean needsToShowVoiceInputKey(final SharedPreferences prefs,
final Resources res) {
// Migrate preference from {@link Settings#PREF_VOICE_MODE_OBSOLETE} to
// {@link Settings#PREF_VOICE_INPUT_KEY}.
if (prefs.contains(Settings.PREF_VOICE_MODE_OBSOLETE)) {
final String voiceModeMain = res.getString(R.string.voice_mode_main);
final String voiceMode = prefs.getString(
Settings.PREF_VOICE_MODE_OBSOLETE, voiceModeMain);
final boolean shouldShowVoiceInputKey = voiceModeMain.equals(voiceMode);
prefs.edit()
.putBoolean(Settings.PREF_VOICE_INPUT_KEY, shouldShowVoiceInputKey)
// Remove the obsolete preference if exists.
.remove(Settings.PREF_VOICE_MODE_OBSOLETE)
.apply();
}
private static boolean needsToShowVoiceInputKey(final SharedPreferences prefs) {
return prefs.getBoolean(Settings.PREF_VOICE_INPUT_KEY, true);
}
@ -464,8 +436,6 @@ public class SettingsValues {
sb.append("\n mAppWorkarounds = ");
final AppWorkaroundsUtils awu = mAppWorkarounds.get(null, 0);
sb.append("" + (null == awu ? "null" : awu.toString()));
sb.append("\n mIsInternal = ");
sb.append("" + mIsInternal);
sb.append("\n mKeyPreviewShowUpDuration = ");
sb.append("" + mKeyPreviewShowUpDuration);
sb.append("\n mKeyPreviewDismissDuration = ");

View file

@ -55,7 +55,9 @@ public final class AutoCorrectionUtils {
// the normalized score of the second suggestion, behave less aggressive.
final float normalizedScore;
if (BuildConfig.DEBUG && Build.VERSION.SDK_INT == 0)
normalizedScore = calcNormalizedScore(StringUtils.toCodePointArray(consideredWord), StringUtils.toCodePointArray(suggestion.mWord), autoCorrectionSuggestionScore, editDistance(consideredWord, suggestion.mWord));
normalizedScore = calcNormalizedScore(StringUtils.toCodePointArray(consideredWord),
StringUtils.toCodePointArray(suggestion.mWord), autoCorrectionSuggestionScore,
editDistance(consideredWord, suggestion.mWord));
else
normalizedScore = BinaryDictionaryUtils.calcNormalizedScore(
consideredWord, suggestion.mWord, autoCorrectionSuggestionScore);