diff --git a/java/res/layout/input_view.xml b/java/res/layout/input_view.xml index 88b48fccd117d512dbed8e43fc5b7ebce8003952..13560e0cfaa5f7b58538c630d276a997d40a8820 100644 --- a/java/res/layout/input_view.xml +++ b/java/res/layout/input_view.xml @@ -25,6 +25,11 @@ android:layout_width="match_parent" android:layout_height="wrap_content" > + <View + android:id="@+id/key_preview_backing" + android:layout_width="match_parent" + android:layout_height="@dimen/key_preview_backing_height" /> + <!-- On tablets, the suggestions strip is centered with horizontal paddings on both sides because width of the landscape mode is too long for the suggestions strip. This LinearLayout is required to hold the paddings. --> @@ -33,8 +38,6 @@ android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="wrap_content" - android:minHeight="@dimen/suggestions_view_minimum_height" - android:gravity="bottom" > <View android:layout_width="@dimen/suggestions_strip_padding" diff --git a/java/res/values-land/dimens.xml b/java/res/values-land/dimens.xml index 9149b5d2a88e12347f91f3840d6aa88ad72221b3..9de201ebe7aab804a1bfd5efc207a3a93141e985 100644 --- a/java/res/values-land/dimens.xml +++ b/java/res/values-land/dimens.xml @@ -60,7 +60,7 @@ <dimen name="suggestions_strip_height">36dip</dimen> <dimen name="more_suggestions_row_height">36dip</dimen> - <dimen name="suggestions_view_minimum_height">160sp</dimen> + <dimen name="key_preview_backing_height">36dip</dimen> <!-- Amount of allowance for selecting keys in a mini popup keyboard by sliding finger. --> <!-- popup_key_height x 1.2 --> <dimen name="mini_keyboard_slide_allowance">0.336in</dimen> diff --git a/java/res/values-sw600dp/dimens.xml b/java/res/values-sw600dp/dimens.xml index 6955736b36e1532d37d7c6c4a72ac9b3ef07ce7c..3b87fd66b54bf94b7954d85084136fb5672911cd 100644 --- a/java/res/values-sw600dp/dimens.xml +++ b/java/res/values-sw600dp/dimens.xml @@ -68,6 +68,7 @@ <dimen name="suggestions_strip_height">44dip</dimen> <dimen name="more_suggestions_row_height">44dip</dimen> + <dimen name="key_preview_backing_height">44dip</dimen> <dimen name="suggestions_strip_padding">15.0mm</dimen> <dimen name="suggestion_min_width">0.3in</dimen> <dimen name="suggestion_padding">12dip</dimen> diff --git a/java/res/values-sw768dp/dimens.xml b/java/res/values-sw768dp/dimens.xml index 7d2ac4860dee9f2e39259e5e1b21a19f30332c4f..7f799092a40a4175b3f24fc35c3109d30878ece7 100644 --- a/java/res/values-sw768dp/dimens.xml +++ b/java/res/values-sw768dp/dimens.xml @@ -71,7 +71,7 @@ <dimen name="suggestions_strip_height">44dip</dimen> <dimen name="more_suggestions_row_height">44dip</dimen> - <dimen name="suggestions_view_minimum_height">200sp</dimen> + <dimen name="key_preview_backing_height">44dip</dimen> <dimen name="suggestions_strip_padding">15.0mm</dimen> <dimen name="suggestion_min_width">46dip</dimen> <dimen name="suggestion_padding">8dip</dimen> diff --git a/java/res/values/dimens.xml b/java/res/values/dimens.xml index a506ed74db3a2ae456ac0247767a7686c6818f04..c5c298df5fec933b2cca0315d47d9edc85352145 100644 --- a/java/res/values/dimens.xml +++ b/java/res/values/dimens.xml @@ -81,7 +81,7 @@ <dimen name="more_suggestions_row_height">40dip</dimen> <dimen name="more_suggestions_slide_allowance">0.2in</dimen> <fraction name="more_suggestions_info_ratio">12%</fraction> - <dimen name="suggestions_view_minimum_height">200sp</dimen> + <dimen name="key_preview_backing_height">40dip</dimen> <dimen name="suggestions_strip_padding">0dip</dimen> <dimen name="suggestion_min_width">44dip</dimen> <dimen name="suggestion_padding">6dip</dimen> diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index cea59fe0adf4beac7dd04d16451e7c83d9062ac3..191ae5811285f39b4ff7461264246a700d2c2b94 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -157,6 +157,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar private Settings.Values mSettingsValues; + private View mKeyPreviewBackingView; private View mSuggestionsContainer; private int mSuggestionsStripHeight; private SuggestionsView mSuggestionsView; @@ -607,6 +608,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar @Override public void setInputView(View view) { super.setInputView(view); + mKeyPreviewBackingView = view.findViewById(R.id.key_preview_backing); mSuggestionsContainer = view.findViewById(R.id.suggestions_container); mSuggestionsView = (SuggestionsView) view.findViewById(R.id.suggestions_view); if (mSuggestionsView != null) @@ -945,12 +947,13 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar && (needsInputViewShown ? mKeyboardSwitcher.isInputViewShown() : true); if (isFullscreenMode()) { // No need to have extra space to show the key preview. - mSuggestionsContainer.setMinimumHeight(0); + mKeyPreviewBackingView.setVisibility(View.GONE); mSuggestionsContainer.setVisibility( shouldShowSuggestions ? View.VISIBLE : View.GONE); } else { // We must control the visibility of the suggestion strip in order to avoid clipped // key previews, even when we don't show the suggestion strip. + mKeyPreviewBackingView.setVisibility(View.VISIBLE); mSuggestionsContainer.setVisibility( shouldShowSuggestions ? View.VISIBLE : View.INVISIBLE); } @@ -967,15 +970,17 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar final KeyboardView inputView = mKeyboardSwitcher.getKeyboardView(); if (inputView == null || mSuggestionsContainer == null) return; - final int containerHeight = mSuggestionsContainer.getHeight(); - int touchY = containerHeight; + final int backingHeight = (mKeyPreviewBackingView.getVisibility() == View.GONE) ? 0 + : mKeyPreviewBackingView.getHeight(); + final int extraHeight = mSuggestionsContainer.getHeight() + backingHeight; + int touchY = extraHeight; // Need to set touchable region only if input view is being shown if (mKeyboardSwitcher.isInputViewShown()) { if (mSuggestionsContainer.getVisibility() == View.VISIBLE) { touchY -= mSuggestionsStripHeight; } final int touchWidth = inputView.getWidth(); - final int touchHeight = inputView.getHeight() + containerHeight + final int touchHeight = inputView.getHeight() + extraHeight // Extend touchable region below the keyboard. + EXTENDED_TOUCHABLE_REGION_HEIGHT; if (DEBUG) {