Merge "Remove unnecessary suggestion strip container"
commit
daab5cafd2
|
@ -30,34 +30,17 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp" />
|
||||
|
||||
<!-- 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. -->
|
||||
<LinearLayout
|
||||
android:id="@+id/suggestions_container"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
>
|
||||
<View
|
||||
android:layout_width="@dimen/suggestions_strip_padding"
|
||||
android:layout_height="@dimen/suggestions_strip_height"
|
||||
style="?attr/suggestionsStripBackgroundStyle" />
|
||||
<!-- To ensure that key preview popup is correctly placed when the current system locale is
|
||||
one of RTL locales, layoutDirection="ltr" is needed in the SDK version 17+. -->
|
||||
<com.android.inputmethod.latin.suggestions.SuggestionStripView
|
||||
android:id="@+id/suggestion_strip_view"
|
||||
android:layoutDirection="ltr"
|
||||
android:layout_weight="1.0"
|
||||
android:layout_width="0dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/suggestions_strip_height"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingRight="@dimen/suggestions_strip_padding"
|
||||
android:paddingLeft="@dimen/suggestions_strip_padding"
|
||||
style="?attr/suggestionStripViewStyle" />
|
||||
<View
|
||||
android:layout_width="@dimen/suggestions_strip_padding"
|
||||
android:layout_height="@dimen/suggestions_strip_height"
|
||||
style="?attr/suggestionsStripBackgroundStyle" />
|
||||
</LinearLayout>
|
||||
|
||||
<!-- To ensure that key preview popup is correctly placed when the current system locale is
|
||||
one of RTL locales, layoutDirection="ltr" is needed in the SDK version 17+. -->
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
<attr name="moreKeysKeyboardViewStyle" format="reference" />
|
||||
<attr name="moreKeysKeyboardPanelStyle" format="reference" />
|
||||
<!-- Suggestions strip style -->
|
||||
<attr name="suggestionsStripBackgroundStyle" format="reference" />
|
||||
<attr name="suggestionStripViewStyle" format="reference" />
|
||||
<attr name="moreSuggestionsViewStyle" format="reference" />
|
||||
<attr name="suggestionBackgroundStyle" format="reference" />
|
||||
|
|
|
@ -145,13 +145,10 @@
|
|||
<style name="MoreKeysKeyboardPanelStyle">
|
||||
<item name="android:background">@drawable/keyboard_popup_panel_background</item>
|
||||
</style>
|
||||
<style name="SuggestionsStripBackgroundStyle">
|
||||
<item name="android:background">@drawable/keyboard_suggest_strip</item>
|
||||
</style>
|
||||
<style
|
||||
name="SuggestionStripViewStyle"
|
||||
parent="SuggestionsStripBackgroundStyle"
|
||||
>
|
||||
<item name="android:background">@drawable/keyboard_suggest_strip</item>
|
||||
<item name="suggestionStripOption">autoCorrectBold|validTypedWordBold</item>
|
||||
<item name="colorValidTypedWord">@color/highlight_color_default</item>
|
||||
<item name="colorTypedWord">@color/typed_word_color_default</item>
|
||||
|
@ -380,13 +377,10 @@
|
|||
<style name="MoreKeysKeyboardPanelStyle.IceCreamSandwich">
|
||||
<item name="android:background">@drawable/keyboard_popup_panel_background_holo</item>
|
||||
</style>
|
||||
<style name="SuggestionsStripBackgroundStyle.IceCreamSandwich">
|
||||
<item name="android:background">@drawable/keyboard_suggest_strip_holo</item>
|
||||
</style>
|
||||
<style
|
||||
name="SuggestionStripViewStyle.IceCreamSandwich"
|
||||
parent="SuggestionsStripBackgroundStyle.IceCreamSandwich"
|
||||
>
|
||||
<item name="android:background">@drawable/keyboard_suggest_strip_holo</item>
|
||||
<item name="suggestionStripOption">autoCorrectBold|validTypedWordBold</item>
|
||||
<item name="colorValidTypedWord">@color/highlight_color_ics</item>
|
||||
<item name="colorTypedWord">@color/highlight_color_ics</item>
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
<item name="moreKeysKeyboardStyle">@style/MoreKeysKeyboard</item>
|
||||
<item name="moreKeysKeyboardViewStyle">@style/MoreKeysKeyboardView</item>
|
||||
<item name="moreKeysKeyboardPanelStyle">@style/MoreKeysKeyboardPanelStyle</item>
|
||||
<item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item>
|
||||
<item name="suggestionStripViewStyle">@style/SuggestionStripViewStyle</item>
|
||||
<item name="moreSuggestionsViewStyle">@style/MoreSuggestionsViewStyle</item>
|
||||
<item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle</item>
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
<item name="moreKeysKeyboardStyle">@style/MoreKeysKeyboard</item>
|
||||
<item name="moreKeysKeyboardViewStyle">@style/MoreKeysKeyboardView</item>
|
||||
<item name="moreKeysKeyboardPanelStyle">@style/MoreKeysKeyboardPanelStyle</item>
|
||||
<item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item>
|
||||
<item name="suggestionStripViewStyle">@style/SuggestionStripViewStyle</item>
|
||||
<item name="moreSuggestionsViewStyle">@style/MoreSuggestionsViewStyle</item>
|
||||
<item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle</item>
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
<item name="moreKeysKeyboardStyle">@style/MoreKeysKeyboard.Gingerbread</item>
|
||||
<item name="moreKeysKeyboardViewStyle">@style/MoreKeysKeyboardView.Gingerbread</item>
|
||||
<item name="moreKeysKeyboardPanelStyle">@style/MoreKeysKeyboardPanelStyle</item>
|
||||
<item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item>
|
||||
<item name="suggestionStripViewStyle">@style/SuggestionStripViewStyle</item>
|
||||
<item name="moreSuggestionsViewStyle">@style/MoreSuggestionsViewStyle</item>
|
||||
<item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle</item>
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
<item name="moreKeysKeyboardStyle">@style/MoreKeysKeyboard.IceCreamSandwich</item>
|
||||
<item name="moreKeysKeyboardViewStyle">@style/MoreKeysKeyboardView.IceCreamSandwich</item>
|
||||
<item name="moreKeysKeyboardPanelStyle">@style/MoreKeysKeyboardPanelStyle.IceCreamSandwich</item>
|
||||
<item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle.IceCreamSandwich</item>
|
||||
<item name="suggestionStripViewStyle">@style/SuggestionStripViewStyle.IceCreamSandwich</item>
|
||||
<item name="moreSuggestionsViewStyle">@style/MoreSuggestionsViewStyle.IceCreamSandwich</item>
|
||||
<item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle.IceCreamSandwich</item>
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
<item name="moreKeysKeyboardStyle">@style/MoreKeysKeyboard.Stone</item>
|
||||
<item name="moreKeysKeyboardViewStyle">@style/MoreKeysKeyboardView.Stone</item>
|
||||
<item name="moreKeysKeyboardPanelStyle">@style/MoreKeysKeyboardPanelStyle</item>
|
||||
<item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item>
|
||||
<item name="suggestionStripViewStyle">@style/SuggestionStripViewStyle</item>
|
||||
<item name="moreSuggestionsViewStyle">@style/MoreSuggestionsViewStyle</item>
|
||||
<item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle</item>
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
<item name="moreKeysKeyboardStyle">@style/MoreKeysKeyboard.Stone</item>
|
||||
<item name="moreKeysKeyboardViewStyle">@style/MoreKeysKeyboardView.Stone</item>
|
||||
<item name="moreKeysKeyboardPanelStyle">@style/MoreKeysKeyboardPanelStyle</item>
|
||||
<item name="suggestionsStripBackgroundStyle">@style/SuggestionsStripBackgroundStyle</item>
|
||||
<item name="suggestionStripViewStyle">@style/SuggestionStripViewStyle</item>
|
||||
<item name="moreSuggestionsViewStyle">@style/MoreSuggestionsViewStyle</item>
|
||||
<item name="suggestionBackgroundStyle">@style/SuggestionBackgroundStyle</item>
|
||||
|
|
|
@ -24,7 +24,7 @@ import android.view.View;
|
|||
import android.widget.LinearLayout;
|
||||
|
||||
public final class InputView extends LinearLayout {
|
||||
private View mSuggestionStripContainer;
|
||||
private View mSuggestionStripView;
|
||||
private View mKeyboardView;
|
||||
private int mKeyboardTopPadding;
|
||||
|
||||
|
@ -43,13 +43,13 @@ public final class InputView extends LinearLayout {
|
|||
|
||||
@Override
|
||||
protected void onFinishInflate() {
|
||||
mSuggestionStripContainer = findViewById(R.id.suggestions_container);
|
||||
mSuggestionStripView = findViewById(R.id.suggestion_strip_view);
|
||||
mKeyboardView = findViewById(R.id.keyboard_view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean dispatchTouchEvent(MotionEvent me) {
|
||||
if (mSuggestionStripContainer.getVisibility() == VISIBLE
|
||||
if (mSuggestionStripView.getVisibility() == VISIBLE
|
||||
&& mKeyboardView.getVisibility() == VISIBLE
|
||||
&& forwardTouchEvent(me)) {
|
||||
return true;
|
||||
|
@ -97,7 +97,7 @@ public final class InputView extends LinearLayout {
|
|||
}
|
||||
|
||||
final Rect receivingRect = mEventReceivingRect;
|
||||
mSuggestionStripContainer.getGlobalVisibleRect(receivingRect);
|
||||
mSuggestionStripView.getGlobalVisibleRect(receivingRect);
|
||||
final int translatedX = x - receivingRect.left;
|
||||
final int translatedY;
|
||||
if (y < forwardingLimitY) {
|
||||
|
@ -107,7 +107,7 @@ public final class InputView extends LinearLayout {
|
|||
translatedY = y - receivingRect.top;
|
||||
}
|
||||
me.setLocation(translatedX, translatedY);
|
||||
mSuggestionStripContainer.dispatchTouchEvent(me);
|
||||
mSuggestionStripView.dispatchTouchEvent(me);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -152,7 +152,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
|||
|
||||
private View mExtractArea;
|
||||
private View mKeyPreviewBackingView;
|
||||
private View mSuggestionsContainer;
|
||||
private SuggestionStripView mSuggestionStripView;
|
||||
// Never null
|
||||
private SuggestedWords mSuggestedWords = SuggestedWords.EMPTY;
|
||||
|
@ -667,7 +666,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
|||
mExtractArea = getWindow().getWindow().getDecorView()
|
||||
.findViewById(android.R.id.extractArea);
|
||||
mKeyPreviewBackingView = view.findViewById(R.id.key_preview_backing);
|
||||
mSuggestionsContainer = view.findViewById(R.id.suggestions_container);
|
||||
mSuggestionStripView = (SuggestionStripView)view.findViewById(R.id.suggestion_strip_view);
|
||||
if (mSuggestionStripView != null)
|
||||
mSuggestionStripView.setListener(this, view);
|
||||
|
@ -1111,17 +1109,17 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
|||
private void setSuggestionStripShownInternal(final boolean shown,
|
||||
final boolean needsInputViewShown) {
|
||||
// TODO: Modify this if we support suggestions with hard keyboard
|
||||
if (onEvaluateInputViewShown() && mSuggestionsContainer != null) {
|
||||
if (onEvaluateInputViewShown() && mSuggestionStripView != null) {
|
||||
final MainKeyboardView mainKeyboardView = mKeyboardSwitcher.getMainKeyboardView();
|
||||
final boolean inputViewShown = (mainKeyboardView != null)
|
||||
? mainKeyboardView.isShown() : false;
|
||||
final boolean shouldShowSuggestions = shown
|
||||
&& (needsInputViewShown ? inputViewShown : true);
|
||||
if (isFullscreenMode()) {
|
||||
mSuggestionsContainer.setVisibility(
|
||||
mSuggestionStripView.setVisibility(
|
||||
shouldShowSuggestions ? View.VISIBLE : View.GONE);
|
||||
} else {
|
||||
mSuggestionsContainer.setVisibility(
|
||||
mSuggestionStripView.setVisibility(
|
||||
shouldShowSuggestions ? View.VISIBLE : View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
|
@ -1142,7 +1140,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
|||
return 0;
|
||||
}
|
||||
final int keyboardHeight = mainKeyboardView.getHeight();
|
||||
final int suggestionsHeight = mSuggestionsContainer.getHeight();
|
||||
final int suggestionsHeight = mSuggestionStripView.getHeight();
|
||||
final int displayHeight = getResources().getDisplayMetrics().heightPixels;
|
||||
final Rect rect = new Rect();
|
||||
mKeyPreviewBackingView.getWindowVisibleDisplayFrame(rect);
|
||||
|
@ -1160,7 +1158,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
|||
public void onComputeInsets(final InputMethodService.Insets outInsets) {
|
||||
super.onComputeInsets(outInsets);
|
||||
final MainKeyboardView mainKeyboardView = mKeyboardSwitcher.getMainKeyboardView();
|
||||
if (mainKeyboardView == null || mSuggestionsContainer == null) {
|
||||
if (mainKeyboardView == null || mSuggestionStripView == null) {
|
||||
return;
|
||||
}
|
||||
final int adjustedBackingHeight = getAdjustedBackingViewHeight();
|
||||
|
@ -1170,13 +1168,13 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
|||
// be considered.
|
||||
// See {@link android.inputmethodservice.InputMethodService#onComputeInsets}.
|
||||
final int extractHeight = isFullscreenMode() ? mExtractArea.getHeight() : 0;
|
||||
final int suggestionsHeight = (mSuggestionsContainer.getVisibility() == View.GONE) ? 0
|
||||
: mSuggestionsContainer.getHeight();
|
||||
final int suggestionsHeight = (mSuggestionStripView.getVisibility() == View.GONE) ? 0
|
||||
: mSuggestionStripView.getHeight();
|
||||
final int extraHeight = extractHeight + backingHeight + suggestionsHeight;
|
||||
int visibleTopY = extraHeight;
|
||||
// Need to set touchable region only if input view is being shown
|
||||
if (mainKeyboardView.isShown()) {
|
||||
if (mSuggestionsContainer.getVisibility() == View.VISIBLE) {
|
||||
if (mSuggestionStripView.getVisibility() == View.VISIBLE) {
|
||||
visibleTopY -= suggestionsHeight;
|
||||
}
|
||||
final int touchY = mainKeyboardView.isShowingMoreKeysPanel() ? 0 : visibleTopY;
|
||||
|
|
Loading…
Reference in New Issue