diff options
author | 2011-04-13 14:12:24 +0900 | |
---|---|---|
committer | 2011-04-13 18:59:33 +0900 | |
commit | 7a3d3ae17f7a8ca0b44e9c92328a7de7cbc80f92 (patch) | |
tree | 0975cb3d2df4eced4c836078291306761f136991 /java/res | |
parent | 47d2ef69d3f94e68bf675967ce3140cbb6179279 (diff) | |
download | latinime-7a3d3ae17f7a8ca0b44e9c92328a7de7cbc80f92.tar.gz latinime-7a3d3ae17f7a8ca0b44e9c92328a7de7cbc80f92.tar.xz latinime-7a3d3ae17f7a8ca0b44e9c92328a7de7cbc80f92.zip |
Fast key preview
Previously the key preview was implemented by PopupWindow. The key
preview popup window would be dismissed and shown each time the key
was released and pressed. It turned out that it was taking several
milliseconds.
This change implements the key preview by a simple TextView which will
be layout-ed at absolute coordinates within the screen FrameLayout.
And dismissing and showing the key preview is implemented by the
TextView's visibility.
This implementation needs careful coordination of candidates.xml
layout and LatinIME.onComputeInsets to control suggestion strip
visibility.
Bug: 4179964
Change-Id: Id6347cb35b91eb14ab20dd2f312e58b54b6625a7
Diffstat (limited to 'java/res')
-rw-r--r-- | java/res/anim/key_preview_fadein.xml | 29 | ||||
-rw-r--r-- | java/res/anim/key_preview_fadeout.xml | 29 | ||||
-rw-r--r-- | java/res/anim/mini_keyboard_fadein.xml | 2 | ||||
-rw-r--r-- | java/res/anim/mini_keyboard_fadeout.xml | 2 | ||||
-rw-r--r-- | java/res/layout-xlarge/candidates.xml | 40 | ||||
-rw-r--r-- | java/res/layout/candidates.xml | 13 | ||||
-rw-r--r-- | java/res/values-xlarge/dimens.xml | 3 | ||||
-rw-r--r-- | java/res/values/config.xml | 2 | ||||
-rw-r--r-- | java/res/values/dimens.xml | 3 | ||||
-rw-r--r-- | java/res/values/styles.xml | 4 |
10 files changed, 38 insertions, 89 deletions
diff --git a/java/res/anim/key_preview_fadein.xml b/java/res/anim/key_preview_fadein.xml deleted file mode 100644 index 9fad7b9a7..000000000 --- a/java/res/anim/key_preview_fadein.xml +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* -** -** Copyright 2010, 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" - android:interpolator="@android:anim/decelerate_interpolator" -> - <alpha - android:fromAlpha="0.5" - android:toAlpha="1.0" - android:duration="@integer/config_preview_fadein_anim_time" /> -</set> diff --git a/java/res/anim/key_preview_fadeout.xml b/java/res/anim/key_preview_fadeout.xml deleted file mode 100644 index 7de5123cd..000000000 --- a/java/res/anim/key_preview_fadeout.xml +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- -/* -** -** Copyright 2010, 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" - android:interpolator="@android:anim/accelerate_interpolator" -> - <alpha - android:fromAlpha="1.0" - android:toAlpha="0.0" - android:duration="@integer/config_preview_fadeout_anim_time" /> -</set> diff --git a/java/res/anim/mini_keyboard_fadein.xml b/java/res/anim/mini_keyboard_fadein.xml index 9fad7b9a7..f80e8b8de 100644 --- a/java/res/anim/mini_keyboard_fadein.xml +++ b/java/res/anim/mini_keyboard_fadein.xml @@ -25,5 +25,5 @@ <alpha android:fromAlpha="0.5" android:toAlpha="1.0" - android:duration="@integer/config_preview_fadein_anim_time" /> + android:duration="@integer/config_mini_keyboard_fadein_anim_time" /> </set> diff --git a/java/res/anim/mini_keyboard_fadeout.xml b/java/res/anim/mini_keyboard_fadeout.xml index 7de5123cd..535b100ae 100644 --- a/java/res/anim/mini_keyboard_fadeout.xml +++ b/java/res/anim/mini_keyboard_fadeout.xml @@ -25,5 +25,5 @@ <alpha android:fromAlpha="1.0" android:toAlpha="0.0" - android:duration="@integer/config_preview_fadeout_anim_time" /> + android:duration="@integer/config_mini_keyboard_fadeout_anim_time" /> </set> diff --git a/java/res/layout-xlarge/candidates.xml b/java/res/layout-xlarge/candidates.xml index d10035c9c..9d6cd241c 100644 --- a/java/res/layout-xlarge/candidates.xml +++ b/java/res/layout-xlarge/candidates.xml @@ -21,25 +21,33 @@ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" + android:gravity="bottom" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="@drawable/keyboard_suggest_strip_holo" - android:paddingRight="@dimen/candidate_strip_padding" - android:paddingLeft="@dimen/candidate_strip_padding" + android:minHeight="@dimen/candidate_strip_minimum_height" > - <HorizontalScrollView - android:id="@+id/candidates_scroll_view" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:fadingEdge="horizontal" - android:fadingEdgeLength="@dimen/candidate_strip_fading_edge_length" - android:scrollbars="none" + <!-- On tablets, the candidate strip is centered with horizontal paddings on both sides because + width of the landscape mode is too long for the candidate strip. This LinearLayout is + required to hold the paddings. --> + <LinearLayout + android:orientation="horizontal" + android:layout_width="match_parent" + android:layout_height="@dimen/candidate_strip_height" + android:background="@drawable/keyboard_suggest_strip_holo" + android:paddingRight="@dimen/candidate_strip_padding" + android:paddingLeft="@dimen/candidate_strip_padding" > - <com.android.inputmethod.latin.CandidateView - android:id="@+id/candidates" - android:orientation="horizontal" + <HorizontalScrollView android:layout_width="match_parent" - android:layout_height="@dimen/candidate_strip_height" - android:background="@drawable/keyboard_suggest_strip_holo" /> - </HorizontalScrollView> + android:layout_height="match_parent" + android:fadingEdge="horizontal" + android:fadingEdgeLength="@dimen/candidate_strip_fading_edge_length" + android:scrollbars="none" + > + <com.android.inputmethod.latin.CandidateView + android:id="@+id/candidates" + android:layout_width="match_parent" + android:layout_height="match_parent" /> + </HorizontalScrollView> + </LinearLayout> </LinearLayout> diff --git a/java/res/layout/candidates.xml b/java/res/layout/candidates.xml index 794c4ed42..39e39a1b7 100644 --- a/java/res/layout/candidates.xml +++ b/java/res/layout/candidates.xml @@ -21,25 +21,24 @@ <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" + android:gravity="bottom" android:layout_width="match_parent" android:layout_height="wrap_content" - android:background="@drawable/keyboard_suggest_strip" + android:minHeight="@dimen/candidate_strip_minimum_height" android:paddingRight="@dimen/candidate_strip_padding" android:paddingLeft="@dimen/candidate_strip_padding" > <HorizontalScrollView - android:id="@+id/candidates_scroll_view" - android:layout_width="wrap_content" - android:layout_height="wrap_content" + android:layout_width="match_parent" + android:layout_height="@dimen/candidate_strip_height" + android:background="@drawable/keyboard_suggest_strip" android:fadingEdge="horizontal" android:fadingEdgeLength="@dimen/candidate_strip_fading_edge_length" android:scrollbars="none" > <com.android.inputmethod.latin.CandidateView android:id="@+id/candidates" - android:orientation="horizontal" android:layout_width="match_parent" - android:layout_height="@dimen/candidate_strip_height" - android:background="@drawable/keyboard_suggest_strip" /> + android:layout_height="match_parent" /> </HorizontalScrollView> </LinearLayout> diff --git a/java/res/values-xlarge/dimens.xml b/java/res/values-xlarge/dimens.xml index 0dc5621ff..9bb50f62a 100644 --- a/java/res/values-xlarge/dimens.xml +++ b/java/res/values-xlarge/dimens.xml @@ -46,6 +46,9 @@ <dimen name="key_preview_offset_holo">8.0mm</dimen> <dimen name="candidate_strip_height">46dip</dimen> + <!-- candidate_strip_minimum_height = + key_preview_height_holo - key_preview_offset_holo + alpha --> + <dimen name="candidate_strip_minimum_height">18mm</dimen> <dimen name="candidate_strip_padding">15.0mm</dimen> <dimen name="candidate_min_width">0.3in</dimen> <dimen name="candidate_padding">12dip</dimen> diff --git a/java/res/values/config.xml b/java/res/values/config.xml index bdb4409f0..32fb5bf1a 100644 --- a/java/res/values/config.xml +++ b/java/res/values/config.xml @@ -49,8 +49,6 @@ <integer name="config_final_fadeout_percentage_of_language_on_spacebar">15</integer> <integer name="config_delay_before_preview">0</integer> <integer name="config_delay_after_preview">10</integer> - <integer name="config_preview_fadein_anim_time">0</integer> - <integer name="config_preview_fadeout_anim_time">70</integer> <integer name="config_mini_keyboard_fadein_anim_time">0</integer> <integer name="config_mini_keyboard_fadeout_anim_time">100</integer> <integer name="config_delay_before_key_repeat_start">400</integer> diff --git a/java/res/values/dimens.xml b/java/res/values/dimens.xml index 767dc4aa9..0a0b16d47 100644 --- a/java/res/values/dimens.xml +++ b/java/res/values/dimens.xml @@ -52,6 +52,9 @@ <dimen name="key_preview_offset_holo">0.193in</dimen> <dimen name="candidate_strip_height">42dip</dimen> + <!-- candidate_strip_minimum_height = + key_preview_height_holo - key_preview_offset_holo + alpha --> + <dimen name="candidate_strip_minimum_height">100sp</dimen> <dimen name="candidate_strip_fading_edge_length">63dip</dimen> <dimen name="candidate_strip_padding">0dip</dimen> <dimen name="candidate_min_width">0.3in</dimen> diff --git a/java/res/values/styles.xml b/java/res/values/styles.xml index 130714fd3..ef48a4bd2 100644 --- a/java/res/values/styles.xml +++ b/java/res/values/styles.xml @@ -35,10 +35,6 @@ <item name="backgroundDimAmount">0.5</item> <item name="colorScheme">white</item> </style> - <style name="KeyPreviewAnimation"> - <item name="android:windowEnterAnimation">@anim/key_preview_fadein</item> - <item name="android:windowExitAnimation">@anim/key_preview_fadeout</item> - </style> <style name="MiniKeyboardAnimation"> <item name="android:windowEnterAnimation">@anim/mini_keyboard_fadein</item> <item name="android:windowExitAnimation">@anim/mini_keyboard_fadeout</item> |