Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5846)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/widget/textbubble/TextBubble.java

Issue 2845653002: Set LayoutParams on TextBubble content view (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/widget/textbubble/TextBubble.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/widget/textbubble/TextBubble.java b/chrome/android/java/src/org/chromium/chrome/browser/widget/textbubble/TextBubble.java
index 4fdbc1e70d5b631e45447f8aaf0c2ec9d7c2ce05..752e673d46b0dc56eff172374289be3f19be8226 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/widget/textbubble/TextBubble.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/widget/textbubble/TextBubble.java
@@ -16,6 +16,8 @@ import android.view.View;
import android.view.View.MeasureSpec;
import android.view.View.OnTouchListener;
import android.view.ViewGroup;
+import android.view.ViewGroup.LayoutParams;
+import android.widget.FrameLayout;
import android.widget.PopupWindow;
import android.widget.PopupWindow.OnDismissListener;
import android.widget.TextView;
@@ -302,9 +304,15 @@ public class TextBubble implements OnTouchListener {
private void createContentView() {
if (mPopupWindow.getContentView() != null) return;
+
View view = LayoutInflater.from(mContext).inflate(R.layout.textbubble_text, null);
((TextView) view).setText(mStringId);
mPopupWindow.setContentView(view);
+
+ // On some versions of Android, the LayoutParams aren't set until after the popup window
+ // is shown. Explicitly set the LayoutParams to avoid crashing. See crbug.com/713759.
+ view.setLayoutParams(
+ new FrameLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
}
// OnTouchListener implementation.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698