Index: ui/android/java/src/org/chromium/ui/DropdownPopupWindow.java |
diff --git a/ui/android/java/src/org/chromium/ui/DropdownPopupWindow.java b/ui/android/java/src/org/chromium/ui/DropdownPopupWindow.java |
index a1b8ee6c4e04d5c9eb163dc3a55d4f978cb5fe61..617e7b7cad936beafaf4d294402751b1ea7c6b08 100644 |
--- a/ui/android/java/src/org/chromium/ui/DropdownPopupWindow.java |
+++ b/ui/android/java/src/org/chromium/ui/DropdownPopupWindow.java |
@@ -149,22 +149,32 @@ public class DropdownPopupWindow extends ListPopupWindow { |
* Sets the text direction in the dropdown. Should be called before show(). |
* @param isRtl If true, then dropdown text direciton is right to left. |
*/ |
- protected void setRtl(boolean isRtl) { |
+ public void setRtl(boolean isRtl) { |
mRtl = isRtl; |
} |
/** |
+ * Returns the width of the anchor to which this popup is attached. |
+ * @return The width of the anchor. |
+ */ |
+ public float getAnchorWidth() { |
+ return mAnchorWidth; |
+ } |
+ |
+ /** |
* Measures the width of the list content. |
* @return The popup window width in pixels. |
*/ |
private int measureContentWidth() { |
- int maxWidth = 0; |
- View itemView = null; |
if (mAdapter == null) return 0; |
aurimas (slooooooooow)
2014/10/23 00:57:01
Why would mAdapter be null?
|
+ int maxWidth = 0; |
+ View[] itemViews = new View[mAdapter.getViewTypeCount()]; |
final int widthMeasureSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED); |
final int heightMeasureSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED); |
for (int i = 0; i < mAdapter.getCount(); i++) { |
- itemView = mAdapter.getView(i, itemView, null); |
+ int type = mAdapter.getItemViewType(i); |
+ itemViews[type] = mAdapter.getView(i, itemViews[type], null); |
+ View itemView = itemViews[type]; |
LinearLayout.LayoutParams params = |
new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, |
LinearLayout.LayoutParams.WRAP_CONTENT); |