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) 

Source Link

Document

Create a Scroller with the default duration and interpolator.

Usage

From source file:com.aliasapps.seq.scroller.TwoWayView.java

public TwoWayView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    mNeedSync = false;//  ww  w. j  a v a2 s.co m
    mVelocityTracker = null;

    mLayoutMode = LAYOUT_NORMAL;
    mTouchMode = TOUCH_MODE_REST;
    mLastTouchMode = TOUCH_MODE_UNKNOWN;

    mIsAttached = false;

    mContextMenuInfo = null;

    mOnScrollListener = null;
    mLastScrollState = OnScrollListener.SCROLL_STATE_IDLE;

    final ViewConfiguration vc = ViewConfiguration.get(context);
    mTouchSlop = vc.getScaledTouchSlop();
    mMaximumVelocity = vc.getScaledMaximumFlingVelocity();
    mFlingVelocity = vc.getScaledMinimumFlingVelocity();
    mOverscrollDistance = getScaledOverscrollDistance(vc);

    mOverScroll = 0;

    mScroller = new Scroller(context);

    mIsVertical = true;

    mItemsCanFocus = false;

    mTempRect = new Rect();

    mArrowScrollFocusResult = new ArrowScrollFocusResult();

    mSelectorPosition = INVALID_POSITION;

    mSelectorRect = new Rect();
    mSelectedStart = 0;

    mResurrectToPosition = INVALID_POSITION;

    mSelectedStart = 0;
    mNextSelectedPosition = INVALID_POSITION;
    mNextSelectedRowId = INVALID_ROW_ID;
    mSelectedPosition = INVALID_POSITION;
    mSelectedRowId = INVALID_ROW_ID;
    mOldSelectedPosition = INVALID_POSITION;
    mOldSelectedRowId = INVALID_ROW_ID;

    mChoiceMode = ChoiceMode.NONE;
    mCheckedItemCount = 0;
    mCheckedIdStates = null;
    mCheckStates = null;

    mRecycler = new RecycleBin();
    mDataSetObserver = null;

    mAreAllItemsSelectable = true;

    mStartEdge = null;
    mEndEdge = null;

    setClickable(true);
    setFocusableInTouchMode(true);
    setWillNotDraw(false);
    setAlwaysDrawnWithCacheEnabled(false);
    setWillNotDraw(false);
    setClipToPadding(false);

    ViewCompat.setOverScrollMode(this, ViewCompat.OVER_SCROLL_IF_CONTENT_SCROLLS);

    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.TwoWayView, defStyle, 0);
    initializeScrollbars(a);

    mDrawSelectorOnTop = a.getBoolean(R.styleable.TwoWayView_android_drawSelectorOnTop, false);

    Drawable d = a.getDrawable(R.styleable.TwoWayView_android_listSelector);
    if (d != null) {
        setSelector(d);
    }

    int orientation = a.getInt(R.styleable.TwoWayView_android_orientation, -1);
    if (orientation >= 0) {
        setOrientation(Orientation.values()[orientation]);
    }

    int choiceMode = a.getInt(R.styleable.TwoWayView_android_choiceMode, -1);
    if (choiceMode >= 0) {
        setChoiceMode(ChoiceMode.values()[choiceMode]);
    }

    a.recycle();

    updateScrollbarsDirection();
}

From source file:com.runmit.sweedee.view.DirectListView.java

