Show gesture floating preview text by default
Bug: 7244214 Change-Id: Ib4ab810ef50798828dd10c39a8077466165772e4main
parent
d80fd3058c
commit
15281adbc1
|
@ -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"
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue