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
main
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:defaultValue="true" />
<CheckBoxPreference
android:key="pref_gesture_floating_preview_text"
android:key="pref_show_gesture_floating_preview_text"
android:title="@string/gesture_floating_preview_text"
android:summary="@string/gesture_floating_preview_text_summary"
android:persistent="true"
android:defaultValue="true" />
android:defaultValue="false" />
</PreferenceScreen>
</PreferenceCategory>
</PreferenceScreen>

View File

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

View File

@ -77,8 +77,8 @@ public class Settings extends InputMethodSettingsFragment
public static final String 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_FLOATING_PREVIEW_TEXT =
"pref_gesture_floating_preview_text";
public static final String PREF_SHOW_GESTURE_FLOATING_PREVIEW_TEXT =
"pref_show_gesture_floating_preview_text";
public static final String PREF_INPUT_LANGUAGE = "input_language";
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);
final Preference gesturePreviewTrail = findPreference(PREF_GESTURE_PREVIEW_TRAIL);
final Preference gestureFloatingPreviewText = findPreference(
PREF_GESTURE_FLOATING_PREVIEW_TEXT);
PREF_SHOW_GESTURE_FLOATING_PREVIEW_TEXT);
if (!gestureInputEnabledByBuildConfig) {
miscSettings.removePreference(findPreference(PREF_GESTURE_INPUT));
miscSettings.removePreference(gesturePreviewTrail);
@ -304,7 +304,7 @@ public class Settings extends InputMethodSettingsFragment
PREF_GESTURE_INPUT, true);
setPreferenceEnabled(findPreference(PREF_GESTURE_PREVIEW_TRAIL),
gestureInputEnabledByUser);
setPreferenceEnabled(findPreference(PREF_GESTURE_FLOATING_PREVIEW_TEXT),
setPreferenceEnabled(findPreference(PREF_SHOW_GESTURE_FLOATING_PREVIEW_TEXT),
gestureInputEnabledByUser);
}
}

View File

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