public DirectListView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    mNeedSync = false;//from www .  j  a  va 2  s  .c om
    mVelocityTracker = null;

    mLayoutMode = LAYOUT_NORMAL;
    mTouchMode = TOUCH_MODE_REST;
    mLastTouchMode = TOUCH_MODE_UNKNOWN;

    mIsAttached = false;

    mContextMenuInfo = null;

    mOnScrollListener = null;
    mLastScrollState = OnScrollListener.SCROLL_STATE_IDLE;

    final ViewConfiguration vc = ViewConfiguration.get(context);
    mTouchSlop = vc.getScaledTouchSlop();
    mMaximumVelocity = vc.getScaledMaximumFlingVelocity();
    mFlingVelocity = vc.getScaledMinimumFlingVelocity();
    mOverscrollDistance = getScaledOverscrollDistance(vc);

    mOverScroll = 0;

    mScroller = new Scroller(context);

    mIsVertical = true;

    mItemsCanFocus = false;

    mTempRect = new Rect();

    mArrowScrollFocusResult = new ArrowScrollFocusResult();

    mSelectorPosition = INVALID_POSITION;

    mSelectorRect = new Rect();
    mSelectedStart = 0;

    mResurrectToPosition = INVALID_POSITION;

    mSelectedStart = 0;
    mNextSelectedPosition = INVALID_POSITION;
    mNextSelectedRowId = INVALID_ROW_ID;
    mSelectedPosition = INVALID_POSITION;
    mSelectedRowId = INVALID_ROW_ID;
    mOldSelectedPosition = INVALID_POSITION;
    mOldSelectedRowId = INVALID_ROW_ID;

    mChoiceMode = ChoiceMode.NONE;
    mCheckedItemCount = 0;
    mCheckedIdStates = null;
    mCheckStates = null;

    mRecycler = new RecycleBin();
    mDataSetObserver = null;

    mAreAllItemsSelectable = true;

    mStartEdge = null;
    mEndEdge = null;

    setClickable(true);
    setFocusableInTouchMode(true);
    setWillNotDraw(false);
    setAlwaysDrawnWithCacheEnabled(false);
    setWillNotDraw(false);
    setClipToPadding(false);

    ViewCompat.setOverScrollMode(this, ViewCompat.OVER_SCROLL_IF_CONTENT_SCROLLS);

    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.DirectListView, defStyle, 0);

    mDrawSelectorOnTop = a.getBoolean(R.styleable.DirectListView_android_drawSelectorOnTop, false);

    Drawable d = a.getDrawable(R.styleable.DirectListView_android_listSelector);
    if (d != null) {
        setSelector(d);
    }

    int orientation = a.getInt(R.styleable.DirectListView_android_orientation, -1);
    if (orientation >= 0) {
        setOrientation(Orientation.values()[orientation]);
    }

    int choiceMode = a.getInt(R.styleable.DirectListView_android_choiceMode, -1);
    if (choiceMode >= 0) {
        setChoiceMode(ChoiceMode.values()[choiceMode]);
    }

    a.recycle();

    updateScrollbarsDirection();
}

From source file:com.kinth.mmspeed.ui.TwoWayView.java

public TwoWayView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    mNeedSync = false;/* w  w  w  .ja  v  a  2  s.com*/
    mVelocityTracker = null;

    mLayoutMode = LAYOUT_NORMAL;
    mTouchMode = TOUCH_MODE_REST;
    mLastTouchMode = TOUCH_MODE_UNKNOWN;

    mIsAttached = false;

    mContextMenuInfo = null;

    mOnScrollListener = null;
    mLastScrollState = OnScrollListener.SCROLL_STATE_IDLE;

    final ViewConfiguration vc = ViewConfiguration.get(context);
    mTouchSlop = vc.getScaledTouchSlop();
    mMaximumVelocity = vc.getScaledMaximumFlingVelocity();
    mFlingVelocity = vc.getScaledMinimumFlingVelocity();
    mOverscrollDistance = getScaledOverscrollDistance(vc);

    mOverScroll = 0;

    mScroller = new Scroller(context);

    mIsVertical = true;

    mItemsCanFocus = false;

    mTempRect = new Rect();

    mArrowScrollFocusResult = new ArrowScrollFocusResult();

    mSelectorPosition = INVALID_POSITION;

    mSelectorRect = new Rect();
    mSelectedStart = 0;

    mResurrectToPosition = INVALID_POSITION;

    mSelectedStart = 0;
    mNextSelectedPosition = INVALID_POSITION;
    mNextSelectedRowId = INVALID_ROW_ID;
    mSelectedPosition = INVALID_POSITION;
    mSelectedRowId = INVALID_ROW_ID;
    mOldSelectedPosition = INVALID_POSITION;
    mOldSelectedRowId = INVALID_ROW_ID;

    mChoiceMode = ChoiceMode.NONE;
    mCheckedItemCount = 0;
    mCheckedIdStates = null;
    mCheckStates = null;

    mRecycler = new RecycleBin();
    mDataSetObserver = null;

    mAreAllItemsSelectable = true;

    mStartEdge = null;
    mEndEdge = null;

    setClickable(true);
    setFocusableInTouchMode(true);
    setWillNotDraw(false);
    setAlwaysDrawnWithCacheEnabled(false);
    setWillNotDraw(false);
    setClipToPadding(false);

    ViewCompat.setOverScrollMode(this, ViewCompat.OVER_SCROLL_IF_CONTENT_SCROLLS);

    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.TwoWayView, defStyle, 0);
    //      initializeScrollbars(a); 

    mDrawSelectorOnTop = a.getBoolean(R.styleable.TwoWayView_android_drawSelectorOnTop, false);

    Drawable d = a.getDrawable(R.styleable.TwoWayView_android_listSelector);
    if (d != null) {
        setSelector(d);
    }

    int orientation = a.getInt(R.styleable.TwoWayView_android_orientation, -1);
    if (orientation >= 0) {
        setOrientation(Orientation.values()[orientation]);
    }

    int choiceMode = a.getInt(R.styleable.TwoWayView_android_choiceMode, -1);
    if (choiceMode >= 0) {
        setChoiceMode(ChoiceMode.values()[choiceMode]);
    }

    a.recycle();

    updateScrollbarsDirection();
}

