feat:Add Complext Demo

This commit is contained in:
pengfei.zhou 2019-12-03 09:27:20 +08:00
parent 2e96912a99
commit 6d86b8cfeb
3 changed files with 10 additions and 4 deletions

View File

@ -30,6 +30,8 @@ import androidx.swiperefreshlayout.widget.CircularProgressDrawable;
import android.view.animation.Animation.AnimationListener; import android.view.animation.Animation.AnimationListener;
import pub.doric.utils.DoricUtils;
/** /**
* @Description: pub.doric.pullable * @Description: pub.doric.pullable
* @Author: pengfei.zhou * @Author: pengfei.zhou
@ -912,7 +914,7 @@ public class DoricSwipeLayout extends ViewGroup implements NestedScrollingParent
ViewCompat.offsetTopAndBottom(mRefreshView, offset); ViewCompat.offsetTopAndBottom(mRefreshView, offset);
mCurrentTargetOffsetTop = mRefreshView.getTop(); mCurrentTargetOffsetTop = mRefreshView.getTop();
if (mRefreshView.getMeasuredHeight() > 0) { if (mRefreshView.getMeasuredHeight() > 0) {
mRefreshView.setPullingDistance((float) mRefreshView.getBottom()); mRefreshView.setPullingDistance(DoricUtils.px2dp(mRefreshView.getBottom()));
} }
} }

View File

@ -1,4 +1,4 @@
import { Panel, Group, vlayout, image, layoutConfig, ScaleType, refreshable, Color, pullable, stack, Image, Refreshable, TranslationAnimation } from "doric"; import { Panel, Group, vlayout, image, layoutConfig, ScaleType, refreshable, Color, pullable, stack, Image, Refreshable, TranslationAnimation, loge, log } from "doric";
import { title, icon_refresh } from "./utils"; import { title, icon_refresh } from "./utils";
@Entry @Entry
@ -23,8 +23,9 @@ class MyDemo extends Panel {
}, },
stopAnimation: () => { stopAnimation: () => {
}, },
setPullingDistance: (rotation: number) => { setPullingDistance: (distance: number) => {
headerImage.scaleX = headerImage.scaleY = (headerImage.height + rotation) / headerImage.height headerImage.scaleX = headerImage.scaleY = (headerImage.height + distance * 2) / headerImage.height
log(`Header Image scaleY:${headerImage.scaleY},height:${headerImage.height},distance:${distance}`)
}, },
}), }),
content: vlayout([]).apply({ content: vlayout([]).apply({

View File

@ -69,6 +69,9 @@ - (BOOL)requestFromSubview:(UIView *)subview {
} }
- (void)layoutSelf:(CGSize)targetSize { - (void)layoutSelf:(CGSize)targetSize {
if (self.contentOffset.y != 0) {
return;
}
self.width = targetSize.width; self.width = targetSize.width;
self.height = targetSize.height; self.height = targetSize.height;
[self.headerView also:^(UIView *it) { [self.headerView also:^(UIView *it) {