Commit eb3586a8 authored by abhi.rathore's avatar abhi.rathore Committed by Commit Bot

[Android] Hide SELECT popups on scroll start.

Select popup is still visible during mouse wheel scroll
outside select popup dialog, which is not a correct behaviour
in android. Hence we hide the select popup during page scroll
in android.

Bug: 967563
Change-Id: I0bab0fb5beca7046bbf802b7935f785bf352f9b5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1631811Reviewed-by: default avatarDave Tapuska <dtapuska@chromium.org>
Reviewed-by: default avatarChangwan Ryu <changwan@chromium.org>
Reviewed-by: default avatarAJITH KUMAR V <ajith.v@samsung.com>
Commit-Queue: AJITH KUMAR V <ajith.v@samsung.com>
Cr-Commit-Position: refs/heads/master@{#664679}
parent 9b5e8436
...@@ -150,8 +150,8 @@ public class SelectPopup implements HideablePopup, ViewAndroidDelegate.Container ...@@ -150,8 +150,8 @@ public class SelectPopup implements HideablePopup, ViewAndroidDelegate.Container
WebContentsAccessibilityImpl wcax = WebContentsAccessibilityImpl wcax =
WebContentsAccessibilityImpl.fromWebContents(mWebContents); WebContentsAccessibilityImpl.fromWebContents(mWebContents);
if (DeviceFormFactor.isTablet() && !multiple && !wcax.isTouchExplorationEnabled()) { if (DeviceFormFactor.isTablet() && !multiple && !wcax.isTouchExplorationEnabled()) {
mPopupView = new SelectPopupDropdown( mPopupView = new SelectPopupDropdown(this, context, anchorView, popupItems,
this, context, anchorView, popupItems, selectedIndices, rightAligned); selectedIndices, rightAligned, mWebContents);
} else { } else {
mPopupView = mPopupView =
new SelectPopupDialog(this, context, popupItems, multiple, selectedIndices); new SelectPopupDialog(this, context, popupItems, multiple, selectedIndices);
......
...@@ -9,6 +9,9 @@ import android.view.View; ...@@ -9,6 +9,9 @@ import android.view.View;
import android.widget.AdapterView; import android.widget.AdapterView;
import android.widget.PopupWindow; import android.widget.PopupWindow;
import org.chromium.content_public.browser.GestureListenerManager;
import org.chromium.content_public.browser.GestureStateListener;
import org.chromium.content_public.browser.WebContents;
import org.chromium.ui.DropdownAdapter; import org.chromium.ui.DropdownAdapter;
import org.chromium.ui.DropdownPopupWindow; import org.chromium.ui.DropdownPopupWindow;
...@@ -24,7 +27,8 @@ public class SelectPopupDropdown implements SelectPopup.Ui { ...@@ -24,7 +27,8 @@ public class SelectPopupDropdown implements SelectPopup.Ui {
private boolean mSelectionNotified; private boolean mSelectionNotified;
public SelectPopupDropdown(SelectPopup selectPopup, Context context, View anchorView, public SelectPopupDropdown(SelectPopup selectPopup, Context context, View anchorView,
List<SelectPopupItem> items, int[] selected, boolean rightAligned) { List<SelectPopupItem> items, int[] selected, boolean rightAligned,
WebContents webContents) {
mSelectPopup = selectPopup; mSelectPopup = selectPopup;
mDropdownPopupWindow = new DropdownPopupWindow(context, anchorView); mDropdownPopupWindow = new DropdownPopupWindow(context, anchorView);
mDropdownPopupWindow.setOnItemClickListener(new AdapterView.OnItemClickListener() { mDropdownPopupWindow.setOnItemClickListener(new AdapterView.OnItemClickListener() {
...@@ -49,6 +53,12 @@ public class SelectPopupDropdown implements SelectPopup.Ui { ...@@ -49,6 +53,12 @@ public class SelectPopupDropdown implements SelectPopup.Ui {
notifySelection(null); notifySelection(null);
} }
}); });
GestureListenerManager.fromWebContents(webContents).addListener(new GestureStateListener() {
@Override
public void onScrollStarted(int scrollOffsetY, int scrollExtentY) {
hide(true);
}
});
} }
private void notifySelection(int[] indicies) { private void notifySelection(int[] indicies) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment