-
Notifications
You must be signed in to change notification settings - Fork 4
IHeaderView_en
Zone edited this page Jan 18, 2017
·
1 revision
public interface IHeaderView {
/**
* To get the head layout
* @param zRefreshLayout
* @return
*/
View getView(ZRefreshLayout zRefreshLayout);
/**
* The drop-down to refresh action
* @param fraction The current drop-down height and the height of the head more than head animation basic remain unchanged
* @param headHeight
*/
void onPullingDown(float fraction, float headHeight);
/**
* Can refresh and do not refresh status switch to monitor
* @param refreshAble
*/
void refreshAble(boolean refreshAble);
/**
* The springback animation listening
*
* @param animateBack The springback type
* @param fraction
* @param headHeight
* @param isPinContent
*/
void animateBack(AnimateBack animateBack, float fraction, float headHeight, boolean isPinContent);
/**
* Intercept the scroll
* Want to let the scroll can be used AUtils.smoothScrollTo_NotIntercept(iScroll,0);
* reference:Demo-CircleRefresh
*
* @param animateBack
* @param iScroll
* @return
*/
boolean interceptAnimateBack(AnimateBack animateBack, ZRefreshLayout.IScroll iScroll);
/**
* The refresh during
*
* @param headHeight
* @param isAutoRefresh
*/
void onRefreshing(float headHeight, boolean isAutoRefresh);
/**
* The used to reset the state called the head Rest a moment before
*/
void onComplete();
/**
* Global change head configuration
* Main object is to copy the head, copy to copy the properties
* Returns null, the default is the sinaHeader
*/
IHeaderView clone_();
}
我觉得出发刷新的位置应该与头部关联更为紧密所以,方法放到AUtils类中setHeaderHeightToRefresh方法,为了不让ZRefreshLayout中方法暴露出去
For exmaple:
@Override
public View getView(ZRefreshLayout zRefreshLayout) {
rootView = View.inflate(zRefreshLayout.getContext(), R.layout.header_meterial, null);
AUtils.setHeaderHeightToRefresh(zRefreshLayout,(int) (screenPixs[1] * 0.2*0.8));
...
return rootView;
}
interceptAnimateBack方法如果返回true,滚动就会被拦截不执行。
通过AUtils.smoothScrollTo_NotIntercept(iScroll,0);方法让其滚动到特定位置.Tips:此方法不会被拦截!
mHeaderWaveCircle.setOnViewAniDone(new AnimationView.OnViewAniDone() {
@Override
public void viewAniDone() {
AUtils.smoothScrollTo_NotIntercept(iScroll,0);
}
});
public boolean interceptAnimateBack(AnimateBack animateBack, ZRefreshLayout.IScroll iScroll) {
this.iScroll = iScroll;
boolean result = false;
if (mAnimateBack != animateBack && animateBack == AnimateBack.Complete_Back) {
//完成时候的滚动返回被拦截
mHeaderWaveCircle.setRefreshing(false);
result = true;
}
mAnimateBack = animateBack;
return result;
}