From source file:com.cmg.android.cmgpdf.view.TwoWayView.java

public TwoWayView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    mNeedSync = false;//from   ww  w  .j  a  v a 2s . c o m
    mVelocityTracker = null;

    mLayoutMode = LAYOUT_NORMAL;
    mTouchMode = TOUCH_MODE_REST;
    mLastTouchMode = TOUCH_MODE_UNKNOWN;

    mIsAttached = false;

    mContextMenuInfo = null;

    mOnScrollListener = null;
    mLastScrollState = OnScrollListener.SCROLL_STATE_IDLE;

    final ViewConfiguration vc = ViewConfiguration.get(context);
    mTouchSlop = vc.getScaledTouchSlop();
    mMaximumVelocity = vc.getScaledMaximumFlingVelocity();
    mFlingVelocity = vc.getScaledMinimumFlingVelocity();
    mOverscrollDistance = getScaledOverscrollDistance(vc);

    mOverScroll = 0;

    mScroller = new Scroller(context);

    mIsVertical = true;

    mItemsCanFocus = false;

    mTempRect = new Rect();

    mArrowScrollFocusResult = new ArrowScrollFocusResult();

    mSelectorPosition = INVALID_POSITION;

    mSelectorRect = new Rect();
    mSelectedStart = 0;

    mResurrectToPosition = INVALID_POSITION;

    mSelectedStart = 0;
    mNextSelectedPosition = INVALID_POSITION;
    mNextSelectedRowId = INVALID_ROW_ID;
    mSelectedPosition = INVALID_POSITION;
    mSelectedRowId = INVALID_ROW_ID;
    mOldSelectedPosition = INVALID_POSITION;
    mOldSelectedRowId = INVALID_ROW_ID;

    mChoiceMode = ChoiceMode.NONE;
    mCheckedItemCount = 0;
    mCheckedIdStates = null;
    mCheckStates = null;

    mRecycler = new RecycleBin();
    mDataSetObserver = null;

    mAreAllItemsSelectable = true;

    mStartEdge = null;
    mEndEdge = null;

    setClickable(true);
    setFocusableInTouchMode(true);
    setWillNotDraw(false);
    setAlwaysDrawnWithCacheEnabled(false);
    setWillNotDraw(false);
    setClipToPadding(false);

    ViewCompat.setOverScrollMode(this, ViewCompat.OVER_SCROLL_IF_CONTENT_SCROLLS);

    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.TwoWayView, defStyle, 0);
    //initializeScrollbars(a);

    mDrawSelectorOnTop = a.getBoolean(R.styleable.TwoWayView_android_drawSelectorOnTop, false);

    Drawable d = a.getDrawable(R.styleable.TwoWayView_android_listSelector);
    if (d != null) {
        setSelector(d);
    }

    int orientation = a.getInt(R.styleable.TwoWayView_android_orientation, -1);
    if (orientation >= 0) {
        setOrientation(Orientation.values()[orientation]);
    }

    int choiceMode = a.getInt(R.styleable.TwoWayView_android_choiceMode, -1);
    if (choiceMode >= 0) {
        setChoiceMode(ChoiceMode.values()[choiceMode]);
    }

    a.recycle();

    updateScrollbarsDirection();
}

From source file:com.ruyigu.freeart.ui.widget.HorizontalListView.java

