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

View File

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