Merge "Add theme aware key popup preview animation" into lmp-dev
commit
afa9d6d8de
|
@ -0,0 +1,32 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
/*
|
||||||
|
**
|
||||||
|
** Copyright 2014, The Android Open Source Project
|
||||||
|
**
|
||||||
|
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
** you may not use this file except in compliance with the License.
|
||||||
|
** You may obtain a copy of the License at
|
||||||
|
**
|
||||||
|
** http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
**
|
||||||
|
** Unless required by applicable law or agreed to in writing, software
|
||||||
|
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
** See the License for the specific language governing permissions and
|
||||||
|
** limitations under the License.
|
||||||
|
*/
|
||||||
|
-->
|
||||||
|
|
||||||
|
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<objectAnimator
|
||||||
|
android:propertyName="scaleX"
|
||||||
|
android:duration="53"
|
||||||
|
android:valueFrom="1.00"
|
||||||
|
android:valueTo="0.94" />
|
||||||
|
<objectAnimator
|
||||||
|
android:propertyName="scaleY"
|
||||||
|
android:duration="53"
|
||||||
|
android:valueFrom="1.00"
|
||||||
|
android:valueTo="0.94" />
|
||||||
|
</set>
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
/*
|
||||||
|
**
|
||||||
|
** Copyright 2014, The Android Open Source Project
|
||||||
|
**
|
||||||
|
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
** you may not use this file except in compliance with the License.
|
||||||
|
** You may obtain a copy of the License at
|
||||||
|
**
|
||||||
|
** http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
**
|
||||||
|
** Unless required by applicable law or agreed to in writing, software
|
||||||
|
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
** See the License for the specific language governing permissions and
|
||||||
|
** limitations under the License.
|
||||||
|
*/
|
||||||
|
-->
|
||||||
|
|
||||||
|
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<objectAnimator
|
||||||
|
android:propertyName="scaleX"
|
||||||
|
android:duration="53"
|
||||||
|
android:valueFrom="1.00"
|
||||||
|
android:valueTo="1.00" />
|
||||||
|
<objectAnimator
|
||||||
|
android:propertyName="scaleY"
|
||||||
|
android:duration="53"
|
||||||
|
android:valueFrom="1.00"
|
||||||
|
android:valueTo="0.94" />
|
||||||
|
</set>
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
/*
|
||||||
|
**
|
||||||
|
** Copyright 2014, The Android Open Source Project
|
||||||
|
**
|
||||||
|
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
** you may not use this file except in compliance with the License.
|
||||||
|
** You may obtain a copy of the License at
|
||||||
|
**
|
||||||
|
** http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
**
|
||||||
|
** Unless required by applicable law or agreed to in writing, software
|
||||||
|
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
** See the License for the specific language governing permissions and
|
||||||
|
** limitations under the License.
|
||||||
|
*/
|
||||||
|
-->
|
||||||
|
|
||||||
|
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<objectAnimator
|
||||||
|
android:propertyName="scaleX"
|
||||||
|
android:duration="17"
|
||||||
|
android:valueFrom="0.98"
|
||||||
|
android:valueTo="1.00" />
|
||||||
|
<objectAnimator
|
||||||
|
android:propertyName="scaleY"
|
||||||
|
android:duration="17"
|
||||||
|
android:valueFrom="0.98"
|
||||||
|
android:valueTo="1.00" />
|
||||||
|
</set>
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
/*
|
||||||
|
**
|
||||||
|
** Copyright 2014, The Android Open Source Project
|
||||||
|
**
|
||||||
|
** Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
** you may not use this file except in compliance with the License.
|
||||||
|
** You may obtain a copy of the License at
|
||||||
|
**
|
||||||
|
** http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
**
|
||||||
|
** Unless required by applicable law or agreed to in writing, software
|
||||||
|
** distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
** See the License for the specific language governing permissions and
|
||||||
|
** limitations under the License.
|
||||||
|
*/
|
||||||
|
-->
|
||||||
|
|
||||||
|
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<objectAnimator
|
||||||
|
android:propertyName="scaleX"
|
||||||
|
android:duration="17"
|
||||||
|
android:valueFrom="1.00"
|
||||||
|
android:valueTo="1.00" />
|
||||||
|
<objectAnimator
|
||||||
|
android:propertyName="scaleY"
|
||||||
|
android:duration="17"
|
||||||
|
android:valueFrom="0.98"
|
||||||
|
android:valueTo="1.00" />
|
||||||
|
</set>
|
|
@ -113,6 +113,10 @@
|
||||||
<!-- TODO: consolidate key preview linger timeout with the key preview animation parameters. -->
|
<!-- TODO: consolidate key preview linger timeout with the key preview animation parameters. -->
|
||||||
<!-- Delay after key releasing and key press feedback dismissing in millisecond -->
|
<!-- Delay after key releasing and key press feedback dismissing in millisecond -->
|
||||||
<attr name="keyPreviewLingerTimeout" format="integer" />
|
<attr name="keyPreviewLingerTimeout" format="integer" />
|
||||||
|
<!-- Key preview show up animator -->
|
||||||
|
<attr name="keyPreviewShowUpAnimator" format="reference" />
|
||||||
|
<!-- Key preview dismiss animator -->
|
||||||
|
<attr name="keyPreviewDismissAnimator" format="reference" />
|
||||||
<!-- Layout resource for more keys keyboard -->
|
<!-- Layout resource for more keys keyboard -->
|
||||||
<attr name="moreKeysKeyboardLayout" format="reference" />
|
<attr name="moreKeysKeyboardLayout" format="reference" />
|
||||||
<attr name="backgroundDimAlpha" format="integer" />
|
<attr name="backgroundDimAlpha" format="integer" />
|
||||||
|
|
|
@ -331,14 +331,20 @@ mobile devices. [CHAR LIMIT=25] -->
|
||||||
<string name="prefs_keypress_vibration_duration_settings">Keypress vibration duration</string>
|
<string name="prefs_keypress_vibration_duration_settings">Keypress vibration duration</string>
|
||||||
<!-- Title of the settings for keypress sound volume [CHAR LIMIT=35] -->
|
<!-- Title of the settings for keypress sound volume [CHAR LIMIT=35] -->
|
||||||
<string name="prefs_keypress_sound_volume_settings">Keypress sound volume</string>
|
<string name="prefs_keypress_sound_volume_settings">Keypress sound volume</string>
|
||||||
|
<!-- Title of the settings for customize key popup animation parameters [CHAR LIMIT=35] -->
|
||||||
|
<string name="prefs_customize_key_preview_animation">Customize key preview animation</string>
|
||||||
<!-- Title of the settings for key popup show up animation duration (in milliseconds) [CHAR LIMIT=35] -->
|
<!-- Title of the settings for key popup show up animation duration (in milliseconds) [CHAR LIMIT=35] -->
|
||||||
<string name="prefs_key_popup_show_up_duration_settings" translatable="false">Key popup show up duration</string>
|
<string name="prefs_key_popup_show_up_duration_settings" translatable="false">Key popup show up duration</string>
|
||||||
<!-- Title of the settings for key popup dismiss animation duration (in milliseconds) [CHAR LIMIT=35] -->
|
<!-- Title of the settings for key popup dismiss animation duration (in milliseconds) [CHAR LIMIT=35] -->
|
||||||
<string name="prefs_key_popup_dismiss_duration_settings" translatable="false">Key popup dismiss duration</string>
|
<string name="prefs_key_popup_dismiss_duration_settings" translatable="false">Key popup dismiss duration</string>
|
||||||
<!-- Title of the settings for key popup show up animation start scale (in percentile) [CHAR LIMIT=35] -->
|
<!-- Title of the settings for key popup show up animation start X-scale (in percentile) [CHAR LIMIT=35] -->
|
||||||
<string name="prefs_key_popup_show_up_start_scale_settings" translatable="false">Key popup show up start scale</string>
|
<string name="prefs_key_popup_show_up_start_x_scale_settings" translatable="false">Key popup show up start X scale</string>
|
||||||
<!-- Title of the settings for key popup dismiss animation end scale (in percentile) [CHAR LIMIT=35] -->
|
<!-- Title of the settings for key popup show up animation start Y-scale (in percentile) [CHAR LIMIT=35] -->
|
||||||
<string name="prefs_key_popup_dismiss_end_scale_settings" translatable="false">Key popup dismiss end scale</string>
|
<string name="prefs_key_popup_show_up_start_y_scale_settings" translatable="false">Key popup show up start Y scale</string>
|
||||||
|
<!-- Title of the settings for key popup dismiss animation end X-scale (in percentile) [CHAR LIMIT=35] -->
|
||||||
|
<string name="prefs_key_popup_dismiss_end_x_scale_settings" translatable="false">Key popup dismiss end X scale</string>
|
||||||
|
<!-- Title of the settings for key popup dismiss animation end Y-scale (in percentile) [CHAR LIMIT=35] -->
|
||||||
|
<string name="prefs_key_popup_dismiss_end_y_scale_settings" translatable="false">Key popup dismiss end Y scale</string>
|
||||||
<!-- Title of the settings for reading an external dictionary file -->
|
<!-- Title of the settings for reading an external dictionary file -->
|
||||||
<string name="prefs_read_external_dictionary">Read external dictionary file</string>
|
<string name="prefs_read_external_dictionary">Read external dictionary file</string>
|
||||||
<!-- Message to show when there are no files to install as an external dictionary [CHAR LIMIT=100] -->
|
<!-- Message to show when there are no files to install as an external dictionary [CHAR LIMIT=100] -->
|
||||||
|
|
|
@ -59,6 +59,8 @@
|
||||||
>
|
>
|
||||||
<item name="keyPreviewBackground">@drawable/keyboard_key_feedback_ics</item>
|
<item name="keyPreviewBackground">@drawable/keyboard_key_feedback_ics</item>
|
||||||
<item name="keyPreviewOffset">@dimen/config_key_preview_offset_holo</item>
|
<item name="keyPreviewOffset">@dimen/config_key_preview_offset_holo</item>
|
||||||
|
<item name="keyPreviewShowUpAnimator">@anim/key_preview_show_up_holo</item>
|
||||||
|
<item name="keyPreviewDismissAnimator">@anim/key_preview_dismiss_holo</item>
|
||||||
<item name="gestureFloatingPreviewTextColor">@color/highlight_color_ics</item>
|
<item name="gestureFloatingPreviewTextColor">@color/highlight_color_ics</item>
|
||||||
<item name="gestureFloatingPreviewColor">@color/gesture_floating_preview_color_holo</item>
|
<item name="gestureFloatingPreviewColor">@color/gesture_floating_preview_color_holo</item>
|
||||||
<item name="gestureTrailColor">@color/highlight_color_ics</item>
|
<item name="gestureTrailColor">@color/highlight_color_ics</item>
|
||||||
|
|
|
@ -59,6 +59,8 @@
|
||||||
>
|
>
|
||||||
<item name="keyPreviewBackground">@drawable/keyboard_key_feedback_klp</item>
|
<item name="keyPreviewBackground">@drawable/keyboard_key_feedback_klp</item>
|
||||||
<item name="keyPreviewOffset">@dimen/config_key_preview_offset_holo</item>
|
<item name="keyPreviewOffset">@dimen/config_key_preview_offset_holo</item>
|
||||||
|
<item name="keyPreviewShowUpAnimator">@anim/key_preview_show_up_holo</item>
|
||||||
|
<item name="keyPreviewDismissAnimator">@anim/key_preview_dismiss_holo</item>
|
||||||
<item name="gestureFloatingPreviewTextColor">@color/highlight_color_klp</item>
|
<item name="gestureFloatingPreviewTextColor">@color/highlight_color_klp</item>
|
||||||
<item name="gestureFloatingPreviewColor">@color/gesture_floating_preview_color_holo</item>
|
<item name="gestureFloatingPreviewColor">@color/gesture_floating_preview_color_holo</item>
|
||||||
<item name="gestureTrailColor">@color/highlight_color_klp</item>
|
<item name="gestureTrailColor">@color/highlight_color_klp</item>
|
||||||
|
|
|
@ -59,6 +59,8 @@
|
||||||
>
|
>
|
||||||
<item name="keyPreviewBackground">@drawable/keyboard_key_feedback_lxx_dark</item>
|
<item name="keyPreviewBackground">@drawable/keyboard_key_feedback_lxx_dark</item>
|
||||||
<item name="keyPreviewOffset">@dimen/config_key_preview_offset_holo</item>
|
<item name="keyPreviewOffset">@dimen/config_key_preview_offset_holo</item>
|
||||||
|
<item name="keyPreviewShowUpAnimator">@anim/key_preview_show_up_lxx</item>
|
||||||
|
<item name="keyPreviewDismissAnimator">@anim/key_preview_dismiss_lxx</item>
|
||||||
<item name="gestureFloatingPreviewTextColor">@color/auto_correct_color_lxx_dark</item>
|
<item name="gestureFloatingPreviewTextColor">@color/auto_correct_color_lxx_dark</item>
|
||||||
<item name="gestureFloatingPreviewColor">@color/gesture_floating_preview_color_lxx_dark</item>
|
<item name="gestureFloatingPreviewColor">@color/gesture_floating_preview_color_lxx_dark</item>
|
||||||
<item name="gestureTrailColor">@color/gesture_trail_color_lxx_dark</item>
|
<item name="gestureTrailColor">@color/gesture_trail_color_lxx_dark</item>
|
||||||
|
|
|
@ -59,6 +59,8 @@
|
||||||
>
|
>
|
||||||
<item name="keyPreviewBackground">@drawable/keyboard_key_feedback_lxx_light</item>
|
<item name="keyPreviewBackground">@drawable/keyboard_key_feedback_lxx_light</item>
|
||||||
<item name="keyPreviewOffset">@dimen/config_key_preview_offset_holo</item>
|
<item name="keyPreviewOffset">@dimen/config_key_preview_offset_holo</item>
|
||||||
|
<item name="keyPreviewShowUpAnimator">@anim/key_preview_show_up_lxx</item>
|
||||||
|
<item name="keyPreviewDismissAnimator">@anim/key_preview_dismiss_lxx</item>
|
||||||
<item name="gestureFloatingPreviewTextColor">@color/auto_correct_color_lxx_light</item>
|
<item name="gestureFloatingPreviewTextColor">@color/auto_correct_color_lxx_light</item>
|
||||||
<item name="gestureFloatingPreviewColor">@color/gesture_floating_preview_color_lxx_light</item>
|
<item name="gestureFloatingPreviewColor">@color/gesture_floating_preview_color_lxx_light</item>
|
||||||
<item name="gestureTrailColor">@color/gesture_trail_color_lxx_light</item>
|
<item name="gestureTrailColor">@color/gesture_trail_color_lxx_light</item>
|
||||||
|
|
|
@ -52,19 +52,38 @@
|
||||||
latin:minValue="@integer/config_min_longpress_timeout"
|
latin:minValue="@integer/config_min_longpress_timeout"
|
||||||
latin:maxValue="@integer/config_max_longpress_timeout"
|
latin:maxValue="@integer/config_max_longpress_timeout"
|
||||||
latin:stepValue="@integer/config_longpress_timeout_step" />
|
latin:stepValue="@integer/config_longpress_timeout_step" />
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:key="pref_has_custom_key_preview_animation_params"
|
||||||
|
android:title="@string/prefs_customize_key_preview_animation"
|
||||||
|
android:defaultValue="false"
|
||||||
|
android:persistent="true" />
|
||||||
<com.android.inputmethod.latin.settings.SeekBarDialogPreference
|
<com.android.inputmethod.latin.settings.SeekBarDialogPreference
|
||||||
android:key="pref_key_preview_show_up_start_scale"
|
android:dependency="pref_customize_key_preview_animation"
|
||||||
android:title="@string/prefs_key_popup_show_up_start_scale_settings"
|
android:key="pref_key_preview_show_up_start_x_scale"
|
||||||
|
android:title="@string/prefs_key_popup_show_up_start_x_scale_settings"
|
||||||
latin:maxValue="100" /> <!-- percent -->
|
latin:maxValue="100" /> <!-- percent -->
|
||||||
<com.android.inputmethod.latin.settings.SeekBarDialogPreference
|
<com.android.inputmethod.latin.settings.SeekBarDialogPreference
|
||||||
android:key="pref_key_preview_dismiss_end_scale"
|
android:dependency="pref_customize_key_preview_animation"
|
||||||
android:title="@string/prefs_key_popup_dismiss_end_scale_settings"
|
android:key="pref_key_preview_show_up_start_y_scale"
|
||||||
|
android:title="@string/prefs_key_popup_show_up_start_y_scale_settings"
|
||||||
latin:maxValue="100" /> <!-- percent -->
|
latin:maxValue="100" /> <!-- percent -->
|
||||||
<com.android.inputmethod.latin.settings.SeekBarDialogPreference
|
<com.android.inputmethod.latin.settings.SeekBarDialogPreference
|
||||||
|
android:dependency="pref_customize_key_preview_animation"
|
||||||
|
android:key="pref_key_preview_dismiss_end_x_scale"
|
||||||
|
android:title="@string/prefs_key_popup_dismiss_end_x_scale_settings"
|
||||||
|
latin:maxValue="100" /> <!-- percent -->
|
||||||
|
<com.android.inputmethod.latin.settings.SeekBarDialogPreference
|
||||||
|
android:dependency="pref_customize_key_preview_animation"
|
||||||
|
android:key="pref_key_preview_dismiss_end_y_scale"
|
||||||
|
android:title="@string/prefs_key_popup_dismiss_end_y_scale_settings"
|
||||||
|
latin:maxValue="100" /> <!-- percent -->
|
||||||
|
<com.android.inputmethod.latin.settings.SeekBarDialogPreference
|
||||||
|
android:dependency="pref_customize_key_preview_animation"
|
||||||
android:key="pref_key_preview_show_up_duration"
|
android:key="pref_key_preview_show_up_duration"
|
||||||
android:title="@string/prefs_key_popup_show_up_duration_settings"
|
android:title="@string/prefs_key_popup_show_up_duration_settings"
|
||||||
latin:maxValue="100" /> <!-- milliseconds -->
|
latin:maxValue="100" /> <!-- milliseconds -->
|
||||||
<com.android.inputmethod.latin.settings.SeekBarDialogPreference
|
<com.android.inputmethod.latin.settings.SeekBarDialogPreference
|
||||||
|
android:dependency="pref_customize_key_preview_animation"
|
||||||
android:key="pref_key_preview_dismiss_duration"
|
android:key="pref_key_preview_dismiss_duration"
|
||||||
android:title="@string/prefs_key_popup_dismiss_duration_settings"
|
android:title="@string/prefs_key_popup_dismiss_duration_settings"
|
||||||
latin:maxValue="100" /> <!-- milliseconds -->
|
latin:maxValue="100" /> <!-- milliseconds -->
|
||||||
|
|
|
@ -153,9 +153,12 @@ public final class KeyboardSwitcher implements KeyboardState.SwitchActions {
|
||||||
mCurrentSettingsValues.mKeyPreviewPopupOn,
|
mCurrentSettingsValues.mKeyPreviewPopupOn,
|
||||||
mCurrentSettingsValues.mKeyPreviewPopupDismissDelay);
|
mCurrentSettingsValues.mKeyPreviewPopupDismissDelay);
|
||||||
keyboardView.setKeyPreviewAnimationParams(
|
keyboardView.setKeyPreviewAnimationParams(
|
||||||
mCurrentSettingsValues.mKeyPreviewShowUpStartScale,
|
mCurrentSettingsValues.mHasCustomKeyPreviewAnimationParams,
|
||||||
|
mCurrentSettingsValues.mKeyPreviewShowUpStartXScale,
|
||||||
|
mCurrentSettingsValues.mKeyPreviewShowUpStartYScale,
|
||||||
mCurrentSettingsValues.mKeyPreviewShowUpDuration,
|
mCurrentSettingsValues.mKeyPreviewShowUpDuration,
|
||||||
mCurrentSettingsValues.mKeyPreviewDismissEndScale,
|
mCurrentSettingsValues.mKeyPreviewDismissEndXScale,
|
||||||
|
mCurrentSettingsValues.mKeyPreviewDismissEndYScale,
|
||||||
mCurrentSettingsValues.mKeyPreviewDismissDuration);
|
mCurrentSettingsValues.mKeyPreviewDismissDuration);
|
||||||
keyboardView.updateShortcutKey(mSubtypeSwitcher.isShortcutImeReady());
|
keyboardView.updateShortcutKey(mSubtypeSwitcher.isShortcutImeReady());
|
||||||
final boolean subtypeChanged = (oldKeyboard == null)
|
final boolean subtypeChanged = (oldKeyboard == null)
|
||||||
|
|
|
@ -86,6 +86,8 @@ import java.util.WeakHashMap;
|
||||||
* @attr ref R.styleable#MainKeyboardView_keyPreviewOffset
|
* @attr ref R.styleable#MainKeyboardView_keyPreviewOffset
|
||||||
* @attr ref R.styleable#MainKeyboardView_keyPreviewHeight
|
* @attr ref R.styleable#MainKeyboardView_keyPreviewHeight
|
||||||
* @attr ref R.styleable#MainKeyboardView_keyPreviewLingerTimeout
|
* @attr ref R.styleable#MainKeyboardView_keyPreviewLingerTimeout
|
||||||
|
* @attr ref R.styleable#MainKeyboardView_keyPreviewShowUpAnimator
|
||||||
|
* @attr ref R.styleable#MainKeyboardView_keyPreviewDismissAnimator
|
||||||
* @attr ref R.styleable#MainKeyboardView_moreKeysKeyboardLayout
|
* @attr ref R.styleable#MainKeyboardView_moreKeysKeyboardLayout
|
||||||
* @attr ref R.styleable#MainKeyboardView_backgroundDimAlpha
|
* @attr ref R.styleable#MainKeyboardView_backgroundDimAlpha
|
||||||
* @attr ref R.styleable#MainKeyboardView_showMoreKeysKeyboardAtTouchPoint
|
* @attr ref R.styleable#MainKeyboardView_showMoreKeysKeyboardAtTouchPoint
|
||||||
|
@ -391,20 +393,34 @@ public final class MainKeyboardView extends KeyboardView implements PointerTrack
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enables or disables the key feedback popup. This is a popup that shows a magnified
|
* Enables or disables the key preview popup. This is a popup that shows a magnified
|
||||||
* version of the depressed key. By default the preview is enabled.
|
* version of the depressed key. By default the preview is enabled.
|
||||||
* @param previewEnabled whether or not to enable the key feedback preview
|
* @param previewEnabled whether or not to enable the key feedback preview
|
||||||
* @param delay the delay after which the preview is dismissed
|
* @param delay the delay after which the preview is dismissed
|
||||||
* @see #isKeyPreviewPopupEnabled()
|
|
||||||
*/
|
*/
|
||||||
public void setKeyPreviewPopupEnabled(final boolean previewEnabled, final int delay) {
|
public void setKeyPreviewPopupEnabled(final boolean previewEnabled, final int delay) {
|
||||||
mKeyPreviewDrawParams.setPopupEnabled(previewEnabled, delay);
|
mKeyPreviewDrawParams.setPopupEnabled(previewEnabled, delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setKeyPreviewAnimationParams(final float showUpStartScale, final int showUpDuration,
|
/**
|
||||||
final float dismissEndScale, final int dismissDuration) {
|
* Enables or disables the key preview popup animations and set animations' parameters.
|
||||||
mKeyPreviewDrawParams.setAnimationParams(
|
*
|
||||||
showUpStartScale, showUpDuration, dismissEndScale, dismissDuration);
|
* @param hasCustomAnimationParams false to use the default key preview popup animations
|
||||||
|
* specified by keyPreviewShowUpAnimator and keyPreviewDismissAnimator attributes.
|
||||||
|
* true to override the default animations with the specified parameters.
|
||||||
|
* @param showUpStartXScale from this x-scale the show up animation will start.
|
||||||
|
* @param showUpStartYScale from this y-scale the show up animation will start.
|
||||||
|
* @param showUpDuration the duration of the show up animation in milliseconds.
|
||||||
|
* @param dismissEndXScale to this x-scale the dismiss animation will end.
|
||||||
|
* @param dismissEndYScale to this y-scale the dismiss animation will end.
|
||||||
|
* @param dismissDuration the duration of the dismiss animation in milliseconds.
|
||||||
|
*/
|
||||||
|
public void setKeyPreviewAnimationParams(final boolean hasCustomAnimationParams,
|
||||||
|
final float showUpStartXScale, final float showUpStartYScale, final int showUpDuration,
|
||||||
|
final float dismissEndXScale, final float dismissEndYScale, final int dismissDuration) {
|
||||||
|
mKeyPreviewDrawParams.setAnimationParams(hasCustomAnimationParams,
|
||||||
|
showUpStartXScale, showUpStartYScale, showUpDuration,
|
||||||
|
dismissEndXScale, dismissEndYScale, dismissDuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void locatePreviewPlacerView() {
|
private void locatePreviewPlacerView() {
|
||||||
|
|
|
@ -18,13 +18,9 @@ package com.android.inputmethod.keyboard.internal;
|
||||||
|
|
||||||
import android.animation.Animator;
|
import android.animation.Animator;
|
||||||
import android.animation.AnimatorListenerAdapter;
|
import android.animation.AnimatorListenerAdapter;
|
||||||
import android.animation.AnimatorSet;
|
|
||||||
import android.animation.ObjectAnimator;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.animation.AccelerateInterpolator;
|
|
||||||
import android.view.animation.DecelerateInterpolator;
|
|
||||||
|
|
||||||
import com.android.inputmethod.keyboard.Key;
|
import com.android.inputmethod.keyboard.Key;
|
||||||
import com.android.inputmethod.latin.utils.CoordinateUtils;
|
import com.android.inputmethod.latin.utils.CoordinateUtils;
|
||||||
|
@ -89,9 +85,9 @@ public final class KeyPreviewChoreographer {
|
||||||
}
|
}
|
||||||
final Object tag = keyPreviewView.getTag();
|
final Object tag = keyPreviewView.getTag();
|
||||||
if (withAnimation) {
|
if (withAnimation) {
|
||||||
if (tag instanceof KeyPreviewAnimations) {
|
if (tag instanceof KeyPreviewAnimators) {
|
||||||
final KeyPreviewAnimations animation = (KeyPreviewAnimations)tag;
|
final KeyPreviewAnimators animators = (KeyPreviewAnimators)tag;
|
||||||
animation.startDismiss();
|
animators.startDismiss();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -161,87 +157,60 @@ public final class KeyPreviewChoreographer {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show preview with animation.
|
// Show preview with animation.
|
||||||
final Animator showUpAnimation = createShowUpAniation(key, keyPreviewView);
|
final Animator showUpAnimator = createShowUpAnimator(key, keyPreviewView);
|
||||||
final Animator dismissAnimation = createDismissAnimation(key, keyPreviewView);
|
final Animator dismissAnimator = createDismissAnimator(key, keyPreviewView);
|
||||||
final KeyPreviewAnimations animation = new KeyPreviewAnimations(
|
final KeyPreviewAnimators animators = new KeyPreviewAnimators(
|
||||||
showUpAnimation, dismissAnimation);
|
showUpAnimator, dismissAnimator);
|
||||||
keyPreviewView.setTag(animation);
|
keyPreviewView.setTag(animators);
|
||||||
animation.startShowUp();
|
animators.startShowUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final float KEY_PREVIEW_SHOW_UP_END_SCALE = 1.0f;
|
public Animator createShowUpAnimator(final Key key, final KeyPreviewView keyPreviewView) {
|
||||||
private static final AccelerateInterpolator ACCELERATE_INTERPOLATOR =
|
final Animator animator = mParams.createShowUpAnimator(keyPreviewView);
|
||||||
new AccelerateInterpolator();
|
animator.addListener(new AnimatorListenerAdapter() {
|
||||||
private static final DecelerateInterpolator DECELERATE_INTERPOLATOR =
|
|
||||||
new DecelerateInterpolator();
|
|
||||||
|
|
||||||
private Animator createShowUpAniation(final Key key, final KeyPreviewView keyPreviewView) {
|
|
||||||
// TODO: Optimization for no scale animation and no duration.
|
|
||||||
final ObjectAnimator scaleXAnimation = ObjectAnimator.ofFloat(
|
|
||||||
keyPreviewView, View.SCALE_X, mParams.getShowUpStartScale(),
|
|
||||||
KEY_PREVIEW_SHOW_UP_END_SCALE);
|
|
||||||
final ObjectAnimator scaleYAnimation = ObjectAnimator.ofFloat(
|
|
||||||
keyPreviewView, View.SCALE_Y, mParams.getShowUpStartScale(),
|
|
||||||
KEY_PREVIEW_SHOW_UP_END_SCALE);
|
|
||||||
final AnimatorSet showUpAnimation = new AnimatorSet();
|
|
||||||
showUpAnimation.play(scaleXAnimation).with(scaleYAnimation);
|
|
||||||
showUpAnimation.setDuration(mParams.getShowUpDuration());
|
|
||||||
showUpAnimation.setInterpolator(DECELERATE_INTERPOLATOR);
|
|
||||||
showUpAnimation.addListener(new AnimatorListenerAdapter() {
|
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationStart(final Animator animation) {
|
public void onAnimationStart(final Animator animator) {
|
||||||
showKeyPreview(key, keyPreviewView, false /* withAnimation */);
|
showKeyPreview(key, keyPreviewView, false /* withAnimation */);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return showUpAnimation;
|
return animator;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Animator createDismissAnimation(final Key key, final KeyPreviewView keyPreviewView) {
|
private Animator createDismissAnimator(final Key key, final KeyPreviewView keyPreviewView) {
|
||||||
// TODO: Optimization for no scale animation and no duration.
|
final Animator animator = mParams.createDismissAnimator(keyPreviewView);
|
||||||
final ObjectAnimator scaleXAnimation = ObjectAnimator.ofFloat(
|
animator.addListener(new AnimatorListenerAdapter() {
|
||||||
keyPreviewView, View.SCALE_X, mParams.getDismissEndScale());
|
|
||||||
final ObjectAnimator scaleYAnimation = ObjectAnimator.ofFloat(
|
|
||||||
keyPreviewView, View.SCALE_Y, mParams.getDismissEndScale());
|
|
||||||
final AnimatorSet dismissAnimation = new AnimatorSet();
|
|
||||||
dismissAnimation.play(scaleXAnimation).with(scaleYAnimation);
|
|
||||||
final int dismissDuration = Math.min(
|
|
||||||
mParams.getDismissDuration(), mParams.getLingerTimeout());
|
|
||||||
dismissAnimation.setDuration(dismissDuration);
|
|
||||||
dismissAnimation.setInterpolator(ACCELERATE_INTERPOLATOR);
|
|
||||||
dismissAnimation.addListener(new AnimatorListenerAdapter() {
|
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationEnd(final Animator animation) {
|
public void onAnimationEnd(final Animator animator) {
|
||||||
dismissKeyPreview(key, false /* withAnimation */);
|
dismissKeyPreview(key, false /* withAnimation */);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return dismissAnimation;
|
return animator;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class KeyPreviewAnimations extends AnimatorListenerAdapter {
|
private static class KeyPreviewAnimators extends AnimatorListenerAdapter {
|
||||||
private final Animator mShowUpAnimation;
|
private final Animator mShowUpAnimator;
|
||||||
private final Animator mDismissAnimation;
|
private final Animator mDismissAnimator;
|
||||||
|
|
||||||
public KeyPreviewAnimations(final Animator showUpAnimation,
|
public KeyPreviewAnimators(final Animator showUpAnimator, final Animator dismissAnimator) {
|
||||||
final Animator dismissAnimation) {
|
mShowUpAnimator = showUpAnimator;
|
||||||
mShowUpAnimation = showUpAnimation;
|
mDismissAnimator = dismissAnimator;
|
||||||
mDismissAnimation = dismissAnimation;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startShowUp() {
|
public void startShowUp() {
|
||||||
mShowUpAnimation.start();
|
mShowUpAnimator.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void startDismiss() {
|
public void startDismiss() {
|
||||||
if (mShowUpAnimation.isRunning()) {
|
if (mShowUpAnimator.isRunning()) {
|
||||||
mShowUpAnimation.addListener(this);
|
mShowUpAnimator.addListener(this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mDismissAnimation.start();
|
mDismissAnimator.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationEnd(final Animator animation) {
|
public void onAnimationEnd(final Animator animator) {
|
||||||
mDismissAnimation.start();
|
mDismissAnimator.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,8 +16,14 @@
|
||||||
|
|
||||||
package com.android.inputmethod.keyboard.internal;
|
package com.android.inputmethod.keyboard.internal;
|
||||||
|
|
||||||
|
import android.animation.Animator;
|
||||||
|
import android.animation.AnimatorInflater;
|
||||||
|
import android.animation.AnimatorSet;
|
||||||
|
import android.animation.ObjectAnimator;
|
||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
import android.view.animation.AccelerateInterpolator;
|
||||||
|
import android.view.animation.DecelerateInterpolator;
|
||||||
|
|
||||||
import com.android.inputmethod.latin.R;
|
import com.android.inputmethod.latin.R;
|
||||||
|
|
||||||
|
@ -26,10 +32,15 @@ public final class KeyPreviewDrawParams {
|
||||||
public final int mPreviewOffset;
|
public final int mPreviewOffset;
|
||||||
public final int mPreviewHeight;
|
public final int mPreviewHeight;
|
||||||
public final int mPreviewBackgroundResId;
|
public final int mPreviewBackgroundResId;
|
||||||
|
private final int mShowUpAnimatorResId;
|
||||||
|
private final int mDismissAnimatorResId;
|
||||||
|
private boolean mHasCustomAnimationParams;
|
||||||
private int mShowUpDuration;
|
private int mShowUpDuration;
|
||||||
private int mDismissDuration;
|
private int mDismissDuration;
|
||||||
private float mShowUpStartScale;
|
private float mShowUpStartXScale;
|
||||||
private float mDismissEndScale;
|
private float mShowUpStartYScale;
|
||||||
|
private float mDismissEndXScale;
|
||||||
|
private float mDismissEndYScale;
|
||||||
private int mLingerTimeout;
|
private int mLingerTimeout;
|
||||||
private boolean mShowPopup = true;
|
private boolean mShowPopup = true;
|
||||||
|
|
||||||
|
@ -67,6 +78,10 @@ public final class KeyPreviewDrawParams {
|
||||||
R.styleable.MainKeyboardView_keyPreviewBackground, 0);
|
R.styleable.MainKeyboardView_keyPreviewBackground, 0);
|
||||||
mLingerTimeout = mainKeyboardViewAttr.getInt(
|
mLingerTimeout = mainKeyboardViewAttr.getInt(
|
||||||
R.styleable.MainKeyboardView_keyPreviewLingerTimeout, 0);
|
R.styleable.MainKeyboardView_keyPreviewLingerTimeout, 0);
|
||||||
|
mShowUpAnimatorResId = mainKeyboardViewAttr.getResourceId(
|
||||||
|
R.styleable.MainKeyboardView_keyPreviewShowUpAnimator, 0);
|
||||||
|
mDismissAnimatorResId = mainKeyboardViewAttr.getResourceId(
|
||||||
|
R.styleable.MainKeyboardView_keyPreviewDismissAnimator, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setVisibleOffset(final int previewVisibleOffset) {
|
public void setVisibleOffset(final int previewVisibleOffset) {
|
||||||
|
@ -112,27 +127,62 @@ public final class KeyPreviewDrawParams {
|
||||||
return mLingerTimeout;
|
return mLingerTimeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAnimationParams(final float showUpStartScale, final int showUpDuration,
|
public void setAnimationParams(final boolean hasCustomAnimationParams,
|
||||||
final float dismissEndScale, final int dismissDuration) {
|
final float showUpStartXScale, final float showUpStartYScale, final int showUpDuration,
|
||||||
mShowUpStartScale = showUpStartScale;
|
final float dismissEndXScale, final float dismissEndYScale, final int dismissDuration) {
|
||||||
|
mHasCustomAnimationParams = hasCustomAnimationParams;
|
||||||
|
mShowUpStartXScale = showUpStartXScale;
|
||||||
|
mShowUpStartYScale = showUpStartYScale;
|
||||||
mShowUpDuration = showUpDuration;
|
mShowUpDuration = showUpDuration;
|
||||||
mDismissEndScale = dismissEndScale;
|
mDismissEndXScale = dismissEndXScale;
|
||||||
|
mDismissEndYScale = dismissEndYScale;
|
||||||
mDismissDuration = dismissDuration;
|
mDismissDuration = dismissDuration;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getShowUpStartScale() {
|
private static final float KEY_PREVIEW_SHOW_UP_END_SCALE = 1.0f;
|
||||||
return mShowUpStartScale;
|
private static final AccelerateInterpolator ACCELERATE_INTERPOLATOR =
|
||||||
|
new AccelerateInterpolator();
|
||||||
|
private static final DecelerateInterpolator DECELERATE_INTERPOLATOR =
|
||||||
|
new DecelerateInterpolator();
|
||||||
|
|
||||||
|
public Animator createShowUpAnimator(final View target) {
|
||||||
|
if (mHasCustomAnimationParams) {
|
||||||
|
final ObjectAnimator scaleXAnimator = ObjectAnimator.ofFloat(
|
||||||
|
target, View.SCALE_X, mShowUpStartXScale,
|
||||||
|
KEY_PREVIEW_SHOW_UP_END_SCALE);
|
||||||
|
final ObjectAnimator scaleYAnimator = ObjectAnimator.ofFloat(
|
||||||
|
target, View.SCALE_Y, mShowUpStartYScale,
|
||||||
|
KEY_PREVIEW_SHOW_UP_END_SCALE);
|
||||||
|
final AnimatorSet showUpAnimator = new AnimatorSet();
|
||||||
|
showUpAnimator.play(scaleXAnimator).with(scaleYAnimator);
|
||||||
|
showUpAnimator.setDuration(mShowUpDuration);
|
||||||
|
showUpAnimator.setInterpolator(DECELERATE_INTERPOLATOR);
|
||||||
|
return showUpAnimator;
|
||||||
|
}
|
||||||
|
final Animator animator = AnimatorInflater.loadAnimator(
|
||||||
|
target.getContext(), mShowUpAnimatorResId);
|
||||||
|
animator.setTarget(target);
|
||||||
|
animator.setInterpolator(DECELERATE_INTERPOLATOR);
|
||||||
|
return animator;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getShowUpDuration() {
|
public Animator createDismissAnimator(final View target) {
|
||||||
return mShowUpDuration;
|
if (mHasCustomAnimationParams) {
|
||||||
}
|
final ObjectAnimator scaleXAnimator = ObjectAnimator.ofFloat(
|
||||||
|
target, View.SCALE_X, mDismissEndXScale);
|
||||||
public float getDismissEndScale() {
|
final ObjectAnimator scaleYAnimator = ObjectAnimator.ofFloat(
|
||||||
return mDismissEndScale;
|
target, View.SCALE_Y, mDismissEndYScale);
|
||||||
}
|
final AnimatorSet dismissAnimator = new AnimatorSet();
|
||||||
|
dismissAnimator.play(scaleXAnimator).with(scaleYAnimator);
|
||||||
public int getDismissDuration() {
|
final int dismissDuration = Math.min(mDismissDuration, mLingerTimeout);
|
||||||
return mDismissDuration;
|
dismissAnimator.setDuration(dismissDuration);
|
||||||
|
dismissAnimator.setInterpolator(ACCELERATE_INTERPOLATOR);
|
||||||
|
return dismissAnimator;
|
||||||
|
}
|
||||||
|
final Animator animator = AnimatorInflater.loadAnimator(
|
||||||
|
target.getContext(), mDismissAnimatorResId);
|
||||||
|
animator.setTarget(target);
|
||||||
|
animator.setInterpolator(ACCELERATE_INTERPOLATOR);
|
||||||
|
return animator;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,10 +23,16 @@ public final class DebugSettings {
|
||||||
"force_physical_keyboard_special_key";
|
"force_physical_keyboard_special_key";
|
||||||
public static final String PREF_SHOW_UI_TO_ACCEPT_TYPED_WORD =
|
public static final String PREF_SHOW_UI_TO_ACCEPT_TYPED_WORD =
|
||||||
"pref_show_ui_to_accept_typed_word";
|
"pref_show_ui_to_accept_typed_word";
|
||||||
public static final String PREF_KEY_PREVIEW_SHOW_UP_START_SCALE =
|
public static final String PREF_HAS_CUSTOM_KEY_PREVIEW_ANIMATION_PARAMS =
|
||||||
"pref_key_preview_show_up_start_scale";
|
"pref_has_custom_key_preview_animation_params";
|
||||||
public static final String PREF_KEY_PREVIEW_DISMISS_END_SCALE =
|
public static final String PREF_KEY_PREVIEW_SHOW_UP_START_X_SCALE =
|
||||||
"pref_key_preview_dismiss_end_scale";
|
"pref_key_preview_show_up_start_x_scale";
|
||||||
|
public static final String PREF_KEY_PREVIEW_SHOW_UP_START_Y_SCALE =
|
||||||
|
"pref_key_preview_show_up_start_y_scale";
|
||||||
|
public static final String PREF_KEY_PREVIEW_DISMISS_END_X_SCALE =
|
||||||
|
"pref_key_preview_dismiss_end_x_scale";
|
||||||
|
public static final String PREF_KEY_PREVIEW_DISMISS_END_Y_SCALE =
|
||||||
|
"pref_key_preview_dismiss_end_y_scale";
|
||||||
public static final String PREF_KEY_PREVIEW_SHOW_UP_DURATION =
|
public static final String PREF_KEY_PREVIEW_SHOW_UP_DURATION =
|
||||||
"pref_key_preview_show_up_duration";
|
"pref_key_preview_show_up_duration";
|
||||||
public static final String PREF_KEY_PREVIEW_DISMISS_DURATION =
|
public static final String PREF_KEY_PREVIEW_DISMISS_DURATION =
|
||||||
|
|
|
@ -78,12 +78,18 @@ public final class DebugSettingsFragment extends SubScreenFragment
|
||||||
res.getInteger(R.integer.config_key_preview_show_up_duration));
|
res.getInteger(R.integer.config_key_preview_show_up_duration));
|
||||||
setupKeyPreviewAnimationDuration(DebugSettings.PREF_KEY_PREVIEW_DISMISS_DURATION,
|
setupKeyPreviewAnimationDuration(DebugSettings.PREF_KEY_PREVIEW_DISMISS_DURATION,
|
||||||
res.getInteger(R.integer.config_key_preview_dismiss_duration));
|
res.getInteger(R.integer.config_key_preview_dismiss_duration));
|
||||||
setupKeyPreviewAnimationScale(DebugSettings.PREF_KEY_PREVIEW_SHOW_UP_START_SCALE,
|
final float defaultKeyPreviewShowUpStartScale = ResourceUtils.getFloatFromFraction(
|
||||||
ResourceUtils.getFloatFromFraction(
|
res, R.fraction.config_key_preview_show_up_start_scale);
|
||||||
res, R.fraction.config_key_preview_show_up_start_scale));
|
final float defaultKeyPreviewDismissEndScale = ResourceUtils.getFloatFromFraction(
|
||||||
setupKeyPreviewAnimationScale(DebugSettings.PREF_KEY_PREVIEW_DISMISS_END_SCALE,
|
res, R.fraction.config_key_preview_dismiss_end_scale);
|
||||||
ResourceUtils.getFloatFromFraction(
|
setupKeyPreviewAnimationScale(DebugSettings.PREF_KEY_PREVIEW_SHOW_UP_START_X_SCALE,
|
||||||
res, R.fraction.config_key_preview_dismiss_end_scale));
|
defaultKeyPreviewShowUpStartScale);
|
||||||
|
setupKeyPreviewAnimationScale(DebugSettings.PREF_KEY_PREVIEW_SHOW_UP_START_Y_SCALE,
|
||||||
|
defaultKeyPreviewShowUpStartScale);
|
||||||
|
setupKeyPreviewAnimationScale(DebugSettings.PREF_KEY_PREVIEW_DISMISS_END_X_SCALE,
|
||||||
|
defaultKeyPreviewDismissEndScale);
|
||||||
|
setupKeyPreviewAnimationScale(DebugSettings.PREF_KEY_PREVIEW_DISMISS_END_Y_SCALE,
|
||||||
|
defaultKeyPreviewDismissEndScale);
|
||||||
|
|
||||||
mServiceNeedsRestart = false;
|
mServiceNeedsRestart = false;
|
||||||
mDebugMode = (TwoStatePreference) findPreference(DebugSettings.PREF_DEBUG_MODE);
|
mDebugMode = (TwoStatePreference) findPreference(DebugSettings.PREF_DEBUG_MODE);
|
||||||
|
|
|
@ -103,10 +103,13 @@ public final class SettingsValues {
|
||||||
|
|
||||||
// Debug settings
|
// Debug settings
|
||||||
public final boolean mIsInternal;
|
public final boolean mIsInternal;
|
||||||
|
public final boolean mHasCustomKeyPreviewAnimationParams;
|
||||||
public final int mKeyPreviewShowUpDuration;
|
public final int mKeyPreviewShowUpDuration;
|
||||||
public final int mKeyPreviewDismissDuration;
|
public final int mKeyPreviewDismissDuration;
|
||||||
public final float mKeyPreviewShowUpStartScale;
|
public final float mKeyPreviewShowUpStartXScale;
|
||||||
public final float mKeyPreviewDismissEndScale;
|
public final float mKeyPreviewShowUpStartYScale;
|
||||||
|
public final float mKeyPreviewDismissEndXScale;
|
||||||
|
public final float mKeyPreviewDismissEndYScale;
|
||||||
|
|
||||||
public SettingsValues(final Context context, final SharedPreferences prefs, final Resources res,
|
public SettingsValues(final Context context, final SharedPreferences prefs, final Resources res,
|
||||||
final InputAttributes inputAttributes) {
|
final InputAttributes inputAttributes) {
|
||||||
|
@ -178,20 +181,30 @@ public final class SettingsValues {
|
||||||
mTextHighlightColorForAddToDictionaryIndicator = res.getColor(
|
mTextHighlightColorForAddToDictionaryIndicator = res.getColor(
|
||||||
R.color.text_decorator_add_to_dictionary_indicator_text_highlight_color);
|
R.color.text_decorator_add_to_dictionary_indicator_text_highlight_color);
|
||||||
mIsInternal = Settings.isInternal(prefs);
|
mIsInternal = Settings.isInternal(prefs);
|
||||||
|
mHasCustomKeyPreviewAnimationParams = prefs.getBoolean(
|
||||||
|
DebugSettings.PREF_HAS_CUSTOM_KEY_PREVIEW_ANIMATION_PARAMS, false);
|
||||||
mKeyPreviewShowUpDuration = Settings.readKeyPreviewAnimationDuration(
|
mKeyPreviewShowUpDuration = Settings.readKeyPreviewAnimationDuration(
|
||||||
prefs, DebugSettings.PREF_KEY_PREVIEW_SHOW_UP_DURATION,
|
prefs, DebugSettings.PREF_KEY_PREVIEW_SHOW_UP_DURATION,
|
||||||
res.getInteger(R.integer.config_key_preview_show_up_duration));
|
res.getInteger(R.integer.config_key_preview_show_up_duration));
|
||||||
mKeyPreviewDismissDuration = Settings.readKeyPreviewAnimationDuration(
|
mKeyPreviewDismissDuration = Settings.readKeyPreviewAnimationDuration(
|
||||||
prefs, DebugSettings.PREF_KEY_PREVIEW_DISMISS_DURATION,
|
prefs, DebugSettings.PREF_KEY_PREVIEW_DISMISS_DURATION,
|
||||||
res.getInteger(R.integer.config_key_preview_dismiss_duration));
|
res.getInteger(R.integer.config_key_preview_dismiss_duration));
|
||||||
mKeyPreviewShowUpStartScale = Settings.readKeyPreviewAnimationScale(
|
final float defaultKeyPreviewShowUpStartScale = ResourceUtils.getFloatFromFraction(
|
||||||
prefs, DebugSettings.PREF_KEY_PREVIEW_SHOW_UP_START_SCALE,
|
res, R.fraction.config_key_preview_show_up_start_scale);
|
||||||
ResourceUtils.getFloatFromFraction(
|
final float defaultKeyPreviewDismissEndScale = ResourceUtils.getFloatFromFraction(
|
||||||
res, R.fraction.config_key_preview_show_up_start_scale));
|
res, R.fraction.config_key_preview_dismiss_end_scale);
|
||||||
mKeyPreviewDismissEndScale = Settings.readKeyPreviewAnimationScale(
|
mKeyPreviewShowUpStartXScale = Settings.readKeyPreviewAnimationScale(
|
||||||
prefs, DebugSettings.PREF_KEY_PREVIEW_DISMISS_END_SCALE,
|
prefs, DebugSettings.PREF_KEY_PREVIEW_SHOW_UP_START_X_SCALE,
|
||||||
ResourceUtils.getFloatFromFraction(
|
defaultKeyPreviewShowUpStartScale);
|
||||||
res, R.fraction.config_key_preview_dismiss_end_scale));
|
mKeyPreviewShowUpStartYScale = Settings.readKeyPreviewAnimationScale(
|
||||||
|
prefs, DebugSettings.PREF_KEY_PREVIEW_SHOW_UP_START_Y_SCALE,
|
||||||
|
defaultKeyPreviewShowUpStartScale);
|
||||||
|
mKeyPreviewDismissEndXScale = Settings.readKeyPreviewAnimationScale(
|
||||||
|
prefs, DebugSettings.PREF_KEY_PREVIEW_DISMISS_END_X_SCALE,
|
||||||
|
defaultKeyPreviewDismissEndScale);
|
||||||
|
mKeyPreviewDismissEndYScale = Settings.readKeyPreviewAnimationScale(
|
||||||
|
prefs, DebugSettings.PREF_KEY_PREVIEW_DISMISS_END_Y_SCALE,
|
||||||
|
defaultKeyPreviewDismissEndScale);
|
||||||
mDisplayOrientation = res.getConfiguration().orientation;
|
mDisplayOrientation = res.getConfiguration().orientation;
|
||||||
mAppWorkarounds = new AsyncResultHolder<>();
|
mAppWorkarounds = new AsyncResultHolder<>();
|
||||||
final PackageInfo packageInfo = TargetPackageInfoGetterTask.getCachedPackageInfo(
|
final PackageInfo packageInfo = TargetPackageInfoGetterTask.getCachedPackageInfo(
|
||||||
|
@ -424,10 +437,14 @@ public final class SettingsValues {
|
||||||
sb.append("" + mKeyPreviewShowUpDuration);
|
sb.append("" + mKeyPreviewShowUpDuration);
|
||||||
sb.append("\n mKeyPreviewDismissDuration = ");
|
sb.append("\n mKeyPreviewDismissDuration = ");
|
||||||
sb.append("" + mKeyPreviewDismissDuration);
|
sb.append("" + mKeyPreviewDismissDuration);
|
||||||
sb.append("\n mKeyPreviewShowUpStartScale = ");
|
sb.append("\n mKeyPreviewShowUpStartScaleX = ");
|
||||||
sb.append("" + mKeyPreviewShowUpStartScale);
|
sb.append("" + mKeyPreviewShowUpStartXScale);
|
||||||
sb.append("\n mKeyPreviewDismissEndScale = ");
|
sb.append("\n mKeyPreviewShowUpStartScaleY = ");
|
||||||
sb.append("" + mKeyPreviewDismissEndScale);
|
sb.append("" + mKeyPreviewShowUpStartYScale);
|
||||||
|
sb.append("\n mKeyPreviewDismissEndScaleX = ");
|
||||||
|
sb.append("" + mKeyPreviewDismissEndXScale);
|
||||||
|
sb.append("\n mKeyPreviewDismissEndScaleY = ");
|
||||||
|
sb.append("" + mKeyPreviewDismissEndYScale);
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue