当前位置: 首页>>代码示例>>Java>>正文


Java PtrIndicator类代码示例

本文整理汇总了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);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:29,代码来源:PtrFrameLayout.java

示例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);
            }
        }
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:26,代码来源:PtrClassicDefaultHeader.java

示例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();
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:20,代码来源:MaterialHeader.java

示例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);
}
 
开发者ID:smartbeng,项目名称:PaoMovie,代码行数:28,代码来源:PtrFrameLayout.java

示例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);
        }
    }
}
 
开发者ID:liuhui19991,项目名称:CloudMusicLH,代码行数:27,代码来源:ParallaxHeader.java

示例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);
        }
    }

}
 
开发者ID:beanu,项目名称:smart-farmer-android,代码行数:24,代码来源:PtrAnimHeader.java

示例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);
    }

}
 
开发者ID:cyqluowang,项目名称:RRPullStyle,代码行数:25,代码来源:RRPullHeadView.java


注:本文中的in.srain.cube.views.ptr.indicator.PtrIndicator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。