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


Java ViewCompat类代码示例

本文整理汇总了Java中com.handmark.pulltorefresh.library.internal.ViewCompat的典型用法代码示例。如果您正苦于以下问题:Java ViewCompat类的具体用法?Java ViewCompat怎么用?Java ViewCompat使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ViewCompat类属于com.handmark.pulltorefresh.library.internal包,在下文中一共展示了ViewCompat类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: run

import com.handmark.pulltorefresh.library.internal.ViewCompat; //导入依赖的package包/类
public void run() {
    if (this.mStartTime == -1) {
        this.mStartTime = System.currentTimeMillis();
    } else {
        this.mCurrentY = this.mScrollFromY - Math.round(((float) (this.mScrollFromY -
                this.mScrollToY)) * this.mInterpolator.getInterpolation(((float) Math.max
                (Math.min(((System.currentTimeMillis() - this.mStartTime) * 1000) / this
                        .mDuration, 1000), 0)) / 1000.0f));
        PullToRefreshBase.this.setHeaderScroll(this.mCurrentY);
    }
    if (this.mContinueRunning && this.mScrollToY != this.mCurrentY) {
        ViewCompat.postOnAnimation(PullToRefreshBase.this, this);
    } else if (this.mListener != null) {
        this.mListener.onSmoothScrollFinished();
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:17,代码来源:PullToRefreshBase.java

示例2: run

import com.handmark.pulltorefresh.library.internal.ViewCompat; //导入依赖的package包/类
public void run()
{
    if (h == -1L)
    {
        h = System.currentTimeMillis();
    } else
    {
        long l = Math.max(Math.min((1000L * (System.currentTimeMillis() - h)) / e, 1000L), 0L);
        int j = Math.round((float)(d - c) * b.getInterpolation((float)l / 1000F));
        i = d - j;
        a.setHeaderScroll(i);
    }
    if (g && c != i)
    {
        ViewCompat.postOnAnimation(a, this);
    } else
    if (f != null)
    {
        f.a();
        return;
    }
}
 
开发者ID:vishnudevk,项目名称:MiBandDecompiled,代码行数:23,代码来源:h.java

示例3: setHeaderScroll

import com.handmark.pulltorefresh.library.internal.ViewCompat; //导入依赖的package包/类
/**
 * Helper method which just calls scrollTo() in the correct scrolling
 * direction.
 * 
 * @param value - New Scroll value
 */
protected final void setHeaderScroll(int value) {
	if (DEBUG) {
		Log.d(LOG_TAG, "setHeaderScroll: " + value);
	}

	// Clamp value to with pull scroll range
	final int maximumPullScroll = getMaximumPullScroll();
	value = Math.min(maximumPullScroll, Math.max(-maximumPullScroll, value));

	if (mLayoutVisibilityChangesEnabled) {
		if (value < 0) {
			mHeaderLayout.setVisibility(View.VISIBLE);
		} else if (value > 0) {
			mFooterLayout.setVisibility(View.VISIBLE);
		} else {
			mHeaderLayout.setVisibility(View.INVISIBLE);
			mFooterLayout.setVisibility(View.INVISIBLE);
		}
	}

	if (USE_HW_LAYERS) {
		/**
		 * Use a Hardware Layer on the Refreshable View if we've scrolled at
		 * all. We don't use them on the Header/Footer Views as they change
		 * often, which would negate any HW layer performance boost.
		 */
		ViewCompat.setLayerType(mRefreshableViewWrapper, value != 0 ? View.LAYER_TYPE_HARDWARE
				: View.LAYER_TYPE_NONE);
	}

	switch (getPullToRefreshScrollDirection()) {
		case VERTICAL:
			scrollTo(0, value);
			break;
		case HORIZONTAL:
			scrollTo(value, 0);
			break;
	}
}
 
开发者ID:ultrasonic,项目名称:ultrasonic,代码行数:46,代码来源:PullToRefreshBase.java

示例4: run

import com.handmark.pulltorefresh.library.internal.ViewCompat; //导入依赖的package包/类
@Override
public void run() {

	/**
	 * Only set mStartTime if this is the first time we're starting,
	 * else actually calculate the Y delta
	 */
	if (mStartTime == -1) {
		mStartTime = System.currentTimeMillis();
	} else {

		/**
		 * We do do all calculations in long to reduce software float
		 * calculations. We use 1000 as it gives us good accuracy and
		 * small rounding errors
		 */
		long normalizedTime = (1000 * (System.currentTimeMillis() - mStartTime)) / mDuration;
		normalizedTime = Math.max(Math.min(normalizedTime, 1000), 0);

		final int deltaY = Math.round((mScrollFromY - mScrollToY)
				* mInterpolator.getInterpolation(normalizedTime / 1000f));
		mCurrentY = mScrollFromY - deltaY;
		setHeaderScroll(mCurrentY);
	}

	// If we're not at the target Y, keep going...
	if (mContinueRunning && mScrollToY != mCurrentY) {
		ViewCompat.postOnAnimation(PullToRefreshBase.this, this);
	} else {
		if (null != mListener) {
			mListener.onSmoothScrollFinished();
		}
	}
}
 
开发者ID:ultrasonic,项目名称:ultrasonic,代码行数:35,代码来源:PullToRefreshBase.java

示例5: setHeaderScroll

import com.handmark.pulltorefresh.library.internal.ViewCompat; //导入依赖的package包/类
/**
 * Helper method which just calls scrollTo() in the correct scrolling
 * direction.
 *
 * @param value - New Scroll value
 */
protected final void setHeaderScroll(int value) {
	if (DEBUG) {
		Log.d(LOG_TAG, "setHeaderScroll: " + value);
	}

	// Clamp value to with pull scroll range
	final int maximumPullScroll = getMaximumPullScroll();
	value = Math.min(maximumPullScroll, Math.max(-maximumPullScroll, value));

	if (mLayoutVisibilityChangesEnabled) {
		if (value < 0) {
			mHeaderLayout.setVisibility(View.VISIBLE);
		} else if (value > 0) {
			mFooterLayout.setVisibility(View.VISIBLE);
		} else {
			mHeaderLayout.setVisibility(View.INVISIBLE);
			mFooterLayout.setVisibility(View.INVISIBLE);
		}
	}

	if (USE_HW_LAYERS) {
		/**
		 * Use a Hardware Layer on the Refreshable View if we've scrolled at
		 * all. We don't use them on the Header/Footer Views as they change
		 * often, which would negate any HW layer performance boost.
		 */
		ViewCompat.setLayerType(mRefreshableViewWrapper, value != 0 ? View.LAYER_TYPE_HARDWARE
				: View.LAYER_TYPE_NONE);
	}

	switch (getPullToRefreshScrollDirection()) {
		case VERTICAL:
			scrollTo(0, value);
			break;
		case HORIZONTAL:
			scrollTo(value, 0);
			break;
	}
}
 
开发者ID:liupengandroid,项目名称:ywApplication,代码行数:46,代码来源:PullToRefreshBase.java

示例6: setHeaderScroll

import com.handmark.pulltorefresh.library.internal.ViewCompat; //导入依赖的package包/类
/**
 * Helper method which just calls scrollTo() in the correct scrolling
 * direction.
 * 
 * @param value - New Scroll value
 */
protected final void setHeaderScroll(final int value) {
	if (DEBUG) {
		Log.d(LOG_TAG, "setHeaderScroll: " + value);
	}

	if (mLayoutVisibilityChangesEnabled) {
		if (value < 0) {
			mHeaderLayout.setVisibility(View.VISIBLE);
		} else if (value > 0) {
			mFooterLayout.setVisibility(View.VISIBLE);
		} else {
			mHeaderLayout.setVisibility(View.INVISIBLE);
			mFooterLayout.setVisibility(View.INVISIBLE);
		}
	}

	/**
	 * Use a Hardware Layer on the Refreshable View if we've scrolled at
	 * all. We don't use them on the Header/Footer Views as they change
	 * often, which would negate any HW layer performance boost.
	 */
	ViewCompat.setLayerType(mRefreshableViewWrapper, value != 0 ? View.LAYER_TYPE_HARDWARE : View.LAYER_TYPE_NONE);

	switch (getPullToRefreshScrollDirection()) {
		case VERTICAL:
			scrollTo(0, value);
			break;
		case HORIZONTAL:
			scrollTo(value, 0);
			break;
	}
}
 
开发者ID:scoute-dich,项目名称:K9-MailClient,代码行数:39,代码来源:PullToRefreshBase.java

示例7: setHeaderScroll

import com.handmark.pulltorefresh.library.internal.ViewCompat; //导入依赖的package包/类
/**
 * Helper method which just calls scrollTo() in the correct scrolling
 * direction.
 *
 * @param value - New Scroll value
 */
protected final void setHeaderScroll(int value) {
    if (DEBUG) {
        Log.d(LOG_TAG, "setHeaderScroll: " + value);
    }

    // Clamp value to with pull scroll range
    final int maximumPullScroll = getMaximumPullScroll();
    value = Math.min(maximumPullScroll, Math.max(-maximumPullScroll, value));

    if (mLayoutVisibilityChangesEnabled) {
        if (value < 0) {
            mHeaderLayout.setVisibility(View.VISIBLE);
        } else if (value > 0) {
            mFooterLayout.setVisibility(View.VISIBLE);
        } else {
            mHeaderLayout.setVisibility(View.INVISIBLE);
            mFooterLayout.setVisibility(View.INVISIBLE);
        }
    }

    if (USE_HW_LAYERS) {
        /**
         * Use a Hardware Layer on the Refreshable View if we've scrolled at
         * all. We don't use them on the Header/Footer Views as they change
         * often, which would negate any HW layer performance boost.
         */
        ViewCompat.setLayerType(mRefreshableViewWrapper, value != 0 ? View.LAYER_TYPE_HARDWARE
                : View.LAYER_TYPE_NONE);
    }

    switch (getPullToRefreshScrollDirection()) {
        case VERTICAL:
            scrollTo(0, value);
            break;
        case HORIZONTAL:
            scrollTo(value, 0);
            break;
    }
}
 
开发者ID:BigAppOS,项目名称:BigApp_Discuz_Android,代码行数:46,代码来源:PullToRefreshBase.java

示例8: run

import com.handmark.pulltorefresh.library.internal.ViewCompat; //导入依赖的package包/类
@Override
public void run() {

    /**
     * Only set mStartTime if this is the first time we're starting,
     * else actually calculate the Y delta
     */
    if (mStartTime == -1) {
        mStartTime = System.currentTimeMillis();
    } else {

        /**
         * We do do all calculations in long to reduce software float
         * calculations. We use 1000 as it gives us good accuracy and
         * small rounding errors
         */
        long normalizedTime = (1000 * (System.currentTimeMillis() - mStartTime)) / mDuration;
        normalizedTime = Math.max(Math.min(normalizedTime, 1000), 0);

        final int deltaY = Math.round((mScrollFromY - mScrollToY)
                * mInterpolator.getInterpolation(normalizedTime / 1000f));
        mCurrentY = mScrollFromY - deltaY;
        setHeaderScroll(mCurrentY);
    }

    // If we're not at the target Y, keep going...
    if (mContinueRunning && mScrollToY != mCurrentY) {
        ViewCompat.postOnAnimation(PullToRefreshBase.this, this);
    } else {
        if (null != mListener) {
            mListener.onSmoothScrollFinished();
        }
    }
}
 
开发者ID:BigAppOS,项目名称:BigApp_Discuz_Android,代码行数:35,代码来源:PullToRefreshBase.java

示例9: run

import com.handmark.pulltorefresh.library.internal.ViewCompat; //导入依赖的package包/类
@Override
public void run() {

    /**
     * Only set mStartTime if this is the first time we're starting,
     * else actually calculate the Y delta
     */
    if (mStartTime == -1) {
        mStartTime = System.currentTimeMillis();
    } else {

        /**
         * We do do all calculations in long to reduce software float
         * calculations. We use 1000 as it gives us good accuracy and
         * small rounding errors
         */
        long normalizedTime = (1000 * (System.currentTimeMillis() - mStartTime))
                / mDuration;
        normalizedTime = Math.max(Math.min(normalizedTime, 1000), 0);

        final int deltaY = Math.round((mScrollFromY - mScrollToY)
                * mInterpolator
                .getInterpolation(normalizedTime / 1000f));
        mCurrentY = mScrollFromY - deltaY;
        setHeaderScroll(mCurrentY);
    }

    // If we're not at the target Y, keep going...
    if (mContinueRunning && mScrollToY != mCurrentY) {
        ViewCompat.postOnAnimation(PullToRefreshBase.this, this);
    } else {
        if (null != mListener) {
            mListener.onSmoothScrollFinished();
        }
    }
}
 
开发者ID:BigAppOS,项目名称:BigApp_WordPress_Android,代码行数:37,代码来源:PullToRefreshBase.java


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