am de102ede: am 15281adb: Show gesture floating preview text by default

* commit 'de102ede499cd3baf93561d06c5fe3e663276d2e':
  Show gesture floating preview text by default
main
Tadashi G. Takaoka 2012-10-01 23:38:12 -07:00 committed by Android Git Automerger
commit 58e1be74a9
4 changed files with 20 additions and 9 deletions

View File

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

View File

@ -30,6 +30,7 @@ import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.os.Message;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.SparseArray;
import android.util.TypedValue;
@ -824,10 +825,19 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
if (mPreviewPlacerView.getParent() != null) {
return;
}
final int width = getWidth();
final int height = getHeight();
if (width == 0 || height == 0) {
// In transient state.
return;
}
final int[] viewOrigin = new int[2];
getLocationInWindow(viewOrigin);
mPreviewPlacerView.setKeyboardViewGeometry(
viewOrigin[0], viewOrigin[1], getWidth(), getHeight());
final DisplayMetrics dm = getResources().getDisplayMetrics();
if (viewOrigin[1] < dm.heightPixels / 4) {
// In transient state.
return;
}
final View rootView = getRootView();
if (rootView == null) {
Log.w(TAG, "Cannot find root view");
@ -839,6 +849,7 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
Log.w(TAG, "Cannot find android.R.id.content view to add PreviewPlacerView");
} else {
windowContentView.addView(mPreviewPlacerView);
mPreviewPlacerView.setKeyboardViewGeometry(viewOrigin[0], viewOrigin[1], width, height);
}
}

View File

@ -74,8 +74,8 @@ public final 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_SHOW_GESTURE_FLOATING_PREVIEW_TEXT =
"pref_show_gesture_floating_preview_text";
public static final String PREF_GESTURE_FLOATING_PREVIEW_TEXT =
"pref_gesture_floating_preview_text";
public static final String PREF_INPUT_LANGUAGE = "input_language";
public static final String PREF_SELECTED_LANGUAGES = "selected_languages";
@ -208,7 +208,7 @@ public final 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_SHOW_GESTURE_FLOATING_PREVIEW_TEXT);
PREF_GESTURE_FLOATING_PREVIEW_TEXT);
if (!gestureInputEnabledByBuildConfig) {
miscSettings.removePreference(findPreference(PREF_GESTURE_INPUT));
miscSettings.removePreference(gesturePreviewTrail);
@ -287,7 +287,7 @@ public final class Settings extends InputMethodSettingsFragment
PREF_GESTURE_INPUT, true);
setPreferenceEnabled(findPreference(PREF_GESTURE_PREVIEW_TRAIL),
gestureInputEnabledByUser);
setPreferenceEnabled(findPreference(PREF_SHOW_GESTURE_FLOATING_PREVIEW_TEXT),
setPreferenceEnabled(findPreference(PREF_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_SHOW_GESTURE_FLOATING_PREVIEW_TEXT, false);
Settings.PREF_GESTURE_FLOATING_PREVIEW_TEXT, true);
mCorrectionEnabled = mAutoCorrectEnabled && !mInputAttributes.mInputTypeNoAutoCorrect;
mSuggestionVisibility = createSuggestionVisibility(res);
}