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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/input/SelectPopupDropdown.java

Issue 2049523005: Fix DropdownPopupWindow's position in Android N. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix with "postShow" Created 4 years, 6 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 | ui/android/java/src/org/chromium/ui/DropdownPopupWindow.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/android/java/src/org/chromium/content/browser/input/SelectPopupDropdown.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/input/SelectPopupDropdown.java b/content/public/android/java/src/org/chromium/content/browser/input/SelectPopupDropdown.java
index b5989cf533886446ab9f9ee7d683e622f2438953..d135710bd364345bb77d603a8b8ad46f84d33597 100644
--- a/content/public/android/java/src/org/chromium/content/browser/input/SelectPopupDropdown.java
+++ b/content/public/android/java/src/org/chromium/content/browser/input/SelectPopupDropdown.java
@@ -26,7 +26,6 @@ public class SelectPopupDropdown implements SelectPopup {
private final Context mContext;
private final DropdownPopupWindow mDropdownPopupWindow;
- private int mInitialSelection = -1;
private boolean mSelectionNotified;
public SelectPopupDropdown(ContentViewCore contentViewCore, List<SelectPopupItem> items,
@@ -42,9 +41,12 @@ public class SelectPopupDropdown implements SelectPopup {
hide(false);
}
});
+
+ int initialSelection = -1;
if (selected.length > 0) {
- mInitialSelection = selected[0];
+ initialSelection = selected[0];
}
+ mDropdownPopupWindow.setInitialSelection(initialSelection);
mDropdownPopupWindow.setAdapter(new DropdownAdapter(mContext, items, null));
mDropdownPopupWindow.setRtl(rightAligned);
RenderCoordinates renderCoordinates = mContentViewCore.getRenderCoordinates();
@@ -74,10 +76,9 @@ public class SelectPopupDropdown implements SelectPopup {
@Override
public void show() {
- mDropdownPopupWindow.show();
- if (mInitialSelection >= 0) {
- mDropdownPopupWindow.getListView().setSelection(mInitialSelection);
- }
+ // postShow() to make sure show() happens after the layout of the anchor view has been
+ // changed.
+ mDropdownPopupWindow.postShow();
}
@Override
« no previous file with comments | « no previous file | ui/android/java/src/org/chromium/ui/DropdownPopupWindow.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698