am e9a0efc2: Merge "Cleanup unused variables and parameters"
* commit 'e9a0efc242f3bca80e8f64523a7bade659c28069': Cleanup unused variables and parametersmain
commit
daaf590a1b
|
@ -17,7 +17,6 @@
|
||||||
package com.android.inputmethod.accessibility;
|
package com.android.inputmethod.accessibility;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.inputmethodservice.InputMethodService;
|
import android.inputmethodservice.InputMethodService;
|
||||||
import android.media.AudioManager;
|
import android.media.AudioManager;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
|
@ -55,15 +54,15 @@ public class AccessibilityUtils {
|
||||||
*/
|
*/
|
||||||
private static final boolean ENABLE_ACCESSIBILITY = true;
|
private static final boolean ENABLE_ACCESSIBILITY = true;
|
||||||
|
|
||||||
public static void init(InputMethodService inputMethod, SharedPreferences prefs) {
|
public static void init(InputMethodService inputMethod) {
|
||||||
if (!ENABLE_ACCESSIBILITY)
|
if (!ENABLE_ACCESSIBILITY)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// These only need to be initialized if the kill switch is off.
|
// These only need to be initialized if the kill switch is off.
|
||||||
sInstance.initInternal(inputMethod, prefs);
|
sInstance.initInternal(inputMethod);
|
||||||
KeyCodeDescriptionMapper.init(inputMethod, prefs);
|
KeyCodeDescriptionMapper.init();
|
||||||
AccessibleInputMethodServiceProxy.init(inputMethod, prefs);
|
AccessibleInputMethodServiceProxy.init(inputMethod);
|
||||||
AccessibleKeyboardViewProxy.init(inputMethod, prefs);
|
AccessibleKeyboardViewProxy.init(inputMethod);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AccessibilityUtils getInstance() {
|
public static AccessibilityUtils getInstance() {
|
||||||
|
@ -74,7 +73,7 @@ public class AccessibilityUtils {
|
||||||
// This class is not publicly instantiable.
|
// This class is not publicly instantiable.
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initInternal(Context context, SharedPreferences prefs) {
|
private void initInternal(Context context) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mAccessibilityManager = (AccessibilityManager) context
|
mAccessibilityManager = (AccessibilityManager) context
|
||||||
.getSystemService(Context.ACCESSIBILITY_SERVICE);
|
.getSystemService(Context.ACCESSIBILITY_SERVICE);
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
package com.android.inputmethod.accessibility;
|
package com.android.inputmethod.accessibility;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.inputmethodservice.InputMethodService;
|
import android.inputmethodservice.InputMethodService;
|
||||||
import android.media.AudioManager;
|
import android.media.AudioManager;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
|
@ -82,8 +81,8 @@ public class AccessibleInputMethodServiceProxy implements AccessibleKeyboardActi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void init(InputMethodService inputMethod, SharedPreferences prefs) {
|
public static void init(InputMethodService inputMethod) {
|
||||||
sInstance.initInternal(inputMethod, prefs);
|
sInstance.initInternal(inputMethod);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static AccessibleInputMethodServiceProxy getInstance() {
|
public static AccessibleInputMethodServiceProxy getInstance() {
|
||||||
|
@ -94,7 +93,7 @@ public class AccessibleInputMethodServiceProxy implements AccessibleKeyboardActi
|
||||||
// Not publicly instantiable.
|
// Not publicly instantiable.
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initInternal(InputMethodService inputMethod, SharedPreferences prefs) {
|
private void initInternal(InputMethodService inputMethod) {
|
||||||
mInputMethod = inputMethod;
|
mInputMethod = inputMethod;
|
||||||
mVibrator = (Vibrator) inputMethod.getSystemService(Context.VIBRATOR_SERVICE);
|
mVibrator = (Vibrator) inputMethod.getSystemService(Context.VIBRATOR_SERVICE);
|
||||||
mAudioManager = (AudioManager) inputMethod.getSystemService(Context.AUDIO_SERVICE);
|
mAudioManager = (AudioManager) inputMethod.getSystemService(Context.AUDIO_SERVICE);
|
||||||
|
@ -125,8 +124,6 @@ public class AccessibleInputMethodServiceProxy implements AccessibleKeyboardActi
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onFlickGesture(int direction) {
|
public void onFlickGesture(int direction) {
|
||||||
final int keyEventCode;
|
|
||||||
|
|
||||||
switch (direction) {
|
switch (direction) {
|
||||||
case FlickGestureDetector.FLICK_LEFT:
|
case FlickGestureDetector.FLICK_LEFT:
|
||||||
sendDownUpKeyEvents(KeyEvent.KEYCODE_DPAD_LEFT);
|
sendDownUpKeyEvents(KeyEvent.KEYCODE_DPAD_LEFT);
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
package com.android.inputmethod.accessibility;
|
package com.android.inputmethod.accessibility;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
import android.inputmethodservice.InputMethodService;
|
import android.inputmethodservice.InputMethodService;
|
||||||
|
@ -43,8 +42,8 @@ public class AccessibleKeyboardViewProxy {
|
||||||
|
|
||||||
private Key mLastHoverKey = null;
|
private Key mLastHoverKey = null;
|
||||||
|
|
||||||
public static void init(InputMethodService inputMethod, SharedPreferences prefs) {
|
public static void init(InputMethodService inputMethod) {
|
||||||
sInstance.initInternal(inputMethod, prefs);
|
sInstance.initInternal(inputMethod);
|
||||||
sInstance.mListener = AccessibleInputMethodServiceProxy.getInstance();
|
sInstance.mListener = AccessibleInputMethodServiceProxy.getInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +59,7 @@ public class AccessibleKeyboardViewProxy {
|
||||||
// Not publicly instantiable.
|
// Not publicly instantiable.
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initInternal(InputMethodService inputMethod, SharedPreferences prefs) {
|
private void initInternal(InputMethodService inputMethod) {
|
||||||
final Paint paint = new Paint();
|
final Paint paint = new Paint();
|
||||||
paint.setTextAlign(Paint.Align.LEFT);
|
paint.setTextAlign(Paint.Align.LEFT);
|
||||||
paint.setTextSize(14.0f);
|
paint.setTextSize(14.0f);
|
||||||
|
@ -71,8 +70,7 @@ public class AccessibleKeyboardViewProxy {
|
||||||
mGestureDetector = new KeyboardFlickGestureDetector(inputMethod);
|
mGestureDetector = new KeyboardFlickGestureDetector(inputMethod);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event,
|
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
|
||||||
PointerTracker tracker) {
|
|
||||||
if (mView == null) {
|
if (mView == null) {
|
||||||
Log.e(TAG, "No keyboard view set!");
|
Log.e(TAG, "No keyboard view set!");
|
||||||
return false;
|
return false;
|
||||||
|
@ -132,9 +130,9 @@ public class AccessibleKeyboardViewProxy {
|
||||||
final Key key = tracker.getKeyOn(x, y);
|
final Key key = tracker.getKeyOn(x, y);
|
||||||
|
|
||||||
if (key != mLastHoverKey) {
|
if (key != mLastHoverKey) {
|
||||||
fireKeyHoverEvent(tracker, mLastHoverKey, false);
|
fireKeyHoverEvent(mLastHoverKey, false);
|
||||||
mLastHoverKey = key;
|
mLastHoverKey = key;
|
||||||
fireKeyHoverEvent(tracker, mLastHoverKey, true);
|
fireKeyHoverEvent(mLastHoverKey, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -143,7 +141,7 @@ public class AccessibleKeyboardViewProxy {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fireKeyHoverEvent(PointerTracker tracker, Key key, boolean entering) {
|
private void fireKeyHoverEvent(Key key, boolean entering) {
|
||||||
if (mListener == null) {
|
if (mListener == null) {
|
||||||
Log.e(TAG, "No accessible keyboard action listener set!");
|
Log.e(TAG, "No accessible keyboard action listener set!");
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -126,7 +126,6 @@ public abstract class FlickGestureDetector {
|
||||||
}
|
}
|
||||||
|
|
||||||
final float distanceSquare = calculateDistanceSquare(mCachedHoverEnter, event);
|
final float distanceSquare = calculateDistanceSquare(mCachedHoverEnter, event);
|
||||||
final long timeout = event.getEventTime() - mCachedHoverEnter.getEventTime();
|
|
||||||
|
|
||||||
switch (event.getAction()) {
|
switch (event.getAction()) {
|
||||||
case MotionEventCompatUtils.ACTION_HOVER_MOVE:
|
case MotionEventCompatUtils.ACTION_HOVER_MOVE:
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
package com.android.inputmethod.accessibility;
|
package com.android.inputmethod.accessibility;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
import com.android.inputmethod.keyboard.Key;
|
import com.android.inputmethod.keyboard.Key;
|
||||||
|
@ -45,8 +44,8 @@ public class KeyCodeDescriptionMapper {
|
||||||
// Map of shift-locked key codes to spoken description resource IDs
|
// Map of shift-locked key codes to spoken description resource IDs
|
||||||
private final HashMap<Integer, Integer> mShiftLockedKeyCodeMap;
|
private final HashMap<Integer, Integer> mShiftLockedKeyCodeMap;
|
||||||
|
|
||||||
public static void init(Context context, SharedPreferences prefs) {
|
public static void init() {
|
||||||
sInstance.initInternal(context, prefs);
|
sInstance.initInternal();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static KeyCodeDescriptionMapper getInstance() {
|
public static KeyCodeDescriptionMapper getInstance() {
|
||||||
|
@ -60,7 +59,7 @@ public class KeyCodeDescriptionMapper {
|
||||||
mShiftLockedKeyCodeMap = new HashMap<Integer, Integer>();
|
mShiftLockedKeyCodeMap = new HashMap<Integer, Integer>();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initInternal(Context context, SharedPreferences prefs) {
|
private void initInternal() {
|
||||||
// Manual label substitutions for key labels with no string resource
|
// Manual label substitutions for key labels with no string resource
|
||||||
mKeyLabelMap.put(":-)", R.string.spoken_description_smiley);
|
mKeyLabelMap.put(":-)", R.string.spoken_description_smiley);
|
||||||
|
|
||||||
|
|
|
@ -206,7 +206,7 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
|
||||||
// Detected a double tap on shift key. If we are in the ignoring double tap
|
// Detected a double tap on shift key. If we are in the ignoring double tap
|
||||||
// mode, it means we have already turned off caps lock in
|
// mode, it means we have already turned off caps lock in
|
||||||
// {@link KeyboardSwitcher#onReleaseShift} .
|
// {@link KeyboardSwitcher#onReleaseShift} .
|
||||||
onDoubleTapShiftKey(tracker, mKeyTimerHandler.isIgnoringDoubleTap());
|
onDoubleTapShiftKey(mKeyTimerHandler.isIgnoringDoubleTap());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// Otherwise these events should not be handled as double tap.
|
// Otherwise these events should not be handled as double tap.
|
||||||
|
@ -342,8 +342,7 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
|
||||||
return onLongPress(parentKey, tracker);
|
return onLongPress(parentKey, tracker);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onDoubleTapShiftKey(@SuppressWarnings("unused") PointerTracker tracker,
|
private void onDoubleTapShiftKey(final boolean ignore) {
|
||||||
final boolean ignore) {
|
|
||||||
// When shift key is double tapped, the first tap is correctly processed as usual tap. And
|
// When shift key is double tapped, the first tap is correctly processed as usual tap. And
|
||||||
// the second tap is treated as this double tap event, so that we need not mark tracker
|
// the second tap is treated as this double tap event, so that we need not mark tracker
|
||||||
// calling setAlreadyProcessed() nor remove the tracker from mPointerQueue.
|
// calling setAlreadyProcessed() nor remove the tracker from mPointerQueue.
|
||||||
|
@ -624,9 +623,8 @@ public class LatinKeyboardView extends KeyboardView implements PointerTracker.Ke
|
||||||
@Override
|
@Override
|
||||||
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
|
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
|
||||||
if (AccessibilityUtils.getInstance().isTouchExplorationEnabled()) {
|
if (AccessibilityUtils.getInstance().isTouchExplorationEnabled()) {
|
||||||
final PointerTracker tracker = getPointerTracker(0);
|
|
||||||
return AccessibleKeyboardViewProxy.getInstance().dispatchPopulateAccessibilityEvent(
|
return AccessibleKeyboardViewProxy.getInstance().dispatchPopulateAccessibilityEvent(
|
||||||
event, tracker) || super.dispatchPopulateAccessibilityEvent(event);
|
event) || super.dispatchPopulateAccessibilityEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.dispatchPopulateAccessibilityEvent(event);
|
return super.dispatchPopulateAccessibilityEvent(event);
|
||||||
|
|
|
@ -498,7 +498,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
||||||
InputMethodManagerCompatWrapper.init(this);
|
InputMethodManagerCompatWrapper.init(this);
|
||||||
SubtypeSwitcher.init(this);
|
SubtypeSwitcher.init(this);
|
||||||
KeyboardSwitcher.init(this, prefs);
|
KeyboardSwitcher.init(this, prefs);
|
||||||
AccessibilityUtils.init(this, prefs);
|
AccessibilityUtils.init(this);
|
||||||
|
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
|
|
||||||
|
@ -767,7 +767,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
||||||
|
|
||||||
loadSettings();
|
loadSettings();
|
||||||
updateCorrectionMode();
|
updateCorrectionMode();
|
||||||
updateSuggestionVisibility(mPrefs, mResources);
|
updateSuggestionVisibility(mResources);
|
||||||
|
|
||||||
if (mSuggest != null && mSettingsValues.mAutoCorrectEnabled) {
|
if (mSuggest != null && mSettingsValues.mAutoCorrectEnabled) {
|
||||||
mSuggest.setAutoCorrectionThreshold(mSettingsValues.mAutoCorrectionThreshold);
|
mSuggest.setAutoCorrectionThreshold(mSettingsValues.mAutoCorrectionThreshold);
|
||||||
|
@ -2424,7 +2424,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
||||||
? Suggest.CORRECTION_FULL_BIGRAM : mCorrectionMode;
|
? Suggest.CORRECTION_FULL_BIGRAM : mCorrectionMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateSuggestionVisibility(final SharedPreferences prefs, final Resources res) {
|
private void updateSuggestionVisibility(final Resources res) {
|
||||||
final String suggestionVisiblityStr = mSettingsValues.mShowSuggestionsSetting;
|
final String suggestionVisiblityStr = mSettingsValues.mShowSuggestionsSetting;
|
||||||
for (int visibility : SUGGESTION_VISIBILITY_VALUE_ARRAY) {
|
for (int visibility : SUGGESTION_VISIBILITY_VALUE_ARRAY) {
|
||||||
if (suggestionVisiblityStr.equals(res.getString(visibility))) {
|
if (suggestionVisiblityStr.equals(res.getString(visibility))) {
|
||||||
|
|
|
@ -52,7 +52,9 @@ public class SettingsValues {
|
||||||
private final String mVoiceMode;
|
private final String mVoiceMode;
|
||||||
private final String mAutoCorrectionThresholdRawValue;
|
private final String mAutoCorrectionThresholdRawValue;
|
||||||
public final String mShowSuggestionsSetting;
|
public final String mShowSuggestionsSetting;
|
||||||
|
@SuppressWarnings("unused") // TODO: Use this
|
||||||
private final boolean mUsabilityStudyMode;
|
private final boolean mUsabilityStudyMode;
|
||||||
|
@SuppressWarnings("unused") // TODO: Use this
|
||||||
private final String mKeyPreviewPopupDismissDelayRawValue;
|
private final String mKeyPreviewPopupDismissDelayRawValue;
|
||||||
public final boolean mUseContactsDict;
|
public final boolean mUseContactsDict;
|
||||||
// Suggestion: use bigrams to adjust scores of suggestions obtained from unigram dictionary
|
// Suggestion: use bigrams to adjust scores of suggestions obtained from unigram dictionary
|
||||||
|
@ -60,7 +62,9 @@ public class SettingsValues {
|
||||||
// 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 mEnableSuggestionSpanInsertion;
|
public final boolean mEnableSuggestionSpanInsertion;
|
||||||
|
@SuppressWarnings("unused") // TODO: Use this
|
||||||
private final int mVibrationDurationSettingsRawValue;
|
private final int mVibrationDurationSettingsRawValue;
|
||||||
|
@SuppressWarnings("unused") // TODO: Use this
|
||||||
private final float mKeypressSoundVolumeRawValue;
|
private final float mKeypressSoundVolumeRawValue;
|
||||||
|
|
||||||
// Deduced settings
|
// Deduced settings
|
||||||
|
@ -111,12 +115,12 @@ public class SettingsValues {
|
||||||
res.getString(R.string.auto_correction_threshold_mode_index_modest));
|
res.getString(R.string.auto_correction_threshold_mode_index_modest));
|
||||||
mShowSuggestionsSetting = prefs.getString(Settings.PREF_SHOW_SUGGESTIONS_SETTING,
|
mShowSuggestionsSetting = prefs.getString(Settings.PREF_SHOW_SUGGESTIONS_SETTING,
|
||||||
res.getString(R.string.prefs_suggestion_visibility_default_value));
|
res.getString(R.string.prefs_suggestion_visibility_default_value));
|
||||||
mUsabilityStudyMode = getUsabilityStudyMode(prefs, res);
|
mUsabilityStudyMode = getUsabilityStudyMode(prefs);
|
||||||
mKeyPreviewPopupDismissDelayRawValue = prefs.getString(
|
mKeyPreviewPopupDismissDelayRawValue = prefs.getString(
|
||||||
Settings.PREF_KEY_PREVIEW_POPUP_DISMISS_DELAY,
|
Settings.PREF_KEY_PREVIEW_POPUP_DISMISS_DELAY,
|
||||||
Integer.toString(res.getInteger(R.integer.config_delay_after_preview)));
|
Integer.toString(res.getInteger(R.integer.config_delay_after_preview)));
|
||||||
mUseContactsDict = prefs.getBoolean(Settings.PREF_KEY_USE_CONTACTS_DICT, true);
|
mUseContactsDict = prefs.getBoolean(Settings.PREF_KEY_USE_CONTACTS_DICT, true);
|
||||||
mAutoCorrectEnabled = isAutoCorrectEnabled(prefs, res, mAutoCorrectionThresholdRawValue);
|
mAutoCorrectEnabled = isAutoCorrectEnabled(res, mAutoCorrectionThresholdRawValue);
|
||||||
mBigramSuggestionEnabled = mAutoCorrectEnabled
|
mBigramSuggestionEnabled = mAutoCorrectEnabled
|
||||||
&& isBigramSuggestionEnabled(prefs, res, mAutoCorrectEnabled);
|
&& isBigramSuggestionEnabled(prefs, res, mAutoCorrectEnabled);
|
||||||
mBigramPredictionEnabled = mBigramSuggestionEnabled
|
mBigramPredictionEnabled = mBigramSuggestionEnabled
|
||||||
|
@ -131,7 +135,7 @@ public class SettingsValues {
|
||||||
mKeypressVibrationDuration = getCurrentVibrationDuration(prefs, res);
|
mKeypressVibrationDuration = getCurrentVibrationDuration(prefs, res);
|
||||||
mFxVolume = getCurrentKeypressSoundVolume(prefs, res);
|
mFxVolume = getCurrentKeypressSoundVolume(prefs, res);
|
||||||
mKeyPreviewPopupDismissDelay = getKeyPreviewPopupDismissDelay(prefs, res);
|
mKeyPreviewPopupDismissDelay = getKeyPreviewPopupDismissDelay(prefs, res);
|
||||||
mAutoCorrectionThreshold = getAutoCorrectionThreshold(prefs, res,
|
mAutoCorrectionThreshold = getAutoCorrectionThreshold(res,
|
||||||
mAutoCorrectionThresholdRawValue);
|
mAutoCorrectionThresholdRawValue);
|
||||||
mVoiceKeyEnabled = mVoiceMode != null && !mVoiceMode.equals(voiceModeOff);
|
mVoiceKeyEnabled = mVoiceMode != null && !mVoiceMode.equals(voiceModeOff);
|
||||||
mVoiceKeyOnMain = mVoiceMode != null && mVoiceMode.equals(voiceModeMain);
|
mVoiceKeyOnMain = mVoiceMode != null && mVoiceMode.equals(voiceModeMain);
|
||||||
|
@ -202,8 +206,8 @@ public class SettingsValues {
|
||||||
return mMagicSpaceSwappers.contains(String.valueOf((char)code));
|
return mMagicSpaceSwappers.contains(String.valueOf((char)code));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isAutoCorrectEnabled(final SharedPreferences sp,
|
private static boolean isAutoCorrectEnabled(final Resources resources,
|
||||||
final Resources resources, final String currentAutoCorrectionSetting) {
|
final String currentAutoCorrectionSetting) {
|
||||||
final String autoCorrectionOff = resources.getString(
|
final String autoCorrectionOff = resources.getString(
|
||||||
R.string.auto_correction_threshold_mode_index_off);
|
R.string.auto_correction_threshold_mode_index_off);
|
||||||
return !currentAutoCorrectionSetting.equals(autoCorrectionOff);
|
return !currentAutoCorrectionSetting.equals(autoCorrectionOff);
|
||||||
|
@ -244,8 +248,8 @@ public class SettingsValues {
|
||||||
R.bool.config_default_bigram_prediction));
|
R.bool.config_default_bigram_prediction));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static double getAutoCorrectionThreshold(final SharedPreferences sp,
|
private static double getAutoCorrectionThreshold(final Resources resources,
|
||||||
final Resources resources, final String currentAutoCorrectionSetting) {
|
final String currentAutoCorrectionSetting) {
|
||||||
final String[] autoCorrectionThresholdValues = resources.getStringArray(
|
final String[] autoCorrectionThresholdValues = resources.getStringArray(
|
||||||
R.array.auto_correction_threshold_values);
|
R.array.auto_correction_threshold_values);
|
||||||
// When autoCorrectionThreshold is greater than 1.0, it's like auto correction is off.
|
// When autoCorrectionThreshold is greater than 1.0, it's like auto correction is off.
|
||||||
|
@ -321,8 +325,7 @@ public class SettingsValues {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Likewise
|
// Likewise
|
||||||
public static boolean getUsabilityStudyMode(final SharedPreferences prefs,
|
public static boolean getUsabilityStudyMode(final SharedPreferences prefs) {
|
||||||
final Resources res) {
|
|
||||||
// TODO: use mUsabilityStudyMode instead of reading it again here
|
// TODO: use mUsabilityStudyMode instead of reading it again here
|
||||||
return prefs.getBoolean(Settings.PREF_USABILITY_STUDY_MODE, true);
|
return prefs.getBoolean(Settings.PREF_USABILITY_STUDY_MODE, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,8 +100,6 @@ public class SuggestionsView extends RelativeLayout implements OnClickListener,
|
||||||
private static class UiHandler extends StaticInnerHandlerWrapper<SuggestionsView> {
|
private static class UiHandler extends StaticInnerHandlerWrapper<SuggestionsView> {
|
||||||
private static final int MSG_HIDE_PREVIEW = 0;
|
private static final int MSG_HIDE_PREVIEW = 0;
|
||||||
|
|
||||||
private static final long DELAY_HIDE_PREVIEW = 1300;
|
|
||||||
|
|
||||||
public UiHandler(SuggestionsView outerInstance) {
|
public UiHandler(SuggestionsView outerInstance) {
|
||||||
super(outerInstance);
|
super(outerInstance);
|
||||||
}
|
}
|
||||||
|
@ -116,11 +114,6 @@ public class SuggestionsView extends RelativeLayout implements OnClickListener,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void postHidePreview() {
|
|
||||||
cancelHidePreview();
|
|
||||||
sendMessageDelayed(obtainMessage(MSG_HIDE_PREVIEW), DELAY_HIDE_PREVIEW);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void cancelHidePreview() {
|
public void cancelHidePreview() {
|
||||||
removeMessages(MSG_HIDE_PREVIEW);
|
removeMessages(MSG_HIDE_PREVIEW);
|
||||||
}
|
}
|
||||||
|
|
|
@ -172,7 +172,7 @@ public class UserUnigramDictionary extends ExpandableDictionary {
|
||||||
// Nothing pending? Return
|
// Nothing pending? Return
|
||||||
if (mPendingWrites.isEmpty()) return;
|
if (mPendingWrites.isEmpty()) return;
|
||||||
// Create a background thread to write the pending entries
|
// Create a background thread to write the pending entries
|
||||||
new UpdateDbTask(getContext(), sOpenHelper, mPendingWrites, mLocale).execute();
|
new UpdateDbTask(sOpenHelper, mPendingWrites, mLocale).execute();
|
||||||
// Create a new map for writing new entries into while the old one is written to db
|
// Create a new map for writing new entries into while the old one is written to db
|
||||||
mPendingWrites = new HashMap<String, Integer>();
|
mPendingWrites = new HashMap<String, Integer>();
|
||||||
}
|
}
|
||||||
|
@ -227,8 +227,8 @@ public class UserUnigramDictionary extends ExpandableDictionary {
|
||||||
private final DatabaseHelper mDbHelper;
|
private final DatabaseHelper mDbHelper;
|
||||||
private final String mLocale;
|
private final String mLocale;
|
||||||
|
|
||||||
public UpdateDbTask(@SuppressWarnings("unused") Context context, DatabaseHelper openHelper,
|
public UpdateDbTask(DatabaseHelper openHelper, HashMap<String, Integer> pendingWrites,
|
||||||
HashMap<String, Integer> pendingWrites, String locale) {
|
String locale) {
|
||||||
mMap = pendingWrites;
|
mMap = pendingWrites;
|
||||||
mLocale = locale;
|
mLocale = locale;
|
||||||
mDbHelper = openHelper;
|
mDbHelper = openHelper;
|
||||||
|
|
Loading…
Reference in New Issue