Wrap the widget preview of the add item sheet with a scroll view
Test: manual Fix: 192622015 Change-Id: I1eb676a92201970962c71194682ea70ce42b3d1b
This commit is contained in:
parent
277eb6fe59
commit
1afca4dce5
|
@ -65,12 +65,19 @@
|
|||
android:alpha="0.7"
|
||||
android:importantForAccessibility="no"/>
|
||||
|
||||
<include layout="@layout/widget_cell"
|
||||
android:id="@+id/widget_cell"
|
||||
<ScrollView
|
||||
android:id="@+id/widget_preview_scroll_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginVertical="16dp" />
|
||||
android:layout_marginVertical="16dp"
|
||||
android:layout_weight="1">
|
||||
|
||||
<include
|
||||
android:id="@+id/widget_cell"
|
||||
layout="@layout/widget_cell"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</ScrollView>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -25,10 +25,12 @@ import android.content.Context;
|
|||
import android.graphics.Insets;
|
||||
import android.graphics.Rect;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewParent;
|
||||
import android.view.WindowInsets;
|
||||
import android.widget.ScrollView;
|
||||
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
import com.android.launcher3.R;
|
||||
|
@ -44,6 +46,7 @@ public class AddItemWidgetsBottomSheet extends AbstractSlideInView<AddItemActivi
|
|||
private static final int DEFAULT_CLOSE_DURATION = 200;
|
||||
|
||||
private final Rect mInsets;
|
||||
private ScrollView mWidgetPreviewScrollView;
|
||||
|
||||
public AddItemWidgetsBottomSheet(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
|
@ -67,6 +70,19 @@ public class AddItemWidgetsBottomSheet extends AbstractSlideInView<AddItemActivi
|
|||
animateOpen();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onControllerInterceptTouchEvent(MotionEvent ev) {
|
||||
if (ev.getAction() == MotionEvent.ACTION_DOWN) {
|
||||
mNoIntercept = false;
|
||||
// Suppress drag to dismiss gesture if the scroll view is being scrolled.
|
||||
if (getPopupContainer().isEventOverView(mWidgetPreviewScrollView, ev)
|
||||
&& mWidgetPreviewScrollView.getScrollY() > 0) {
|
||||
mNoIntercept = true;
|
||||
}
|
||||
}
|
||||
return super.onControllerInterceptTouchEvent(ev);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onLayout(boolean changed, int l, int t, int r, int b) {
|
||||
int width = r - l;
|
||||
|
@ -104,6 +120,7 @@ public class AddItemWidgetsBottomSheet extends AbstractSlideInView<AddItemActivi
|
|||
protected void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
mContent = findViewById(R.id.add_item_bottom_sheet_content);
|
||||
mWidgetPreviewScrollView = findViewById(R.id.widget_preview_scroll_view);
|
||||
}
|
||||
|
||||
private void animateOpen() {
|
||||
|
|
Loading…
Reference in New Issue