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: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,22 +189,29 @@ public class PreviewPlacerView extends RelativeLayout {
} }
public void invalidatePointer(final PointerTracker tracker, final boolean isOldestTracker) { public void invalidatePointer(final PointerTracker tracker, final boolean isOldestTracker) {
GesturePreviewTrail trail; final boolean needsToUpdateLastPointer =
synchronized (mGesturePreviewTrails) { isOldestTracker && mDrawsGestureFloatingPreviewText;
trail = mGesturePreviewTrails.get(tracker.mPointerId); if (needsToUpdateLastPointer) {
if (trail == null) {
trail = new GesturePreviewTrail();
mGesturePreviewTrails.put(tracker.mPointerId, trail);
}
}
trail.addStroke(tracker.getGestureStrokeWithPreviewTrail(), tracker.getDownTime());
if (isOldestTracker) {
mLastPointerX = tracker.getLastX(); mLastPointerX = tracker.getLastX();
mLastPointerY = tracker.getLastY(); 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. // TODO: Should narrow the invalidate region.
invalidate(); if (mDrawsGesturePreviewTrail || needsToUpdateLastPointer) {
invalidate();
}
} }
@Override @Override
@ -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);
} }