HVScrollView fling changed

This commit is contained in:
王劲鹏 2020-01-15 14:11:01 +08:00 committed by osborn
parent 3855227e74
commit 7140190adf
3 changed files with 11 additions and 2729 deletions

View File

@ -21,7 +21,7 @@ import com.github.pengfeizhou.jscore.JSValue;
import pub.doric.DoricContext; import pub.doric.DoricContext;
import pub.doric.extension.bridge.DoricPlugin; import pub.doric.extension.bridge.DoricPlugin;
import pub.doric.widget.NewHVScrollView; import pub.doric.widget.HVScrollView;
/** /**
* @Description: pub.doric.shader * @Description: pub.doric.shader
@ -29,7 +29,7 @@ import pub.doric.widget.NewHVScrollView;
* @CreateDate: 2019-11-18 * @CreateDate: 2019-11-18
*/ */
@DoricPlugin(name = "Scroller") @DoricPlugin(name = "Scroller")
public class ScrollerNode extends SuperNode<NewHVScrollView> { public class ScrollerNode extends SuperNode<HVScrollView> {
private String mChildViewId; private String mChildViewId;
private ViewNode mChildNode; private ViewNode mChildNode;
@ -50,12 +50,12 @@ public class ScrollerNode extends SuperNode<NewHVScrollView> {
} }
@Override @Override
protected NewHVScrollView build() { protected HVScrollView build() {
return new NewHVScrollView(getContext()); return new HVScrollView(getContext());
} }
@Override @Override
protected void blend(NewHVScrollView view, String name, JSValue prop) { protected void blend(HVScrollView view, String name, JSValue prop) {
if ("content".equals(name)) { if ("content".equals(name)) {
mChildViewId = prop.asString().value(); mChildViewId = prop.asString().value();
} else { } else {

View File

@ -1960,11 +1960,12 @@ public class HVScrollView extends FrameLayout implements NestedScrollingParent,
if (getChildCount() > 0) { if (getChildCount() > 0) {
int axes = getAxes(); int axes = getAxes();
startNestedScroll(axes, ViewCompat.TYPE_NON_TOUCH); startNestedScroll(axes, ViewCompat.TYPE_NON_TOUCH);
mScroller.fling(getScrollX(), getScrollY(), // start int height = getHeight() - getPaddingBottom() - getPaddingTop();
velocityX, velocityY, // velocities int width = getWidth() - getPaddingRight() - getPaddingLeft();
Integer.MIN_VALUE, Integer.MAX_VALUE, // x int bottom = getChildAt(0).getHeight();
Integer.MIN_VALUE, Integer.MAX_VALUE, // y int right = getChildAt(0).getWidth();
0, 0); // overscroll mScroller.fling(getScrollX(), getScrollY(), velocityX, velocityY, 0, Math.max(0, right - width), 0,
Math.max(0, bottom - height), width * 2 / 3, height * 2 / 3);
mLastScrollerX = getScrollX(); mLastScrollerX = getScrollX();
mLastScrollerY = getScrollY(); mLastScrollerY = getScrollY();
ViewCompat.postInvalidateOnAnimation(this); ViewCompat.postInvalidateOnAnimation(this);