本文整理汇总了Java中in.srain.cube.views.ptr.indicator.PtrIndicator.getCurrentPosY方法的典型用法代码示例。如果您正苦于以下问题:Java PtrIndicator.getCurrentPosY方法的具体用法?Java PtrIndicator.getCurrentPosY怎么用?Java PtrIndicator.getCurrentPosY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类in.srain.cube.views.ptr.indicator.PtrIndicator
的用法示例。
在下文中一共展示了PtrIndicator.getCurrentPosY方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onUIPositionChange
import in.srain.cube.views.ptr.indicator.PtrIndicator; //导入方法依赖的package包/类
@Override
public void onUIPositionChange(PtrFrameLayout frame, boolean isUnderTouch, byte status, PtrIndicator ptrIndicator) {
final int mOffsetToRefresh = frame.getOffsetToRefresh();
final int currentPos = ptrIndicator.getCurrentPosY();
final int lastPos = ptrIndicator.getLastPosY();
if (currentPos < mOffsetToRefresh && lastPos >= mOffsetToRefresh) {
if (isUnderTouch && status == PtrFrameLayout.PTR_STATUS_PREPARE) {
crossRotateLineFromBottomUnderTouch(frame);
if (mRotateView != null) {
mRotateView.clearAnimation();
mRotateView.startAnimation(mReverseFlipAnimation);
}
}
} else if (currentPos > mOffsetToRefresh && lastPos <= mOffsetToRefresh) {
if (isUnderTouch && status == PtrFrameLayout.PTR_STATUS_PREPARE) {
crossRotateLineFromTopUnderTouch(frame);
if (mRotateView != null) {
mRotateView.clearAnimation();
mRotateView.startAnimation(mFlipAnimation);
}
}
}
}
示例2: onUIPositionChange
import in.srain.cube.views.ptr.indicator.PtrIndicator; //导入方法依赖的package包/类
@Override
public void onUIPositionChange(PtrFrameLayout frame, boolean isUnderTouch, byte status, PtrIndicator ptrIndicator) {
final int offsetToRefresh = frame.getOffsetToRefresh();
final int currentPos = ptrIndicator.getCurrentPosY();
if (currentPos <= offsetToRefresh) {
if (limitX == 0) calcLimitX();
double percent = (double) currentPos / offsetToRefresh;
int targetX = (int) (limitX * percent);
mIvIcon.setTranslationX(targetX);
int newPercent = (int) (percent * 100);
if (newPercent % 10 == 0) {
double i = newPercent / 10;
if (i % 2 == 0) {
mIvIcon.setImageResource(R.drawable.refresh_down_icon_3);
} else {
mIvIcon.setImageResource(R.drawable.refresh_down_icon_1);
}
} else if (newPercent % 5 == 0) {
mIvIcon.setImageResource(R.drawable.refresh_down_icon_2);
}
}
}
示例3: onUIPositionChange
import in.srain.cube.views.ptr.indicator.PtrIndicator; //导入方法依赖的package包/类
@Override
public void onUIPositionChange(PtrFrameLayout frame, boolean isUnderTouch, byte status, PtrIndicator ptrIndicator) {
final int mOffsetToRefresh = frame.getOffsetToRefresh();
final int currentPos = ptrIndicator.getCurrentPosY();
final int lastPos = ptrIndicator.getLastPosY();
if (lastPos < mOffsetToRefresh) {
if (isUnderTouch && status == PtrFrameLayout.PTR_STATUS_PREPARE) {
float scale = lastPos / (float) mOffsetToRefresh;
pullStep0(scale);
}
}
Log.i(TAG, "mOffsetToRefresh =" + mOffsetToRefresh + ",currentPos =" + currentPos + ",lastPos =" + lastPos);
if (currentPos < mOffsetToRefresh && lastPos >= mOffsetToRefresh) {
if (isUnderTouch && status == PtrFrameLayout.PTR_STATUS_PREPARE) {
pullStep4();
}
} else if (currentPos > mOffsetToRefresh && lastPos <= mOffsetToRefresh) {
if (isUnderTouch && status == PtrFrameLayout.PTR_STATUS_PREPARE) {
pullStep1(frame);
}
}
}
示例4: onUIPositionChange
import in.srain.cube.views.ptr.indicator.PtrIndicator; //导入方法依赖的package包/类
@Override
public void onUIPositionChange(PtrFrameLayout frame, boolean isUnderTouch, byte status, PtrIndicator ptrIndicator) {
final int mOffsetToRefresh = frame.getOffsetToRefresh();
final int currentPos = ptrIndicator.getCurrentPosY();
final int lastPos = ptrIndicator.getLastPosY();
/**
* 刚开始下拉到下拉刷新设置的开始的距离这段路程
*/
if(isUnderTouch && lastPos < mOffsetToRefresh && status == PtrFrameLayout.PTR_STATUS_PREPARE){
float scale = lastPos / Float.valueOf(mOffsetToRefresh);
pullStep0(scale);
}
/**
* 手释放刷新的时候,可能下拉的距离比较远,这个时候没有开始走onUIRefreshBegin还。要到设定的距离才会走
*/
if(currentPos > mOffsetToRefresh && lastPos <= mOffsetToRefresh &&
isUnderTouch && status == PtrFrameLayout.PTR_STATUS_PREPARE){
pullStep1(frame);
}
}
示例5: onUIPositionChange
import in.srain.cube.views.ptr.indicator.PtrIndicator; //导入方法依赖的package包/类
@Override
public void onUIPositionChange(PtrFrameLayout frame, boolean isUnderTouch, byte status, PtrIndicator ptrIndicator) {
int otr = frame.getOffsetToRefresh();//刷新的分界线 默认为head的1.2倍
int current = ptrIndicator.getCurrentPosY();//下拉框的最顶端位置
int last = ptrIndicator.getLastPosY();//下拉框顶端最后出现的位置
if (current < otr && last >= otr) {
if (isUnderTouch&&status==PtrFrameLayout.PTR_STATUS_PREPARE){
tv_hint.setText("下拉刷新");
iv_icon.setImageResource(R.mipmap.z_arrow_down);
}
} else if (current > otr && last <= otr) {
tv_hint.setText("松开刷新");
iv_icon.setImageResource(R.mipmap.z_arrow_up);
}
}
示例6: onUIPositionChange
import in.srain.cube.views.ptr.indicator.PtrIndicator; //导入方法依赖的package包/类
@Override
public void onUIPositionChange(PtrFrameLayout frame, boolean isUnderTouch, byte status, PtrIndicator ptrIndicator) {
if (isUnderTouch && status == PtrFrameLayout.PTR_STATUS_PREPARE) {
final int mOffsetToRefresh = frame.getOffsetToRefresh();
final int currentPos = ptrIndicator.getCurrentPosY();
final int lastPos = ptrIndicator.getLastPosY();
if (currentPos < mOffsetToRefresh && lastPos >= mOffsetToRefresh) {
tvHeaderText.setText(R.string.ptr_header_pull_to_refresh);
} else if (currentPos > mOffsetToRefresh && lastPos <= mOffsetToRefresh) {
tvHeaderText.setText(R.string.ptr_header_release_to_refresh);
}
}
}