Use separate View for key preview backing
Bug: 5246982 Change-Id: Icec4281cb01771909fcece36647ee42ba179118cmain
parent
f2bd8a07bb
commit
abb0c77af1
|
@ -25,6 +25,11 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
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
|
<!-- 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
|
because width of the landscape mode is too long for the suggestions strip. This
|
||||||
LinearLayout is required to hold the paddings. -->
|
LinearLayout is required to hold the paddings. -->
|
||||||
|
@ -33,8 +38,6 @@
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:minHeight="@dimen/suggestions_view_minimum_height"
|
|
||||||
android:gravity="bottom"
|
|
||||||
>
|
>
|
||||||
<View
|
<View
|
||||||
android:layout_width="@dimen/suggestions_strip_padding"
|
android:layout_width="@dimen/suggestions_strip_padding"
|
||||||
|
|
|
@ -60,7 +60,7 @@
|
||||||
|
|
||||||
<dimen name="suggestions_strip_height">36dip</dimen>
|
<dimen name="suggestions_strip_height">36dip</dimen>
|
||||||
<dimen name="more_suggestions_row_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. -->
|
<!-- Amount of allowance for selecting keys in a mini popup keyboard by sliding finger. -->
|
||||||
<!-- popup_key_height x 1.2 -->
|
<!-- popup_key_height x 1.2 -->
|
||||||
<dimen name="mini_keyboard_slide_allowance">0.336in</dimen>
|
<dimen name="mini_keyboard_slide_allowance">0.336in</dimen>
|
||||||
|
|
|
@ -68,6 +68,7 @@
|
||||||
|
|
||||||
<dimen name="suggestions_strip_height">44dip</dimen>
|
<dimen name="suggestions_strip_height">44dip</dimen>
|
||||||
<dimen name="more_suggestions_row_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="suggestions_strip_padding">15.0mm</dimen>
|
||||||
<dimen name="suggestion_min_width">0.3in</dimen>
|
<dimen name="suggestion_min_width">0.3in</dimen>
|
||||||
<dimen name="suggestion_padding">12dip</dimen>
|
<dimen name="suggestion_padding">12dip</dimen>
|
||||||
|
|
|
@ -71,7 +71,7 @@
|
||||||
|
|
||||||
<dimen name="suggestions_strip_height">44dip</dimen>
|
<dimen name="suggestions_strip_height">44dip</dimen>
|
||||||
<dimen name="more_suggestions_row_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="suggestions_strip_padding">15.0mm</dimen>
|
||||||
<dimen name="suggestion_min_width">46dip</dimen>
|
<dimen name="suggestion_min_width">46dip</dimen>
|
||||||
<dimen name="suggestion_padding">8dip</dimen>
|
<dimen name="suggestion_padding">8dip</dimen>
|
||||||
|
|
|
@ -81,7 +81,7 @@
|
||||||
<dimen name="more_suggestions_row_height">40dip</dimen>
|
<dimen name="more_suggestions_row_height">40dip</dimen>
|
||||||
<dimen name="more_suggestions_slide_allowance">0.2in</dimen>
|
<dimen name="more_suggestions_slide_allowance">0.2in</dimen>
|
||||||
<fraction name="more_suggestions_info_ratio">12%</fraction>
|
<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="suggestions_strip_padding">0dip</dimen>
|
||||||
<dimen name="suggestion_min_width">44dip</dimen>
|
<dimen name="suggestion_min_width">44dip</dimen>
|
||||||
<dimen name="suggestion_padding">6dip</dimen>
|
<dimen name="suggestion_padding">6dip</dimen>
|
||||||
|
|
|
@ -157,6 +157,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
||||||
|
|
||||||
private Settings.Values mSettingsValues;
|
private Settings.Values mSettingsValues;
|
||||||
|
|
||||||
|
private View mKeyPreviewBackingView;
|
||||||
private View mSuggestionsContainer;
|
private View mSuggestionsContainer;
|
||||||
private int mSuggestionsStripHeight;
|
private int mSuggestionsStripHeight;
|
||||||
private SuggestionsView mSuggestionsView;
|
private SuggestionsView mSuggestionsView;
|
||||||
|
@ -607,6 +608,7 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
||||||
@Override
|
@Override
|
||||||
public void setInputView(View view) {
|
public void setInputView(View view) {
|
||||||
super.setInputView(view);
|
super.setInputView(view);
|
||||||
|
mKeyPreviewBackingView = view.findViewById(R.id.key_preview_backing);
|
||||||
mSuggestionsContainer = view.findViewById(R.id.suggestions_container);
|
mSuggestionsContainer = view.findViewById(R.id.suggestions_container);
|
||||||
mSuggestionsView = (SuggestionsView) view.findViewById(R.id.suggestions_view);
|
mSuggestionsView = (SuggestionsView) view.findViewById(R.id.suggestions_view);
|
||||||
if (mSuggestionsView != null)
|
if (mSuggestionsView != null)
|
||||||
|
@ -945,12 +947,13 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
||||||
&& (needsInputViewShown ? mKeyboardSwitcher.isInputViewShown() : true);
|
&& (needsInputViewShown ? mKeyboardSwitcher.isInputViewShown() : true);
|
||||||
if (isFullscreenMode()) {
|
if (isFullscreenMode()) {
|
||||||
// No need to have extra space to show the key preview.
|
// No need to have extra space to show the key preview.
|
||||||
mSuggestionsContainer.setMinimumHeight(0);
|
mKeyPreviewBackingView.setVisibility(View.GONE);
|
||||||
mSuggestionsContainer.setVisibility(
|
mSuggestionsContainer.setVisibility(
|
||||||
shouldShowSuggestions ? View.VISIBLE : View.GONE);
|
shouldShowSuggestions ? View.VISIBLE : View.GONE);
|
||||||
} else {
|
} else {
|
||||||
// We must control the visibility of the suggestion strip in order to avoid clipped
|
// 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.
|
// key previews, even when we don't show the suggestion strip.
|
||||||
|
mKeyPreviewBackingView.setVisibility(View.VISIBLE);
|
||||||
mSuggestionsContainer.setVisibility(
|
mSuggestionsContainer.setVisibility(
|
||||||
shouldShowSuggestions ? View.VISIBLE : View.INVISIBLE);
|
shouldShowSuggestions ? View.VISIBLE : View.INVISIBLE);
|
||||||
}
|
}
|
||||||
|
@ -967,15 +970,17 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
||||||
final KeyboardView inputView = mKeyboardSwitcher.getKeyboardView();
|
final KeyboardView inputView = mKeyboardSwitcher.getKeyboardView();
|
||||||
if (inputView == null || mSuggestionsContainer == null)
|
if (inputView == null || mSuggestionsContainer == null)
|
||||||
return;
|
return;
|
||||||
final int containerHeight = mSuggestionsContainer.getHeight();
|
final int backingHeight = (mKeyPreviewBackingView.getVisibility() == View.GONE) ? 0
|
||||||
int touchY = containerHeight;
|
: mKeyPreviewBackingView.getHeight();
|
||||||
|
final int extraHeight = mSuggestionsContainer.getHeight() + backingHeight;
|
||||||
|
int touchY = extraHeight;
|
||||||
// Need to set touchable region only if input view is being shown
|
// Need to set touchable region only if input view is being shown
|
||||||
if (mKeyboardSwitcher.isInputViewShown()) {
|
if (mKeyboardSwitcher.isInputViewShown()) {
|
||||||
if (mSuggestionsContainer.getVisibility() == View.VISIBLE) {
|
if (mSuggestionsContainer.getVisibility() == View.VISIBLE) {
|
||||||
touchY -= mSuggestionsStripHeight;
|
touchY -= mSuggestionsStripHeight;
|
||||||
}
|
}
|
||||||
final int touchWidth = inputView.getWidth();
|
final int touchWidth = inputView.getWidth();
|
||||||
final int touchHeight = inputView.getHeight() + containerHeight
|
final int touchHeight = inputView.getHeight() + extraHeight
|
||||||
// Extend touchable region below the keyboard.
|
// Extend touchable region below the keyboard.
|
||||||
+ EXTENDED_TOUCHABLE_REGION_HEIGHT;
|
+ EXTENDED_TOUCHABLE_REGION_HEIGHT;
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
|
|
Loading…
Reference in New Issue