Search in sources :

Example 71 with Scroller

use of android.widget.Scroller in project Android-SlidingUpPanel by zzhouj.

the class SlidingUpPanel method initSlidingUpPanel.

private void initSlidingUpPanel() {
    setWillNotDraw(false);
    setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
    setFocusable(true);
    final Context context = getContext();
    final ViewConfiguration configuration = ViewConfiguration.get(context);
    final float density = context.getResources().getDisplayMetrics().density;
    mScroller = new Scroller(context, new BounceInterpolator());
    mMinimumVelocity = (int) (MIN_FLING_VELOCITY * density);
    mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
    mFlingDistance = (int) (MIN_DISTANCE_FOR_FLING * density);
    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
}
Also used : Context(android.content.Context) ViewConfiguration(android.view.ViewConfiguration) BounceInterpolator(android.view.animation.BounceInterpolator) Scroller(android.widget.Scroller)

Example 72 with Scroller

use of android.widget.Scroller in project ZXVerticalViewPager by zhaoxin1943.

the class VerticalViewPager 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);
    final float density = context.getResources().getDisplayMetrics().density;
    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
    mMinimumVelocity = (int) (MIN_FLING_VELOCITY * density);
    mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
    mTopEdge = new EdgeEffectCompat(context);
    mBottomEdge = new EdgeEffectCompat(context);
    mFlingDistance = (int) (MIN_DISTANCE_FOR_FLING * density);
    mCloseEnough = (int) (CLOSE_ENOUGH * density);
    mDefaultGutterSize = (int) (DEFAULT_GUTTER_SIZE * density);
    ViewCompat.setAccessibilityDelegate(this, new MyAccessibilityDelegate());
    if (ViewCompat.getImportantForAccessibility(this) == ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
        ViewCompat.setImportantForAccessibility(this, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);
    }
}
Also used : Context(android.content.Context) ViewConfiguration(android.view.ViewConfiguration) EdgeEffectCompat(android.support.v4.widget.EdgeEffectCompat) Scroller(android.widget.Scroller)

Example 73 with Scroller

use of android.widget.Scroller in project ABPlayer by winkstu.

the class XListView method initWithContext.

protected void initWithContext(Context context) {
    mScroller = new Scroller(context, new DecelerateInterpolator());
    // XListView need the scroll event, and it will dispatch the event to
    // user's listener (as a proxy).
    super.setOnScrollListener(this);
    // init header view
    mHeaderView = new XListViewHeader(context);
    mHeaderViewContent = (RelativeLayout) mHeaderView.findViewById(R.id.xlistview_header_content);
    mHeaderTimeView = (TextView) mHeaderView.findViewById(R.id.xlistview_header_time);
    addHeaderView(mHeaderView, null, false);
    // init footer view
    mFooterView = new XListViewFooter(context);
    // init header height
    mHeaderView.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {

        @Override
        public void onGlobalLayout() {
            mHeaderViewHeight = mHeaderViewContent.getHeight();
            System.out.println("GetmHeadViewHeight = " + mHeaderViewHeight);
            getViewTreeObserver().removeGlobalOnLayoutListener(this);
        }
    });
    // 琛ュ厖淇敼
    disablePullLoad();
    disablePullRefreash();
}
Also used : DecelerateInterpolator(android.view.animation.DecelerateInterpolator) OnGlobalLayoutListener(android.view.ViewTreeObserver.OnGlobalLayoutListener) Scroller(android.widget.Scroller)

Example 74 with Scroller

use of android.widget.Scroller in project MagicCamera by wuhaoyu1990.

the class TwoLineSeekBar 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("#ffd600"));
    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(0xc8);
    mLinePaint2 = new Paint();
    mLinePaint2.setAntiAlias(true);
    mLinePaint2.setColor(Color.parseColor("#ffffff"));
    mLinePaint2.setAlpha(0xc8);
    mHighLightLinePaint = new Paint();
    mHighLightLinePaint.setAntiAlias(true);
    mHighLightLinePaint.setColor(Color.parseColor("#ffd600"));
    mHighLightLinePaint.setAlpha(0xc8);
    mSupportSingleTap = true;
}
Also used : GestureDetector(android.view.GestureDetector) Scroller(android.widget.Scroller) Paint(android.graphics.Paint)

Example 75 with Scroller

use of android.widget.Scroller in project UltimateAndroid by cymcsg.

the class ViewPager 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);
    final float density = context.getResources().getDisplayMetrics().density;
    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
    mMinimumVelocity = (int) (MIN_FLING_VELOCITY * density);
    mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
    mLeftEdge = new EdgeEffectCompat(context);
    mRightEdge = new EdgeEffectCompat(context);
    mFlingDistance = (int) (MIN_DISTANCE_FOR_FLING * density);
    mCloseEnough = (int) (CLOSE_ENOUGH * density);
    mDefaultGutterSize = (int) (DEFAULT_GUTTER_SIZE * density);
    ViewCompat.setAccessibilityDelegate(this, new MyAccessibilityDelegate());
    if (ViewCompat.getImportantForAccessibility(this) == ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
        ViewCompat.setImportantForAccessibility(this, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);
    }
}
Also used : Context(android.content.Context) EdgeEffectCompat(android.support.v4.widget.EdgeEffectCompat) Scroller(android.widget.Scroller)

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