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


Java PtrIndicator.getCurrentPosY方法代码示例

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

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

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

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

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

示例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);
    }
}
 
开发者ID:whu-iss-jack,项目名称:langren,代码行数:16,代码来源:PullRefresh.java

示例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);
        }
    }
}
 
开发者ID:MyGrades,项目名称:mygrades-app,代码行数:15,代码来源:PtrHeader.java


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