public HorizontalListView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    mNeedSync = false;//from ww w  .j a v a2s . co  m
    mVelocityTracker = null;

    mLayoutMode = LAYOUT_NORMAL;
    mTouchMode = TOUCH_MODE_REST;
    mLastTouchMode = TOUCH_MODE_UNKNOWN;

    mIsAttached = false;

    mContextMenuInfo = null;

    mOnScrollListener = null;
    mLastScrollState = OnScrollListener.SCROLL_STATE_IDLE;

    final ViewConfiguration vc = ViewConfiguration.get(context);
    mTouchSlop = vc.getScaledTouchSlop();
    mMaximumVelocity = vc.getScaledMaximumFlingVelocity();
    mFlingVelocity = vc.getScaledMinimumFlingVelocity();
    mOverscrollDistance = getScaledOverscrollDistance(vc);

    mOverScroll = 0;

    mScroller = new Scroller(context);

    mIsVertical = true;

    mItemsCanFocus = false;

    mTempRect = new Rect();

    mArrowScrollFocusResult = new ArrowScrollFocusResult();

    mSelectorPosition = INVALID_POSITION;

    mSelectorRect = new Rect();
    mSelectedStart = 0;

    mResurrectToPosition = INVALID_POSITION;

    mSelectedStart = 0;
    mNextSelectedPosition = INVALID_POSITION;
    mNextSelectedRowId = INVALID_ROW_ID;
    mSelectedPosition = INVALID_POSITION;
    mSelectedRowId = INVALID_ROW_ID;
    mOldSelectedPosition = INVALID_POSITION;
    mOldSelectedRowId = INVALID_ROW_ID;

    mChoiceMode = ChoiceMode.NONE;
    mCheckedItemCount = 0;
    mCheckedIdStates = null;
    mCheckStates = null;

    mRecycler = new RecycleBin();
    mDataSetObserver = null;

    mAreAllItemsSelectable = true;

    mStartEdge = null;
    mEndEdge = null;

    setClickable(true);
    setFocusableInTouchMode(true);
    setWillNotDraw(false);
    setAlwaysDrawnWithCacheEnabled(false);
    setWillNotDraw(false);
    setClipToPadding(false);

    ViewCompat.setOverScrollMode(this, ViewCompat.OVER_SCROLL_IF_CONTENT_SCROLLS);

    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.HorizontalListView, defStyle, 0);
    //        initializeScrollbars(a);

    mDrawSelectorOnTop = a.getBoolean(R.styleable.HorizontalListView_android_drawSelectorOnTop, false);

    Drawable d = a.getDrawable(R.styleable.HorizontalListView_android_listSelector);
    if (d != null) {
        setSelector(d);
    }

    int orientation = a.getInt(R.styleable.HorizontalListView_android_orientation, -1);
    if (orientation >= 0) {
        setOrientation(Orientation.values()[orientation]);
    }

    int choiceMode = a.getInt(R.styleable.HorizontalListView_android_choiceMode, -1);
    if (choiceMode >= 0) {
        setChoiceMode(ChoiceMode.values()[choiceMode]);
    }

    a.recycle();

    updateScrollbarsDirection();
}

From source file:com.artifex.mupdf.view.ThumbnailViews.java

