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

Unified Diff: ui/android/java/src/org/chromium/ui/DropdownPopupWindow.java

Issue 606153002: [android] Password generation UI for android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Set the width of the popup correctly. Created 6 years, 2 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
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);

Powered by Google App Engine
This is Rietveld 408576698