本文整理汇总了Java中android.support.v4.widget.EdgeEffectCompat.onAbsorb方法的典型用法代码示例。如果您正苦于以下问题:Java EdgeEffectCompat.onAbsorb方法的具体用法?Java EdgeEffectCompat.onAbsorb怎么用?Java EdgeEffectCompat.onAbsorb使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v4.widget.EdgeEffectCompat
的用法示例。
在下文中一共展示了EdgeEffectCompat.onAbsorb方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: computeScroll
import android.support.v4.widget.EdgeEffectCompat; //导入方法依赖的package包/类
@Override
public void computeScroll() {
if (mScroller.computeScrollOffset()) {
final int y = mScroller.getCurrY();
final int dy = (int) (y - mLastTouchY);
mLastTouchY = y;
final boolean stopped = !trackMotionScroll(dy, false);
if (!stopped && !mScroller.isFinished()) {
postInvalidate();
} else {
if (stopped) {
final int overScrollMode = ViewCompat.getOverScrollMode(this);
if (overScrollMode != ViewCompat.OVER_SCROLL_NEVER) {
final EdgeEffectCompat edge;
if (dy > 0) {
edge = mTopEdge;
} else {
edge = mBottomEdge;
}
edge.onAbsorb(Math.abs((int) mScroller.getCurrVelocity()));
postInvalidate();
}
mScroller.abortAnimation();
}
mTouchMode = TOUCH_MODE_IDLE;
}
}
}
示例2: computeScroll
import android.support.v4.widget.EdgeEffectCompat; //导入方法依赖的package包/类
public void computeScroll() {
if (mScroller.computeScrollOffset()) {
final int y = mScroller.getCurrY();
final int dy = (int) (y - mLastTouchY);
mLastTouchY = y;
final boolean stopped = !trackMotionScroll(dy, false);
if (!stopped && !mScroller.isFinished()) {
ViewCompat.postInvalidateOnAnimation(this);
} else {
if (stopped) {
final int overScrollMode = ViewCompat.getOverScrollMode(this);
if (overScrollMode != ViewCompat.OVER_SCROLL_NEVER) {
final EdgeEffectCompat edge;
if (dy > 0) {
edge = mTopEdge;
} else {
edge = mBottomEdge;
}
edge.onAbsorb(Math.abs((int) mScroller.getCurrVelocity()));
ViewCompat.postInvalidateOnAnimation(this);
}
mScroller.abortAnimation();
}
mTouchMode = TOUCH_MODE_IDLE;
}
}
}
示例3: computeScroll
import android.support.v4.widget.EdgeEffectCompat; //导入方法依赖的package包/类
@Override
public void computeScroll() {
if (mScroller.computeScrollOffset()) {
final int x = mScroller.getCurrX();
final int dx = (int) (x - mLastTouchX);
mLastTouchX = x;
final boolean stopped = !trackMotionScroll(dx, false);
if (!stopped && !mScroller.isFinished()) {
ViewCompat.postInvalidateOnAnimation(this);
} else {
if (stopped) {
final int overScrollMode = ViewCompat.getOverScrollMode(this);
if (overScrollMode != ViewCompat.OVER_SCROLL_NEVER) {
final EdgeEffectCompat edge;
if (dx > 0) {
edge = mLeftEdge;
} else {
edge = mRightEdge;
}
edge.onAbsorb(Math.abs((int) mScroller.getCurrVelocity()));
ViewCompat.postInvalidateOnAnimation(this);
}
mScroller.abortAnimation();
}
mTouchMode = TOUCH_MODE_IDLE;
}
}
}
示例4: computeScroll
import android.support.v4.widget.EdgeEffectCompat; //导入方法依赖的package包/类
public void computeScroll() {
if (mScroller.computeScrollOffset()) {
final int y = mScroller.getCurrY();
final int dy = (int) (y - mLastTouchY);
mLastTouchY = y;
final boolean stopped = !trackMotionScroll(dy, false);
if (!stopped && !mScroller.isFinished()) {
postInvalidate();
} else {
if (stopped) {
final int overScrollMode = ViewCompat.getOverScrollMode(this);
if (overScrollMode != ViewCompat.OVER_SCROLL_NEVER) {
final EdgeEffectCompat edge;
if (dy > 0) {
edge = mTopEdge;
} else {
edge = mBottomEdge;
}
edge.onAbsorb(Math.abs((int) mScroller.getCurrVelocity()));
postInvalidate();
}
mScroller.abortAnimation();
}
mTouchMode = TOUCH_MODE_IDLE;
}
}
}
示例5: computeScroll
import android.support.v4.widget.EdgeEffectCompat; //导入方法依赖的package包/类
public void computeScroll()
{
if (mScroller.computeScrollOffset())
{
final int y = mScroller.getCurrY();
final int dy = (int) (y - mLastTouchY);
mLastTouchY = y;
final boolean stopped = !trackMotionScroll(dy, false);
if (!stopped && !mScroller.isFinished())
{
postInvalidate();
}
else
{
if (stopped)
{
final int overScrollMode = ViewCompat.getOverScrollMode(this);
if (overScrollMode != ViewCompat.OVER_SCROLL_NEVER)
{
final EdgeEffectCompat edge;
if (dy > 0)
{
edge = mTopEdge;
}
else
{
edge = mBottomEdge;
}
edge.onAbsorb(Math.abs((int) mScroller.getCurrVelocity()));
postInvalidate();
}
mScroller.abortAnimation();
}
mTouchMode = TOUCH_MODE_IDLE;
}
}
}
示例6: computeScroll
import android.support.v4.widget.EdgeEffectCompat; //导入方法依赖的package包/类
@Override
public void computeScroll() {
if (!mScroller.computeScrollOffset()) {
return;
}
final int pos;
if (mIsVertical) {
pos = mScroller.getCurrY();
} else {
pos = mScroller.getCurrX();
}
final int diff = (int) (pos - mLastTouchPos);
mLastTouchPos = pos;
final boolean stopped = scrollListItemsBy(diff);
if (!stopped && !mScroller.isFinished()) {
ViewCompat.postInvalidateOnAnimation(this);
} else {
if (stopped) {
final int overScrollMode = ViewCompat.getOverScrollMode(this);
if (overScrollMode != ViewCompat.OVER_SCROLL_NEVER) {
final EdgeEffectCompat edge =
(diff > 0 ? mStartEdge : mEndEdge);
boolean needsInvalidate =
edge.onAbsorb(Math.abs((int) getCurrVelocity()));
if (needsInvalidate) {
ViewCompat.postInvalidateOnAnimation(this);
}
}
finishSmoothScrolling();
}
mTouchMode = TOUCH_MODE_REST;
reportScrollStateChange(OnScrollListener.SCROLL_STATE_IDLE);
}
}
示例7: computeScroll
import android.support.v4.widget.EdgeEffectCompat; //导入方法依赖的package包/类
@Override
public void computeScroll()
{
if ( !mScroller.computeScrollOffset() )
{
return;
}
final int pos;
if ( mIsVertical )
{
pos = mScroller.getCurrY();
}
else
{
pos = mScroller.getCurrX();
}
final int diff = ( int ) ( pos - mLastTouchPos );
mLastTouchPos = pos;
final boolean stopped = scrollListItemsBy( diff );
if ( !stopped && !mScroller.isFinished() )
{
ViewCompat.postInvalidateOnAnimation( this );
}
else
{
if ( stopped )
{
final int overScrollMode = ViewCompat.getOverScrollMode( this );
if ( overScrollMode != ViewCompat.OVER_SCROLL_NEVER )
{
final EdgeEffectCompat edge =
( diff > 0 ? mStartEdge : mEndEdge );
boolean needsInvalidate =
edge.onAbsorb( Math.abs( ( int ) getCurrVelocity() ) );
if ( needsInvalidate )
{
ViewCompat.postInvalidateOnAnimation( this );
}
}
mScroller.abortAnimation();
}
mTouchMode = TOUCH_MODE_REST;
reportScrollStateChange( OnScrollListener.SCROLL_STATE_IDLE );
}
}
示例8: computeScroll
import android.support.v4.widget.EdgeEffectCompat; //导入方法依赖的package包/类
@Override
public void computeScroll() {
if (!mScroller.computeScrollOffset()) {
return;
}
final int pos;
if (mIsVertical) {
pos = mScroller.getCurrY();
} else {
pos = mScroller.getCurrX();
}
final int diff = (int) (pos - mLastTouchPos);
mLastTouchPos = pos;
final boolean stopped = scrollListItemsBy(diff);
if (!stopped && !mScroller.isFinished()) {
ViewCompat.postInvalidateOnAnimation(this);
} else {
if (stopped) {
final int overScrollMode = ViewCompat.getOverScrollMode(this);
if (overScrollMode != ViewCompat.OVER_SCROLL_NEVER) {
final EdgeEffectCompat edge =
(diff > 0 ? mStartEdge : mEndEdge);
boolean needsInvalidate =
edge.onAbsorb(Math.abs((int) getCurrVelocity()));
if (needsInvalidate) {
ViewCompat.postInvalidateOnAnimation(this);
}
}
mScroller.abortAnimation();
}
mTouchMode = TOUCH_MODE_REST;
reportScrollStateChange(OnScrollListener.SCROLL_STATE_IDLE);
}
}
示例9: computeScroll
import android.support.v4.widget.EdgeEffectCompat; //导入方法依赖的package包/类
@Override
public void computeScroll() {
if (mTouchMode == TOUCH_MODE_OVERFLING) {
handleOverfling();
} else if (mScroller.computeScrollOffset()) {
final int overScrollMode = ViewCompat.getOverScrollMode(this);
final boolean supportsOverscroll = overScrollMode != ViewCompat.OVER_SCROLL_NEVER;
final int y = mScroller.getCurrY();
final int dy = (int) (y - mLastTouchY);
// TODO: Figure out why mLastTouchY is being updated here. Consider using a new class
// variable since this value does not represent the last place on the screen where a
// touch occurred.
mLastTouchY = y;
// Check if the top of the motion view is where it is
// supposed to be
final View motionView = supportsOverscroll &&
getChildCount() > 0 ? getChildAt(0) : null;
final int motionViewPrevTop = motionView != null ? motionView.getTop() : 0;
final boolean stopped = !trackMotionScroll(dy, false);
if (!stopped && !mScroller.isFinished()) {
mTouchMode = TOUCH_MODE_IDLE;
ViewCompat.postInvalidateOnAnimation(this);
} else if (stopped && dy != 0 && supportsOverscroll) {
// Check to see if we have bumped into the scroll limit
if (motionView != null) {
final int motionViewRealTop = motionView.getTop();
// Apply overscroll
final int overscroll = -dy - (motionViewRealTop - motionViewPrevTop);
overScrollBy(0, overscroll, 0, getScrollY(), 0, 0, 0, mOverscrollDistance,
true);
}
final EdgeEffectCompat edge;
if (dy > 0) {
edge = mTopEdge;
mBottomEdge.finish();
} else {
edge = mBottomEdge;
mTopEdge.finish();
}
edge.onAbsorb(Math.abs((int) mScroller.getCurrVelocity()));
if (mScroller.computeScrollOffset()) {
mScroller.notifyVerticalEdgeReached(getScrollY(), 0, mOverscrollDistance);
}
mTouchMode = TOUCH_MODE_OVERFLING;
ViewCompat.postInvalidateOnAnimation(this);
} else {
mTouchMode = TOUCH_MODE_IDLE;
}
}
}