Merge "Use separate View for key preview backing"

main
Tadashi G. Takaoka 2011-09-02 12:59:31 -07:00 committed by Android (Google) Code Review
commit 787bac0603
6 changed files with 18 additions and 9 deletions

View File

@ -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"

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -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) {