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


Java EdgeEffectCompat.onAbsorb方法代码示例

本文整理汇总了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;
        }
    }
}
 
开发者ID:SNiels,项目名称:Multi-Mania-app,代码行数:31,代码来源:BulletStaggeredGridView.java

示例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;
        }
    }
}
 
开发者ID:SNiels,项目名称:Multi-Mania-app,代码行数:28,代码来源:StaggeredGridView.java

示例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;
        }
    }
}
 
开发者ID:asm-products,项目名称:nexus-gallery,代码行数:30,代码来源:GalleryThumbnailView.java

示例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;
        }
    }
}
 
开发者ID:GMAndroidTeam,项目名称:Android-PullToRefresh,代码行数:29,代码来源:StaggeredGridView.java

示例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;
        }
    }
}
 
开发者ID:kimkha,项目名称:Finanvita,代码行数:39,代码来源:StaggeredGridView.java

示例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);
    }
}
 
开发者ID:melvinjlobo,项目名称:WebStarter,代码行数:43,代码来源:TwoWayView.java

示例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 );
    }
}
 
开发者ID:iTwenty,项目名称:Hashtagger,代码行数:54,代码来源:TwoWayView.java

示例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);
    }
}
 
开发者ID:xiaoma1219,项目名称:netkuu.player,代码行数:43,代码来源:TwoWayView.java

示例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;
        }
    }
}
 
开发者ID:ocae,项目名称:countdown,代码行数:51,代码来源:StaggeredGridView.java


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