Fix scrolling in WidgetsBottomSheet

Popup container shouldn't intercept the scroll event if its child
scroll view isn't scrolled to the top yet.

Test: manual
Bug: 183599207
Change-Id: I434ba5e91b154e9862f22c08cd01c9d459e6707b
This commit is contained in:
Steven Ng
2021-03-24 14:51:19 +00:00
parent 59230c3cdd
commit 02c4f65e67

View File

@@ -26,6 +26,7 @@ import android.util.IntProperty;
import android.util.Pair;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Interpolator;
@@ -152,6 +153,19 @@ public class WidgetsBottomSheet extends BaseWidgetSheet implements Insettable {
});
}
@Override
public boolean onControllerInterceptTouchEvent(MotionEvent ev) {
if (ev.getAction() == MotionEvent.ACTION_DOWN) {
mNoIntercept = false;
ScrollView scrollView = findViewById(R.id.widgets_table_scroll_view);
if (getPopupContainer().isEventOverView(scrollView, ev)
&& scrollView.getScrollY() > 0) {
mNoIntercept = true;
}
}
return super.onControllerInterceptTouchEvent(ev);
}
protected WidgetCell addItemCell(ViewGroup parent) {
WidgetCell widget = (WidgetCell) LayoutInflater.from(getContext())
.inflate(R.layout.widget_cell, parent, false);