public ThumbnailViews(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    mNeedSync = false;/*  w w w  . java2 s .c o  m*/
    mVelocityTracker = null;

    mLayoutMode = LAYOUT_NORMAL;
    mTouchMode = TOUCH_MODE_REST;
    mLastTouchMode = TOUCH_MODE_UNKNOWN;

    mIsAttached = false;

    mContextMenuInfo = null;

    mOnScrollListener = null;
    mLastScrollState = OnScrollListener.SCROLL_STATE_IDLE;

    final ViewConfiguration vc = ViewConfiguration.get(context);
    mTouchSlop = vc.getScaledTouchSlop();
    mMaximumVelocity = vc.getScaledMaximumFlingVelocity();
    mFlingVelocity = vc.getScaledMinimumFlingVelocity();
    mOverscrollDistance = getScaledOverscrollDistance(vc);

    mOverScroll = 0;

    mScroller = new Scroller(context);

    mIsVertical = true;

    mItemsCanFocus = false;

    mTempRect = new Rect();

    mArrowScrollFocusResult = new ArrowScrollFocusResult();

    mSelectorPosition = INVALID_POSITION;

    mSelectorRect = new Rect();
    mSelectedStart = 0;

    mResurrectToPosition = INVALID_POSITION;

    mSelectedStart = 0;
    mNextSelectedPosition = INVALID_POSITION;
    mNextSelectedRowId = INVALID_ROW_ID;
    mSelectedPosition = INVALID_POSITION;
    mSelectedRowId = INVALID_ROW_ID;
    mOldSelectedPosition = INVALID_POSITION;
    mOldSelectedRowId = INVALID_ROW_ID;

    mChoiceMode = ChoiceMode.NONE;
    mCheckedItemCount = 0;
    mCheckedIdStates = null;
    mCheckStates = null;

    mRecycler = new RecycleBin();
    mDataSetObserver = null;

    mAreAllItemsSelectable = true;

    mStartEdge = null;
    mEndEdge = null;

    setClickable(true);
    setFocusableInTouchMode(true);
    setWillNotDraw(false);
    setAlwaysDrawnWithCacheEnabled(false);
    setWillNotDraw(false);
    setClipToPadding(false);

    ViewCompat.setOverScrollMode(this, ViewCompat.OVER_SCROLL_IF_CONTENT_SCROLLS);

    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.TwoWayView, defStyle, 0);
    initializeScrollbars(a);

    mDrawSelectorOnTop = a.getBoolean(R.styleable.TwoWayView_android_drawSelectorOnTop, false);

    Drawable d = a.getDrawable(R.styleable.TwoWayView_android_listSelector);
    if (d != null) {
        setSelector(d);
    }

    int orientation = a.getInt(R.styleable.TwoWayView_android_orientation, -1);
    if (orientation >= 0) {
        setOrientation(Orientation.values()[orientation]);
    }

    int choiceMode = a.getInt(R.styleable.TwoWayView_android_choiceMode, -1);
    if (choiceMode >= 0) {
        setChoiceMode(ChoiceMode.values()[choiceMode]);
    }

    a.recycle();

    updateScrollbarsDirection();
}

From source file:com.vreal.libs.TwoWayView.java

public TwoWayView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    //      c=context;
    mNeedSync = false;//from   ww w .  ja v a  2 s. c  om
    mVelocityTracker = null;

    mLayoutMode = LAYOUT_NORMAL;
    mTouchMode = TOUCH_MODE_REST;
    mLastTouchMode = TOUCH_MODE_UNKNOWN;

    mIsAttached = false;

    mContextMenuInfo = null;

    mOnScrollListener = null;
    mLastScrollState = OnScrollListener.SCROLL_STATE_IDLE;

    final ViewConfiguration vc = ViewConfiguration.get(context);
    mTouchSlop = vc.getScaledTouchSlop();
    mMaximumVelocity = vc.getScaledMaximumFlingVelocity();
    mFlingVelocity = vc.getScaledMinimumFlingVelocity();
    mOverscrollDistance = getScaledOverscrollDistance(vc);

    mOverScroll = 0;

    mScroller = new Scroller(context);

    mIsVertical = true;

    mItemsCanFocus = false;

    mTempRect = new Rect();

    mArrowScrollFocusResult = new ArrowScrollFocusResult();

    mSelectorPosition = INVALID_POSITION;

    mSelectorRect = new Rect();
    mSelectedStart = 0;

    mResurrectToPosition = INVALID_POSITION;

    mSelectedStart = 0;
    mNextSelectedPosition = INVALID_POSITION;
    mNextSelectedRowId = INVALID_ROW_ID;
    mSelectedPosition = INVALID_POSITION;
    mSelectedRowId = INVALID_ROW_ID;
    mOldSelectedPosition = INVALID_POSITION;
    mOldSelectedRowId = INVALID_ROW_ID;

    mChoiceMode = ChoiceMode.NONE;
    mCheckedItemCount = 0;
    mCheckedIdStates = null;
    mCheckStates = null;

    mRecycler = new RecycleBin();
    mDataSetObserver = null;

    mAreAllItemsSelectable = true;

    mStartEdge = null;
    mEndEdge = null;

    setClickable(true);
    setFocusableInTouchMode(true);
    setWillNotDraw(false);
    setAlwaysDrawnWithCacheEnabled(false);
    setWillNotDraw(false);
    setClipToPadding(false);

    ViewCompat.setOverScrollMode(this, ViewCompat.OVER_SCROLL_IF_CONTENT_SCROLLS);

    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.TwoWayView, defStyle, 0);
    //      initializeScrollbars(a,context);

    mDrawSelectorOnTop = a.getBoolean(R.styleable.TwoWayView_android_drawSelectorOnTop, false);

    Drawable d = a.getDrawable(R.styleable.TwoWayView_android_listSelector);
    if (d != null) {
        setSelector(d);
    }

    int orientation = a.getInt(R.styleable.TwoWayView_android_orientation, -1);
    if (orientation >= 0) {
        setOrientation(Orientation.values()[orientation]);
    }

    int choiceMode = a.getInt(R.styleable.TwoWayView_android_choiceMode, -1);
    if (choiceMode >= 0) {
        setChoiceMode(ChoiceMode.values()[choiceMode]);
    }

    a.recycle();

    updateScrollbarsDirection();
}

