本文整理汇总了Java中in.srain.cube.views.ptr.util.PtrCLog类的典型用法代码示例。如果您正苦于以下问题:Java PtrCLog类的具体用法?Java PtrCLog怎么用?Java PtrCLog使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PtrCLog类属于in.srain.cube.views.ptr.util包,在下文中一共展示了PtrCLog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: movePos
import in.srain.cube.views.ptr.util.PtrCLog; //导入依赖的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: refreshComplete
import in.srain.cube.views.ptr.util.PtrCLog; //导入依赖的package包/类
/**
* Call this when data is loaded.
* The UI will perform complete at once or after a delay, depends on the time elapsed is greater then {@link #mLoadingMinTime} or not.
*/
final public void refreshComplete() {
if (DEBUG) {
PtrCLog.i(LOG_TAG, "refreshComplete");
}
if (mRefreshCompleteHook != null) {
mRefreshCompleteHook.reset();
}
int delay = (int) (mLoadingMinTime - (System.currentTimeMillis() - mLoadingStartTime));
if (delay <= 0) {
if (DEBUG) {
PtrCLog.d(LOG_TAG, "performRefreshComplete at once");
}
performRefreshComplete();
} else {
postDelayed(mPerformRefreshCompleteDelay, delay);
if (DEBUG) {
PtrCLog.d(LOG_TAG, "performRefreshComplete after delay: %s", delay);
}
}
}
示例3: performRefresh
import in.srain.cube.views.ptr.util.PtrCLog; //导入依赖的package包/类
private void performRefresh() {
mLoadingStartTime = System.currentTimeMillis();
if (mPtrUIHandlerHolder.hasHandler()) {
mPtrUIHandlerHolder.onUIRefreshBegin(this);
if (DEBUG) {
PtrCLog.i(LOG_TAG, "PtrUIHandler: onUIRefreshBegin");
}
}
if (mPtrHandler != null) {
if (mPtrIndicator.isHeader()) {
mPtrHandler.onRefreshBegin(this);
} else {
if (mPtrHandler instanceof PtrHandler2) {
((PtrHandler2) mPtrHandler).onLoadMoreBegin(this);
}
}
}
}
示例4: notifyUIRefreshComplete
import in.srain.cube.views.ptr.util.PtrCLog; //导入依赖的package包/类
/**
* Do real refresh work. If there is a hook, execute the hook first.
*
* @param ignoreHook
*/
private void notifyUIRefreshComplete(boolean ignoreHook) {
/**
* After hook operation is done, {@link #notifyUIRefreshComplete} will be call in resume action to ignore hook.
*/
if (mPtrIndicator.hasLeftStartPosition() && !ignoreHook && mRefreshCompleteHook != null) {
if (DEBUG) {
PtrCLog.d(LOG_TAG, "notifyUIRefreshComplete mRefreshCompleteHook run.");
}
mRefreshCompleteHook.takeOver();
return;
}
if (mPtrUIHandlerHolder.hasHandler()) {
if (DEBUG) {
PtrCLog.i(LOG_TAG, "PtrUIHandler: onUIRefreshComplete");
}
mPtrUIHandlerHolder.onUIRefreshComplete(this);
}
mPtrIndicator.onUIRefreshComplete();
tryScrollBackToTopAfterComplete();
tryToNotifyReset();
}
示例5: autoRefresh
import in.srain.cube.views.ptr.util.PtrCLog; //导入依赖的package包/类
public void autoRefresh(boolean atOnce, int duration) {
if (mStatus != PTR_STATUS_INIT) {
return;
}
mFlag |= atOnce ? FLAG_AUTO_REFRESH_AT_ONCE : FLAG_AUTO_REFRESH_BUT_LATER;
mStatus = PTR_STATUS_PREPARE;
if (mPtrUIHandlerHolder.hasHandler()) {
mPtrUIHandlerHolder.onUIRefreshPrepare(this);
if (DEBUG) {
PtrCLog.i(LOG_TAG, "PtrUIHandler: onUIRefreshPrepare, mFlag %s", mFlag);
}
}
mScrollChecker.tryToScrollTo(mPtrIndicator.getOffsetToRefresh(), duration);
if (atOnce) {
mStatus = PTR_STATUS_LOADING;
performRefresh();
}
}
示例6: autoRefresh
import in.srain.cube.views.ptr.util.PtrCLog; //导入依赖的package包/类
public void autoRefresh(boolean atOnce, boolean isHeader) {
if (mStatus != PTR_STATUS_INIT) {
return;
}
mFlag |= atOnce ? FLAG_AUTO_REFRESH_AT_ONCE : FLAG_AUTO_REFRESH_BUT_LATER;
mStatus = PTR_STATUS_PREPARE;
if (mPtrUIHandlerHolder.hasHandler()) {
mPtrUIHandlerHolder.onUIRefreshPrepare(this);
if (DEBUG) {
PtrCLog.i(LOG_TAG, "PtrUIHandler: onUIRefreshPrepare, mFlag %s", mFlag);
}
}
mPtrIndicator.setIsHeader(isHeader);
mScrollChecker.tryToScrollTo(mPtrIndicator.getOffsetToRefresh(), isHeader ? mDurationToCloseHeader : mDurationToCloseFooter);
if (atOnce) {
mStatus = PTR_STATUS_LOADING;
performRefresh();
}
}
示例7: tryToScrollTo
import in.srain.cube.views.ptr.util.PtrCLog; //导入依赖的package包/类
public void tryToScrollTo(int to, int duration) {
if (mPtrIndicator.isAlreadyHere(to)) {
return;
}
mStart = mPtrIndicator.getCurrentPosY();
mTo = to;
int distance = to - mStart;
if (DEBUG) {
PtrCLog.d(LOG_TAG, "tryToScrollTo: start: %s, distance:%s, to:%s", mStart, distance, to);
}
removeCallbacks(this);
mLastFlingY = 0;
// fix #47: Scroller should be reused, https://github.com/liaohuqiu/android-Ultra-Pull-To-Refresh/issues/47
if (!mScroller.isFinished()) {
mScroller.forceFinished(true);
}
mScroller.startScroll(0, 0, 0, distance, duration);
post(this);
mIsRunning = true;
}
示例8: performRefreshComplete
import in.srain.cube.views.ptr.util.PtrCLog; //导入依赖的package包/类
/**
* Do refresh complete work when time elapsed is greater than {@link #mLoadingMinTime}
*/
private void performRefreshComplete() {
mStatus = PTR_STATUS_COMPLETE;
// if is auto refresh do nothing, wait scroller stop
if (mScrollChecker.mIsRunning && isAutoRefresh()) {
// do nothing
if (DEBUG) {
PtrCLog.d(LOG_TAG, "performRefreshComplete do nothing, scrolling: %s, auto refresh: %s",
mScrollChecker.mIsRunning, mFlag);
}
return;
}
notifyUIRefreshComplete(false);
}
示例9: run
import in.srain.cube.views.ptr.util.PtrCLog; //导入依赖的package包/类
public void run() {
boolean finish = !mScroller.computeScrollOffset() || mScroller.isFinished();
int curY = mScroller.getCurrY();
int deltaY = curY - mLastFlingY;
if (DEBUG) {
if (deltaY != 0) {
PtrCLog.v(LOG_TAG,
"scroll: %s, start: %s, to: %s, currentPos: %s, current :%s, last: %s, delta: %s",
finish, mStart, mTo, mPtrIndicator.getCurrentPosY(), curY, mLastFlingY, deltaY);
}
}
if (!finish) {
mLastFlingY = curY;
movePos(deltaY);
post(this);
} else {
finish();
}
}
示例10: movePos2
import in.srain.cube.views.ptr.util.PtrCLog; //导入依赖的package包/类
/**
* if deltaY < 0, move the content up
* //关于HeaderView的处理
*
* @param deltaY
*/
private void movePos2(float deltaY) {
// has reached the bottom
if ((deltaY >= 0 && mPtrIndicator.isInBottomPosition())) {
if (DEBUG) {
PtrCLog.e(LOG_TAG, String.format("has reached the bottom"));
}
return;
}
int to = mPtrIndicator.getCurrentPosY() + (int) deltaY;
if (-to > 3 * mFooterHeight) return; // // TODO: 2017/9/1 限制最大移动高度
// over bottom
if (mPtrIndicator.willOverBottom(to)) {
if (DEBUG) {
PtrCLog.e(LOG_TAG, String.format("over bottom"));
}
to = PtrIndicator.POS_START;
}
if (Math.abs(to) >= mFooterHeight && (mClickToLoad && !mLoadFinishComplete || mLoadFinishComplete)) {//点击加载情况
to = -mFooterHeight;
}
mPtrIndicator.setCurrentPos(to);
int change = to - mPtrIndicator.getLastPosY();
updatePos2(change);
}
示例11: movePos
import in.srain.cube.views.ptr.util.PtrCLog; //导入依赖的package包/类
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;
if (to > 3 * mHeaderHeight) return;
// 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);
}
示例12: tryToNotifyReset
import in.srain.cube.views.ptr.util.PtrCLog; //导入依赖的package包/类
private void tryToNotifyReset(boolean isHeaderOrFooter){
if ((mStatus == PTR_STATUS_COMPLETE || mStatus == PTR_STATUS_PREPARE) && mPtrIndicator.isInStartPosition()) {
if(isHeaderOrFooter){
if (mPtrUIHeaderHolder.hasHandler()) {
mPtrUIHeaderHolder.onUIReset(this);
if (DEBUG) {
PtrCLog.i(LOG_TAG, "PtrUIHeader: onUIReset");
}
}
}else {
if (mPtrUIFooterHolder.hasHandler()) {
mPtrUIFooterHolder.onUIReset(this);
if (DEBUG) {
PtrCLog.i(LOG_TAG, "PtrUIHeader: onUIReset");
}
}
}
mStatus = PTR_STATUS_INIT;
clearFlag();
PtrIndicator.isPullHeader=false;
PtrIndicator.isPullFooter=false;
}
}
示例13: refreshComplete
import in.srain.cube.views.ptr.util.PtrCLog; //导入依赖的package包/类
/**
* Call this when data is loaded.
* The UI will perform complete at once or after a delay, depends on the time elapsed is greater then {@link #mLoadingMinTime} or not.
*/
final public void refreshComplete() {
int mStart = mPtrIndicator.getCurrentPosY();
if (mStart < PtrIndicator.POS_START)
return;
if (DEBUG) {
PtrCLog.i(LOG_TAG, "refreshComplete");
}
if (mRefreshCompleteHook != null) {
mRefreshCompleteHook.reset();
}
int delay = (int) (mLoadingMinTime - (System.currentTimeMillis() - mLoadingStartTime));
if (delay <= 0) {
if (DEBUG) {
PtrCLog.d(LOG_TAG, "performRefreshComplete at once");
}
performRefreshComplete();
} else {
postDelayed(mPerformRefreshCompleteDelay, delay);
if (DEBUG) {
PtrCLog.d(LOG_TAG, "performRefreshComplete after delay: %s", delay);
}
}
}
示例14: loadComplete
import in.srain.cube.views.ptr.util.PtrCLog; //导入依赖的package包/类
final public void loadComplete() {
int mStart = mPtrIndicator.getCurrentPosY();
if (mStart > PtrIndicator.POS_START)
return;
if (DEBUG) {
PtrCLog.i(LOG_TAG, "refreshComplete");
}
if (mLoadCompleteHook != null) {
mLoadCompleteHook.reset();
}
int delay = (int) (mLoadingMinTime - (System.currentTimeMillis() - mLoadingStartTime));
if (delay <= 0) {
if (DEBUG) {
PtrCLog.d(LOG_TAG, "performRefreshComplete at once");
}
performLoadComplete();
} else {
postDelayed(mPerformLoadCompleteDelay, delay);
if (DEBUG) {
PtrCLog.d(LOG_TAG, "performRefreshComplete after delay: %s", delay);
}
}
}
示例15: notifyUIRefreshComplete
import in.srain.cube.views.ptr.util.PtrCLog; //导入依赖的package包/类
/**
* Do real refresh work. If there is a hook, execute the hook first.
*
* @param ignoreHook
*/
private void notifyUIRefreshComplete(boolean ignoreHook) {
/**
* After hook operation is done, {@link #notifyUIRefreshComplete} will be call in resume action to ignore hook.
*/
if (mPtrIndicator.hasLeftStartPosition() && !ignoreHook && mRefreshCompleteHook != null) {
if (DEBUG) {
PtrCLog.d(LOG_TAG, "notifyUIRefreshComplete mRefreshCompleteHook run.");
}
mRefreshCompleteHook.takeOver();
return;
}
if (mPtrUIHeaderHolder.hasHandler()) {
if (DEBUG) {
PtrCLog.i(LOG_TAG, "PtrUIHeader: onUIRefreshComplete");
}
mPtrUIHeaderHolder.onUIRefreshComplete(this);
}
mPtrIndicator.onUIRefreshComplete();
tryScrollBackToTopAfterComplete();
tryToNotifyReset(true);
}