Example usage for android.widget Scroller Scroller

List of usage examples for android.widget Scroller Scroller

Introduction

In this page you can find the example usage for android.widget Scroller Scroller.

Prototype

public Scroller(Context context, Interpolator interpolator) 

Source Link

Document

Create a Scroller with the specified interpolator.

Usage

From source file:com.coco.rolldigitaltextview.RollDigitalTextView.java

private void initRollDigitalTextView() {
    final Context context = getContext();
    mScroller = new Scroller(context, new LinearInterpolator());
}

From source file:com.coco.blinktextview.BlinkTextView.java

private void initBlinkTextView() {
    final Context context = getContext();
    mScroller = new Scroller(context, new LinearInterpolator());
    mCurrentAlpha = MAX_ALPHA;/*w w  w.  j a v  a2s  . co  m*/
}

From source file:jiajun.threelevelistview.layout.FlingLayout.java

public void init(Context context) {
    version = android.os.Build.VERSION.SDK_INT;
    mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
    mScroller = new Scroller(context, new DecelerateInterpolator());
    mParentHelper = new NestedScrollingParentHelper(this);
    mChildHelper = new NestedScrollingChildHelper(this);
}

From source file:com.coco.flowimageview.FlowImageView.java

private void initFlowImageView() {
    setScaleType(ImageView.ScaleType.MATRIX);

    final Context context = getContext();
    final float density = context.getResources().getDisplayMetrics().density;

    mMinFlowVelocity = MIN_FLOW_VELOCITY * density;
    mFlowVelocity = DEFAULT_FLOW_VELOCITY * density;

    mScroller = new Scroller(context, new LinearInterpolator());
}

From source file:com.shine.lottie.AbstractStepperActivity.java

private void setViewPagerScroller() {
    //noinspection TryWithIdenticalCatches
    try {/*from  ww w  .j a v a2 s.c  om*/
        Field scrollerField = ViewPager.class.getDeclaredField("mScroller");
        scrollerField.setAccessible(true);
        Field interpolator = ViewPager.class.getDeclaredField("sInterpolator");
        interpolator.setAccessible(true);

        Scroller scroller = new Scroller(this, (Interpolator) interpolator.get(null)) {
            @Override
            public void startScroll(int startX, int startY, int dx, int dy, int duration) {
                //Change Scroll Speed
                super.startScroll(startX, startY, dx, dy, duration * 10);
            }
        };
        scrollerField.set(viewPager, scroller);
    } catch (NoSuchFieldException e) {
        // Do nothing.
    } catch (IllegalAccessException e) {
        // Do nothing.
    }
}

From source file:com.cocarechina.pullrefreshview.layout.FlingLayout.java

public void init(Context context) {
    version = android.os.Build.VERSION.SDK_INT;
    mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
    mScroller = new Scroller(context, new AccelerateDecelerateInterpolator());
    mParentHelper = new NestedScrollingParentHelper(this);
    mChildHelper = new NestedScrollingChildHelper(this);
}

From source file:com.kayac.slidingmenu.ui.views.DraggableLayout.java

@TargetApi(13)
private void init(Context context) {
    mContext = context;/*from   ww w  . jav a  2 s.  c  om*/
    screenSize = getScreenSize(context);
    Log.d(TAG, "Screen width" + screenSize.x);
    mScroller = new Scroller(mContext, new LinearInterpolator());
    mHandler = new Handler();
    mPaint = new Paint();
    mPaint.setColor(color.background_dark);
    mBlackShadowRect = new Rect(screenSize.x, 0, 2 * screenSize.x, screenSize.y);
}

From source file:io.github.sin3hz.fastjumper.FastJumperDecoration.java

private void setupScroller() {
    mThumbScroller = new Scroller(mRecyclerView.getContext(), SCROLL_SETTLE_INTERPOLATOR);
    mSpeedPerPixel = ScrollerHelper// ww w .j a v  a  2s .  c o  m
            .calculateSpeedPerPixel(mRecyclerView.getContext().getResources().getDisplayMetrics());
}

From source file:com.dat.towerofhanoi.draggablerecyclerview.BoardView.java

@Override
protected void onFinishInflate() {
    super.onFinishInflate();
    Resources res = getResources();
    boolean isPortrait = res.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT;
    if (isPortrait) {
        mColumnWidth = (int) (res.getDisplayMetrics().widthPixels * 0.87);
    } else {/*from  w  w w. ja  v a  2  s. c  o m*/
        mColumnWidth = (int) (res.getDisplayMetrics().density * 320);
    }

    mGestureDetector = new GestureDetector(getContext(), new GestureListener());
    mScroller = new Scroller(getContext(), new DecelerateInterpolator(1.1f));
    mAutoScroller = new AutoScroller(getContext(), this);
    mAutoScroller.setAutoScrollMode(snapToColumnWhenDragging() ? AutoScroller.AutoScrollMode.COLUMN
            : AutoScroller.AutoScrollMode.POSITION);
    mDragItem = new DragItem(getContext());

    mRootLayout = new FrameLayout(getContext());
    mRootLayout.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT));

    mColumnLayout = new LinearLayout(getContext());
    mColumnLayout.setOrientation(LinearLayout.HORIZONTAL);
    mColumnLayout.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT));
    mColumnLayout.setMotionEventSplittingEnabled(false);

    mRootLayout.addView(mColumnLayout);
    mRootLayout.addView(mDragItem.getDragItemView());
    addView(mRootLayout);
}

From source file:com.woxthebox.draglistview.KanbanBoardView.java

@Override
protected void onFinishInflate() {
    super.onFinishInflate();
    Resources res = getResources();
    boolean isPortrait = res.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT;
    if (isPortrait) {
        mColumnWidth = (int) (res.getDisplayMetrics().widthPixels);
    } else {//from  w w  w  . jav a  2 s  .c  o m
        mColumnWidth = (int) (res.getDisplayMetrics().density * 320);
    }

    mGestureDetector = new GestureDetector(getContext(), new GestureListener());
    mColumnGestureListener = new ColumnGestureListener();
    mColumnGestureDetector = new GestureDetector(getContext(), mColumnGestureListener);
    mScroller = new Scroller(getContext(), new DecelerateInterpolator(1.1f));
    mAutoScroller = new AutoScroller(getContext(), this);
    mAutoScroller.setAutoScrollMode(snapToColumnWhenDragging() ? AutoScroller.AutoScrollMode.COLUMN
            : AutoScroller.AutoScrollMode.POSITION);
    mDragItem = new DragItem(getContext());

    mRootLayout = new FrameLayout(getContext());
    mRootLayout.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT));

    mColumnLayout = new LinearLayout(getContext());
    mColumnLayout.setOrientation(LinearLayout.HORIZONTAL);
    mColumnLayout.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT));
    mColumnLayout.setMotionEventSplittingEnabled(false);

    mRootLayout.addView(mColumnLayout);
    mRootLayout.addView(mDragItem.getDragItemView());
    addView(mRootLayout);
}