Example usage for android.support.v4.widget ScrollerCompat create

List of usage examples for android.support.v4.widget ScrollerCompat create

Introduction

In this page you can find the example usage for android.support.v4.widget ScrollerCompat create.

Prototype

public static ScrollerCompat create(Context context, Interpolator interpolator) 

Source Link

Usage

From source file:com.fangzp.daily.widget.NestedWebView.java

public NestedWebView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    mChildHelper = new NestedScrollingChildHelper(this);

    mScroller = ScrollerCompat.create(getContext(), null);

    setNestedScrollingEnabled(true);/*from  w ww  . j  av a2  s.c o m*/
}

From source file:com.ouyangzn.view.RefreshLayout.java

private void init(Context context) {
    mHeaderView = LayoutInflater.from(context).inflate(R.layout.header_refresh, this, false);
    mDragHelper = ViewDragHelper.create(this, new ViewDragCallback());
    mScroller = ScrollerCompat.create(context, sInterpolator);
    mListener = new SwipeRefreshLayout.OnRefreshListener() {
        @Override//from ww w  .j av a 2 s  . c o m
        public void onRefresh() {
            Log.w(TAG, "OnRefreshListener is null, discard");
        }
    };
}

From source file:com.shizhefei.view.largeimage.LargeImageView.java

public LargeImageView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    mScroller = ScrollerCompat.create(getContext(), null);
    scaleHelper = new ScaleHelper();
    setFocusable(true);/*from  w ww  .  java2 s  .  co m*/
    setWillNotDraw(false);
    gestureDetector = new GestureDetector(context, simpleOnGestureListener);
    scaleGestureDetector = new ScaleGestureDetector(context, onScaleGestureListener);

    imageBlockLoader = new BlockImageLoader(context);
    imageBlockLoader.setOnImageLoadListener(this);
    final ViewConfiguration configuration = ViewConfiguration.get(getContext());
    mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
    mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
}

From source file:individual.leobert.calendar.CalendarLayout.java

private void init() {

    final ViewConfiguration vc = ViewConfiguration.get(getContext());

    mMaxVelocity = vc.getScaledMaximumFlingVelocity();
    mMinVelocity = vc.getScaledMinimumFlingVelocity();
    mScroller = ScrollerCompat.create(getContext(), sInterpolator);
}

From source file:com.wordplat.ikvstockchart.InteractiveKLineView.java

public InteractiveKLineView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    viewRect = new RectF();
    viewPadding = ViewUtils.dpTopx(context, 10);

    render = new KLineRender(context);

    gestureDetector.setIsLongpressEnabled(true);

    int touchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
    gestureCompat.setTouchSlop(touchSlop);

    final Interpolator interpolator = new Interpolator() {
        public float getInterpolation(float t) {
            t -= 1.0f;//  w  w  w .  j  a va2s  . c  om
            return t * t * t * t * t + 1.0f;
        }
    };

    scroller = ScrollerCompat.create(context, interpolator);

    render.setSizeColor(ViewUtils.getSizeColor(context, attrs, defStyleAttr));
}

From source file:com.tasomaniac.openwith.resolver.ResolverDrawerLayout.java

public ResolverDrawerLayout(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ResolverDrawerLayout, defStyleAttr,
            0);/*from  ww w .  j  av  a2  s  .  com*/
    mMaxWidth = a.getDimensionPixelSize(R.styleable.ResolverDrawerLayout_resolverMaxWidth, -1);
    mMaxCollapsedHeight = a.getDimensionPixelSize(R.styleable.ResolverDrawerLayout_maxCollapsedHeight, 0);
    mMaxCollapsedHeightSmall = a.getDimensionPixelSize(R.styleable.ResolverDrawerLayout_maxCollapsedHeightSmall,
            mMaxCollapsedHeight);
    a.recycle();

    mParentHelper = new NestedScrollingParentHelper(this);

    //noinspection ResourceType
    mScroller = ScrollerCompat.create(context,
            AnimationUtils.loadInterpolator(context, android.R.interpolator.decelerate_quint));
    mVelocityTracker = VelocityTracker.obtain();

    final ViewConfiguration vc = ViewConfiguration.get(context);
    mTouchSlop = vc.getScaledTouchSlop();
    mMinFlingVelocity = vc.getScaledMinimumFlingVelocity();
}

From source file:com.hynet.mergepay.components.widget.panellayout.ViewDragHelper.java

private ViewDragHelper(Context context, ViewGroup forParent, Interpolator interpolator, Callback cb) {
    if (forParent == null) {
        throw new IllegalArgumentException("Parent view may not be null");
    }//from  w  w w  .j  av  a2 s . co  m
    if (cb == null) {
        throw new IllegalArgumentException("Callback may not be null");
    }

    mParentView = forParent;
    mCallback = cb;

    final ViewConfiguration vc = ViewConfiguration.get(context);
    final float density = context.getResources().getDisplayMetrics().density;
    mEdgeSize = (int) (EDGE_SIZE * density + 0.5f);

    mTouchSlop = vc.getScaledTouchSlop();
    mMaxVelocity = vc.getScaledMaximumFlingVelocity();
    mMinVelocity = vc.getScaledMinimumFlingVelocity();
    mScroller = ScrollerCompat.create(context, interpolator != null ? interpolator : sInterpolator);
}

From source file:com.hxqc.mall.core.views.CustomScrollView.java

private void initScrollView() {
    mScroller = ScrollerCompat.create(getContext(), null);
    setFocusable(true);//from   w  w  w  .j a va  2s.com
    setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
    setWillNotDraw(false);
    final ViewConfiguration configuration = ViewConfiguration.get(getContext());
    mTouchSlop = configuration.getScaledTouchSlop();
    mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
    mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();

}

From source file:com.apptentive.android.sdk.view.ApptentiveNestedScrollView.java

private void initScrollView() {
    //mScroller = new ScrollerCompat(getContext(), null);
    mScroller = ScrollerCompat.create(getContext(), null);
    setFocusable(true);//w  ww  . j a  v a2 s .  co m
    setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
    setWillNotDraw(false);
    final ViewConfiguration configuration = ViewConfiguration.get(getContext());
    mTouchSlop = configuration.getScaledTouchSlop();
    mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
    mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
}

From source file:com.cmbb.smartkids.widget.NestedScrollView.java

private void initScrollView() {
    mScroller = ScrollerCompat.create(getContext(), null);
    setFocusable(true);// w  w w .  j  a  va 2 s.  c  o m
    setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
    setWillNotDraw(false);
    final ViewConfiguration configuration = ViewConfiguration.get(getContext());
    mTouchSlop = configuration.getScaledTouchSlop();
    mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
    mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
}