Search in sources :

Example 66 with Scroller

use of android.widget.Scroller in project ignition by mttkay.

the class ScrollingTextView method setup.

private void setup(Context context) {
    scroller = new Scroller(context, new LinearInterpolator());
    setScroller(scroller);
}
Also used : LinearInterpolator(android.view.animation.LinearInterpolator) Scroller(android.widget.Scroller)

Example 67 with Scroller

use of android.widget.Scroller in project QLibrary by DragonsQC.

the class QLazyViewPager method initViewPager.

void initViewPager() {
    setWillNotDraw(false);
    setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
    setFocusable(true);
    final Context context = getContext();
    mScroller = new Scroller(context, sInterpolator);
    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
    mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
    mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
    mLeftEdge = new EdgeEffectCompat(context);
    mRightEdge = new EdgeEffectCompat(context);
    float density = context.getResources().getDisplayMetrics().density;
    mBaseLineFlingVelocity = 2500.0f * density;
    mFlingVelocityInfluence = 0.4f;
}
Also used : Context(android.content.Context) ViewConfiguration(android.view.ViewConfiguration) EdgeEffectCompat(android.support.v4.widget.EdgeEffectCompat) Scroller(android.widget.Scroller)

Example 68 with Scroller

use of android.widget.Scroller in project Notes by Elder-Wu.

the class Banner method setDefaultDuration.

/**
     * 利用反射原理来改变ViewPager页面切换时间
     * <p>
     * android动画差值器使用方法
     *
     * @link 博客地址:http://blog.csdn.net/sun_star1chen/article/details/12843741
     */
private void setDefaultDuration() {
    try {
        Field field = ViewPager.class.getDeclaredField("mScroller");
        field.setAccessible(true);
        Scroller scroller = new Scroller(getContext(), new LinearInterpolator()) {

            @Override
            public void startScroll(int startX, int startY, int dx, int dy, int duration) {
                super.startScroll(startX, startY, dx, dy, SCROLL_DURATION);
            }

            @Override
            public void startScroll(int startX, int startY, int dx, int dy) {
                super.startScroll(startX, startY, dx, dy, SCROLL_DURATION);
            }
        };
        field.set(mViewPager, scroller);
    } catch (NoSuchFieldException e) {
        e.printStackTrace();
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    }
}
Also used : Field(java.lang.reflect.Field) LinearInterpolator(android.view.animation.LinearInterpolator) Scroller(android.widget.Scroller)

Example 69 with Scroller

use of android.widget.Scroller in project custom-swipelistview by xyczero.

the class CustomSwipeListView method initCustomSwipeListView.

private void initCustomSwipeListView() {
    final Context context = getContext();
    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
    mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
    // set minimum velocity according to the MIN_VELOCITY.
    mMinimumVelocity = CustomSwipeUtils.convertDptoPx(context, MIN_VELOCITY);
    mScreenWidth = CustomSwipeUtils.getScreenWidth(context);
    mScroller = new Scroller(context);
    initSwipeItemTriggerDeltaX();
    // set default value.
    mCurTouchSwipeMode = TOUCH_SWIPE_NONE;
    mCurSelectedPosition = INVALID_POSITION;
}
Also used : Context(android.content.Context) ViewConfiguration(android.view.ViewConfiguration) Scroller(android.widget.Scroller)

Example 70 with Scroller

use of android.widget.Scroller in project PhotoNoter by yydcdut.

the class PGEditSeekBar method init.

private void init() {
    mScroller = new Scroller(getContext());
    mGestureListener = new SeekBarGestureListener();
    mGestureDetector = new GestureDetector(getContext(), mGestureListener);
    mNailPaint = new Paint();
    mNailPaint.setAntiAlias(true);
    mNailPaint.setColor(Color.parseColor("#ffe049"));
    mNailPaint.setStrokeWidth(mNailStrokeWidth);
    mNailPaint.setStyle(Paint.Style.STROKE);
    mThumbPaint = new Paint();
    mThumbPaint.setAntiAlias(true);
    mThumbPaint.setColor(Color.parseColor("#ffffff"));
    mThumbPaint.setStyle(Paint.Style.FILL);
    mLinePaint1 = new Paint();
    mLinePaint1.setAntiAlias(true);
    mLinePaint1.setColor(Color.parseColor("#ffffff"));
    mLinePaint1.setAlpha(200);
    mLinePaint2 = new Paint();
    mLinePaint2.setAntiAlias(true);
    mLinePaint2.setColor(Color.parseColor("#ffffff"));
    mLinePaint2.setAlpha(200);
    mHighLightLinePaint = new Paint();
    mHighLightLinePaint.setAntiAlias(true);
    mHighLightLinePaint.setColor(Color.parseColor("#ffe049"));
    mHighLightLinePaint.setAlpha(200);
}
Also used : GestureDetector(android.view.GestureDetector) Scroller(android.widget.Scroller) Paint(android.graphics.Paint)

Aggregations

Scroller (android.widget.Scroller)89 ViewConfiguration (android.view.ViewConfiguration)41 Context (android.content.Context)29 Paint (android.graphics.Paint)14 EdgeEffectCompat (android.support.v4.widget.EdgeEffectCompat)14 GestureDetector (android.view.GestureDetector)13 Rect (android.graphics.Rect)12 Point (android.graphics.Point)8 DecelerateInterpolator (android.view.animation.DecelerateInterpolator)8 DisplayMetrics (android.util.DisplayMetrics)6 View (android.view.View)4 OnGlobalLayoutListener (android.view.ViewTreeObserver.OnGlobalLayoutListener)4 BounceInterpolator (android.view.animation.BounceInterpolator)4 Interpolator (android.view.animation.Interpolator)4 SuppressLint (android.annotation.SuppressLint)3 TypedArray (android.content.res.TypedArray)3 LinearInterpolator (android.view.animation.LinearInterpolator)3 ImageView (android.widget.ImageView)3 OverScroller (android.widget.OverScroller)3 Animator (com.nineoldandroids.animation.Animator)3