am 28a9147f: am 567204a1: Merge "Show gesture floating preview text is off by default" into jb-mr1-dev

* commit '28a9147f5f0c11ea154e1717a291dc09a042b68f':
  Show gesture floating preview text is off by default
This commit is contained in:
Tadashi G. Takaoka 2012-09-19 15:19:30 -07:00 committed by Android Git Automerger
commit 1fe06c2179
4 changed files with 27 additions and 19 deletions

View file

@ -138,11 +138,11 @@
android:persistent="true" android:persistent="true"
android:defaultValue="true" /> android:defaultValue="true" />
<CheckBoxPreference <CheckBoxPreference
android:key="pref_gesture_floating_preview_text" android:key="pref_show_gesture_floating_preview_text"
android:title="@string/gesture_floating_preview_text" android:title="@string/gesture_floating_preview_text"
android:summary="@string/gesture_floating_preview_text_summary" android:summary="@string/gesture_floating_preview_text_summary"
android:persistent="true" android:persistent="true"
android:defaultValue="true" /> android:defaultValue="false" />
</PreferenceScreen> </PreferenceScreen>
</PreferenceCategory> </PreferenceCategory>
</PreferenceScreen> </PreferenceScreen>

View file

@ -189,6 +189,14 @@ public class PreviewPlacerView extends RelativeLayout {
} }
public void invalidatePointer(final PointerTracker tracker, final boolean isOldestTracker) { public void invalidatePointer(final PointerTracker tracker, final boolean isOldestTracker) {
final boolean needsToUpdateLastPointer =
isOldestTracker && mDrawsGestureFloatingPreviewText;
if (needsToUpdateLastPointer) {
mLastPointerX = tracker.getLastX();
mLastPointerY = tracker.getLastY();
}
if (mDrawsGesturePreviewTrail) {
GesturePreviewTrail trail; GesturePreviewTrail trail;
synchronized (mGesturePreviewTrails) { synchronized (mGesturePreviewTrails) {
trail = mGesturePreviewTrails.get(tracker.mPointerId); trail = mGesturePreviewTrails.get(tracker.mPointerId);
@ -198,14 +206,13 @@ public class PreviewPlacerView extends RelativeLayout {
} }
} }
trail.addStroke(tracker.getGestureStrokeWithPreviewTrail(), tracker.getDownTime()); trail.addStroke(tracker.getGestureStrokeWithPreviewTrail(), tracker.getDownTime());
if (isOldestTracker) {
mLastPointerX = tracker.getLastX();
mLastPointerY = tracker.getLastY();
} }
// TODO: Should narrow the invalidate region. // TODO: Should narrow the invalidate region.
if (mDrawsGesturePreviewTrail || needsToUpdateLastPointer) {
invalidate(); invalidate();
} }
}
@Override @Override
protected void onDetachedFromWindow() { protected void onDetachedFromWindow() {
@ -262,6 +269,7 @@ public class PreviewPlacerView extends RelativeLayout {
} }
public void setGestureFloatingPreviewText(final String gestureFloatingPreviewText) { public void setGestureFloatingPreviewText(final String gestureFloatingPreviewText) {
if (!mDrawsGestureFloatingPreviewText) return;
mGestureFloatingPreviewText = gestureFloatingPreviewText; mGestureFloatingPreviewText = gestureFloatingPreviewText;
invalidate(); invalidate();
} }

View file

@ -77,8 +77,8 @@ public class Settings extends InputMethodSettingsFragment
public static final String PREF_KEYPRESS_SOUND_VOLUME = public static final String PREF_KEYPRESS_SOUND_VOLUME =
"pref_keypress_sound_volume"; "pref_keypress_sound_volume";
public static final String PREF_GESTURE_PREVIEW_TRAIL = "pref_gesture_preview_trail"; public static final String PREF_GESTURE_PREVIEW_TRAIL = "pref_gesture_preview_trail";
public static final String PREF_GESTURE_FLOATING_PREVIEW_TEXT = public static final String PREF_SHOW_GESTURE_FLOATING_PREVIEW_TEXT =
"pref_gesture_floating_preview_text"; "pref_show_gesture_floating_preview_text";
public static final String PREF_INPUT_LANGUAGE = "input_language"; public static final String PREF_INPUT_LANGUAGE = "input_language";
public static final String PREF_SELECTED_LANGUAGES = "selected_languages"; public static final String PREF_SELECTED_LANGUAGES = "selected_languages";
@ -207,7 +207,7 @@ public class Settings extends InputMethodSettingsFragment
R.bool.config_gesture_input_enabled_by_build_config); R.bool.config_gesture_input_enabled_by_build_config);
final Preference gesturePreviewTrail = findPreference(PREF_GESTURE_PREVIEW_TRAIL); final Preference gesturePreviewTrail = findPreference(PREF_GESTURE_PREVIEW_TRAIL);
final Preference gestureFloatingPreviewText = findPreference( final Preference gestureFloatingPreviewText = findPreference(
PREF_GESTURE_FLOATING_PREVIEW_TEXT); PREF_SHOW_GESTURE_FLOATING_PREVIEW_TEXT);
if (!gestureInputEnabledByBuildConfig) { if (!gestureInputEnabledByBuildConfig) {
miscSettings.removePreference(findPreference(PREF_GESTURE_INPUT)); miscSettings.removePreference(findPreference(PREF_GESTURE_INPUT));
miscSettings.removePreference(gesturePreviewTrail); miscSettings.removePreference(gesturePreviewTrail);
@ -304,7 +304,7 @@ public class Settings extends InputMethodSettingsFragment
PREF_GESTURE_INPUT, true); PREF_GESTURE_INPUT, true);
setPreferenceEnabled(findPreference(PREF_GESTURE_PREVIEW_TRAIL), setPreferenceEnabled(findPreference(PREF_GESTURE_PREVIEW_TRAIL),
gestureInputEnabledByUser); gestureInputEnabledByUser);
setPreferenceEnabled(findPreference(PREF_GESTURE_FLOATING_PREVIEW_TEXT), setPreferenceEnabled(findPreference(PREF_SHOW_GESTURE_FLOATING_PREVIEW_TEXT),
gestureInputEnabledByUser); gestureInputEnabledByUser);
} }
} }

View file

@ -178,7 +178,7 @@ public final class SettingsValues {
&& prefs.getBoolean(Settings.PREF_GESTURE_INPUT, true); && prefs.getBoolean(Settings.PREF_GESTURE_INPUT, true);
mGesturePreviewTrailEnabled = prefs.getBoolean(Settings.PREF_GESTURE_PREVIEW_TRAIL, true); mGesturePreviewTrailEnabled = prefs.getBoolean(Settings.PREF_GESTURE_PREVIEW_TRAIL, true);
mGestureFloatingPreviewTextEnabled = prefs.getBoolean( mGestureFloatingPreviewTextEnabled = prefs.getBoolean(
Settings.PREF_GESTURE_FLOATING_PREVIEW_TEXT, true); Settings.PREF_SHOW_GESTURE_FLOATING_PREVIEW_TEXT, false);
mCorrectionEnabled = mAutoCorrectEnabled && !mInputAttributes.mInputTypeNoAutoCorrect; mCorrectionEnabled = mAutoCorrectEnabled && !mInputAttributes.mInputTypeNoAutoCorrect;
mSuggestionVisibility = createSuggestionVisibility(res); mSuggestionVisibility = createSuggestionVisibility(res);
} }