Merge "Show gesture floating preview text is off by default" into jb-mr1-dev

main
Tadashi G. Takaoka 2012-09-19 03:00:40 -07:00 committed by Android (Google) Code Review
commit 567204a140
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,22 +189,29 @@ public class PreviewPlacerView extends RelativeLayout {
}
public void invalidatePointer(final PointerTracker tracker, final boolean isOldestTracker) {
GesturePreviewTrail trail;
synchronized (mGesturePreviewTrails) {
trail = mGesturePreviewTrails.get(tracker.mPointerId);
if (trail == null) {
trail = new GesturePreviewTrail();
mGesturePreviewTrails.put(tracker.mPointerId, trail);
}
}
trail.addStroke(tracker.getGestureStrokeWithPreviewTrail(), tracker.getDownTime());
if (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);
if (trail == null) {
trail = new GesturePreviewTrail();
mGesturePreviewTrails.put(tracker.mPointerId, trail);
}
}
trail.addStroke(tracker.getGestureStrokeWithPreviewTrail(), tracker.getDownTime());
}
// TODO: Should narrow the invalidate region.
invalidate();
if (mDrawsGesturePreviewTrail || needsToUpdateLastPointer) {
invalidate();
}
}
@Override
@ -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);
}