From source file:com.artifex.mupdflib.TwoWayView.java

public TwoWayView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    mContext = context;//from w  w w.  j ava2 s  .  c  o m

    mLayoutMode = LAYOUT_NORMAL;
    mTouchMode = TOUCH_MODE_REST;
    mLastTouchMode = TOUCH_MODE_UNKNOWN;

    mLastScrollState = OnScrollListener.SCROLL_STATE_IDLE;

    final ViewConfiguration vc = ViewConfiguration.get(context);
    mTouchSlop = vc.getScaledTouchSlop();
    mMaximumVelocity = vc.getScaledMaximumFlingVelocity();
    mFlingVelocity = vc.getScaledMinimumFlingVelocity();
    mOverscrollDistance = getScaledOverscrollDistance(vc);

    mScroller = new Scroller(context);

    mIsVertical = true;

    mTempRect = new Rect();

    mArrowScrollFocusResult = new ArrowScrollFocusResult();

    mSelectorPosition = INVALID_POSITION;

    mSelectorRect = new Rect();

    mResurrectToPosition = INVALID_POSITION;

    mNextSelectedPosition = INVALID_POSITION;
    mNextSelectedRowId = INVALID_ROW_ID;
    mSelectedPosition = INVALID_POSITION;
    mSelectedRowId = INVALID_ROW_ID;
    mOldSelectedPosition = INVALID_POSITION;
    mOldSelectedRowId = INVALID_ROW_ID;

    mChoiceMode = ChoiceMode.NONE;

    mRecycler = new RecycleBin();

    mAreAllItemsSelectable = true;

    setClickable(true);
    setFocusableInTouchMode(true);
    setWillNotDraw(false);
    setAlwaysDrawnWithCacheEnabled(false);
    setWillNotDraw(false);
    setClipToPadding(false);

    ViewCompat.setOverScrollMode(this, ViewCompat.OVER_SCROLL_IF_CONTENT_SCROLLS);

    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.TwoWayView, defStyle, 0);

    mDrawSelectorOnTop = a.getBoolean(R.styleable.TwoWayView_android_drawSelectorOnTop, false);

    Drawable d = a.getDrawable(R.styleable.TwoWayView_android_listSelector);
    if (d != null) {
        setSelector(d);
    }

    int orientation = a.getInt(R.styleable.TwoWayView_android_orientation, -1);
    if (orientation >= 0) {
        setOrientation(Orientation.values()[orientation]);
    }

    int choiceMode = a.getInt(R.styleable.TwoWayView_android_choiceMode, -1);
    if (choiceMode >= 0) {
        setChoiceMode(ChoiceMode.values()[choiceMode]);
    }

    a.recycle();
}

From source file:com.wanikani.androidnotifier.graph.TYPlot.java

/**
 * Constructor/*from  www . java  2 s  .  c om*/
 * @param ctxt the context
 * @param attrs the attributes
 */
public TYPlot(Context ctxt, AttributeSet attrs) {
    super(ctxt, attrs);

    scroller = new Scroller(ctxt);
    glist = new GestureListener();
    gdect = new GestureDetector(ctxt, glist);

    datef = new SimpleDateFormat("MMM", Locale.US);
    janf = new SimpleDateFormat("MMM yyyy", Locale.US);
    taxis = new TimeAxis();
    dsink = new DataSink();

    loadAttributes(ctxt, attrs);
}

From source file:com.example.view.wheel.WheelView.java

/**
 * Initializes class data//from www.  jav a2  s .c  o  m
 * @param context the context
 */
private void initData(Context context) {
    gestureDetector = new GestureDetector(context, gestureListener);
    gestureDetector.setIsLongpressEnabled(false);
    scroller = new Scroller(context);
    this.context = context;
}