From f47976e7b4eacafdf7229bff6433b57825d241c3 Mon Sep 17 00:00:00 2001 From: Seigo Nonaka Date: Tue, 1 Mar 2016 09:17:37 -0800 Subject: [PATCH] Fix unexpected ellipsize for long suggestion text. Unexpected ellipsize issue happens after Ic8445022634e9130f9462e02bfb08d4877396ba3. By setting match_parent to ListView, the ListView does not expand to fit the suggestion item. Thus, explicitly setting the ListView width instead of setting match_parent or wrap_content. I manually verified this CL does not revive Issue 27341560 or unexpected ellipsize for shorter text. Bug: 27341560 Change-Id: I69b258687b4bf5510d9b2c3e690c88106bf893f5 --- core/java/android/widget/Editor.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/java/android/widget/Editor.java b/core/java/android/widget/Editor.java index 881e5cd627942..5c06638f6ad2b 100644 --- a/core/java/android/widget/Editor.java +++ b/core/java/android/widget/Editor.java @@ -3160,6 +3160,7 @@ public class Editor { mTextView.getContext(), mTextView.mTextEditSuggestionHighlightStyle); private TextView mAddToDictionaryButton; private TextView mDeleteButton; + private ListView mSuggestionListView; private SuggestionSpan mMisspelledSpan; private int mContainerMarginWidth; private int mContainerMarginTop; @@ -3213,12 +3214,12 @@ public class Editor { mClippingLimitLeft = lp.leftMargin; mClippingLimitRight = lp.rightMargin; - final ListView suggestionListView = (ListView) relativeLayout.findViewById( + mSuggestionListView = (ListView) relativeLayout.findViewById( com.android.internal.R.id.suggestionContainer); mSuggestionsAdapter = new SuggestionAdapter(); - suggestionListView.setAdapter(mSuggestionsAdapter); - suggestionListView.setOnItemClickListener(this); + mSuggestionListView.setAdapter(mSuggestionsAdapter); + mSuggestionListView.setOnItemClickListener(this); // Inflate the suggestion items once and for all. mSuggestionInfos = new SuggestionInfo[MAX_NUMBER_SUGGESTIONS]; @@ -3374,6 +3375,7 @@ public class Editor { popupBackground.getPadding(mTempRect); width += mTempRect.left + mTempRect.right; } + mSuggestionListView.getLayoutParams().width = width; mPopupWindow.setWidth(width); }