diff options
author | Christopher R. Palmer <crpalmer@gmail.com> | 2014-04-30 09:43:22 -0400 |
---|---|---|
committer | Christopher R. Palmer <crpalmer@gmail.com> | 2014-05-02 10:19:06 -0400 |
commit | 9ad492a68916ab44037ac02303af99f6889ceb28 (patch) | |
tree | 88b921eba225ffbae938a329e930a510bb51d5af | |
parent | ef21994a56168464fc28fed787ec936715e50248 (diff) | |
download | android_packages_inputmethods_LatinIME-9ad492a68916ab44037ac02303af99f6889ceb28.tar.gz android_packages_inputmethods_LatinIME-9ad492a68916ab44037ac02303af99f6889ceb28.tar.bz2 android_packages_inputmethods_LatinIME-9ad492a68916ab44037ac02303af99f6889ceb28.zip |
LatinIME: Add a configuration for preview view transient test
Preview Views are only rendered when they not still in a
transient state.
This test is based on properties of the display and some new
large displays may require that this test be tuned. Expose an
overlay'able tunable to allow this tuning to be applied.
Change-Id: I387a1f5f17b6d0f2085c4831fb2813064331e00c
-rw-r--r-- | java/res/values/config.xml | 4 | ||||
-rw-r--r-- | java/src/com/android/inputmethod/keyboard/MainKeyboardView.java | 8 |
2 files changed, 11 insertions, 1 deletions
diff --git a/java/res/values/config.xml b/java/res/values/config.xml index 61779d4b5..41e47abb5 100644 --- a/java/res/values/config.xml +++ b/java/res/values/config.xml @@ -134,4 +134,8 @@ <bool name="display_notification_for_auto_update">false</bool> <bool name="display_notification_for_user_requested_update">false</bool> + <!-- Fraction of the display height to use to determine whether or not the + current keyboard position is still in a transient state and therefore we + should defer displaying preview views such --> + <integer name="config_custom_keyboard_coordinate_fraction">4</integer> </resources> diff --git a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java index 13db47004..0122bea44 100644 --- a/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java +++ b/java/src/com/android/inputmethod/keyboard/MainKeyboardView.java @@ -20,6 +20,7 @@ import android.animation.AnimatorInflater; import android.animation.ObjectAnimator; import android.content.Context; import android.content.SharedPreferences; +import android.content.res.Resources; import android.content.pm.PackageManager; import android.content.res.TypedArray; import android.graphics.Canvas; @@ -148,6 +149,7 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack private int mAltCodeKeyWhileTypingAnimAlpha = Constants.Color.ALPHA_OPAQUE; // Preview placer view + private final int mCustomKeyboardCoordinateFraction; private final PreviewPlacerView mPreviewPlacerView; private final int[] mOriginCoords = CoordinateUtils.newInstance(); private final GestureFloatingPreviewText mGestureFloatingPreviewText; @@ -434,6 +436,10 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack mNonDistinctMultitouchHelper = hasDistinctMultitouch ? null : new NonDistinctMultitouchHelper(); + final Resources res = context.getResources(); + mCustomKeyboardCoordinateFraction = res.getInteger( + R.integer.config_custom_keyboard_coordinate_fraction); + mPreviewPlacerView = new PreviewPlacerView(context, attrs); final TypedArray mainKeyboardViewAttr = context.obtainStyledAttributes( @@ -653,7 +659,7 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack } getLocationInWindow(mOriginCoords); final DisplayMetrics dm = getResources().getDisplayMetrics(); - if (CoordinateUtils.y(mOriginCoords) < dm.heightPixels / 4) { + if (CoordinateUtils.y(mOriginCoords) < dm.heightPixels / mCustomKeyboardCoordinateFraction) { // In transient state. return; } |