本文整理汇总了Java中in.srain.cube.views.ptr.indicator.PtrIndicator类的典型用法代码示例。如果您正苦于以下问题:Java PtrIndicator类的具体用法?Java PtrIndicator怎么用?Java PtrIndicator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PtrIndicator类属于in.srain.cube.views.ptr.indicator包,在下文中一共展示了PtrIndicator类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: movePos
import in.srain.cube.views.ptr.indicator.PtrIndicator; //导入依赖的package包/类
/**
* if deltaY > 0, move the content down
*
* @param deltaY
*/
private void movePos(float deltaY) {
// has reached the top
if ((deltaY < 0 && mPtrIndicator.isInStartPosition())) {
if (DEBUG) {
PtrCLog.e(LOG_TAG, String.format("has reached the top"));
}
return;
}
int to = mPtrIndicator.getCurrentPosY() + (int) deltaY;
// over top
if (mPtrIndicator.willOverTop(to)) {
if (DEBUG) {
PtrCLog.e(LOG_TAG, String.format("over top"));
}
to = PtrIndicator.POS_START;
}
mPtrIndicator.setCurrentPos(to);
int change = to - mPtrIndicator.getLastPosY();
updatePos(change);
}
示例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 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);
}
}
}
}
示例3: onUIPositionChange
import in.srain.cube.views.ptr.indicator.PtrIndicator; //导入依赖的package包/类
@Override
public void onUIPositionChange(PtrFrameLayout frame, boolean isUnderTouch, byte status, PtrIndicator ptrIndicator) {
float percent = Math.min(1f, ptrIndicator.getCurrentPercent());
if (status == PtrFrameLayout.PTR_STATUS_PREPARE) {
mDrawable.setAlpha((int) (255 * percent));
mDrawable.showArrow(true);
float strokeStart = ((percent) * .8f);
mDrawable.setStartEndTrim(0f, Math.min(0.8f, strokeStart));
mDrawable.setArrowScale(Math.min(1f, percent));
// magic
float rotation = (-0.25f + .4f * percent + percent * 2) * .5f;
mDrawable.setProgressRotation(rotation);
invalidate();
}
}
示例4: movePos
import in.srain.cube.views.ptr.indicator.PtrIndicator; //导入依赖的package包/类
/**
* if deltaY > 0, move the content down
*
* @param deltaY
*/
private void movePos(float deltaY) {
// has reached the top
if ((deltaY < 0 && mPtrIndicator.isInStartPosition())) {
if (DEBUG) {
PtrCLog.e(LOG_TAG, String.format("has reached the top"));
}
return;
}
int to = mPtrIndicator.getCurrentPosY() + (int) deltaY;
// over top
if (mPtrIndicator.willOverTop(to)) {
if (DEBUG) {
PtrCLog.e(LOG_TAG, String.format("over top"));
}
to = PtrIndicator.POS_START;
}
mPtrIndicator.setCurrentPos(to);
int change = to - mPtrIndicator.getLastPosY();
updatePos(mPtrIndicator.isHeader() ? change : -change);
}
示例5: 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);
}
}
}
示例6: 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);
}
}
}
示例7: 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);
}
}