Search in sources :

Example 86 with Scroller

use of android.widget.Scroller in project JustAndroid by chinaltz.

the class HorizontalListView method initView.

private synchronized void initView() {
    mLeftViewIndex = -1;
    mRightViewIndex = 0;
    mDisplayOffset = 0;
    mCurrentX = 0;
    mNextX = 0;
    mMaxX = Integer.MAX_VALUE;
    mScroller = new Scroller(getContext());
    mGesture = new GestureDetector(getContext(), mOnGesture);
}
Also used : GestureDetector(android.view.GestureDetector) Scroller(android.widget.Scroller)

Example 87 with Scroller

use of android.widget.Scroller in project little-bear-dictionary by daimajia.

the class CustomViewAbove method initCustomViewAbove.

void initCustomViewAbove() {
    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();
    setInternalPageChangeListener(new SimpleOnPageChangeListener() {

        public void onPageSelected(int position) {
            if (mCustomViewBehind != null) {
                switch(position) {
                    case 0:
                    case 2:
                        mCustomViewBehind.setChildrenEnabled(true);
                        break;
                    case 1:
                        mCustomViewBehind.setChildrenEnabled(false);
                        break;
                }
            }
        }
    });
    final float density = context.getResources().getDisplayMetrics().density;
    mFlingDistance = (int) (MIN_DISTANCE_FOR_FLING * density);
}
Also used : Context(android.content.Context) ViewConfiguration(android.view.ViewConfiguration) Scroller(android.widget.Scroller)

Aggregations

Scroller (android.widget.Scroller)87 ViewConfiguration (android.view.ViewConfiguration)40 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)7 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