Example usage for android.content.res TypedArray getInt

List of usage examples for android.content.res TypedArray getInt

Introduction

In this page you can find the example usage for android.content.res TypedArray getInt.

Prototype

public int getInt(@StyleableRes int index, int defValue) 

Source Link

Document

Retrieve the integer value for the attribute at index.

Usage

From source file:com.glview.widget.AbsListView.java

public AbsListView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
    super(context, attrs, defStyleAttr, defStyleRes);
    initAbsListView();//w ww .  j  a  v a2 s .  c o m

    mOwnerThread = Thread.currentThread();

    final TypedArray a = context.obtainStyledAttributes(attrs, com.glview.R.styleable.AbsListView, defStyleAttr,
            defStyleRes);

    Drawable d = GLContext.get().getResources()
            .getDrawable(a.getResourceId(com.glview.R.styleable.AbsListView_listSelector, 0));
    if (d != null) {
        setSelector(d);
    }

    mDrawSelectorOnTop = a.getBoolean(com.glview.R.styleable.AbsListView_drawSelectorOnTop, false);

    boolean stackFromBottom = a.getBoolean(com.glview.R.styleable.AbsListView_stackFromBottom, false);
    setStackFromBottom(stackFromBottom);

    boolean scrollingCacheEnabled = a.getBoolean(com.glview.R.styleable.AbsListView_scrollingCache, true);
    setScrollingCacheEnabled(scrollingCacheEnabled);

    boolean useTextFilter = a.getBoolean(com.glview.R.styleable.AbsListView_textFilterEnabled, false);
    setTextFilterEnabled(useTextFilter);

    int transcriptMode = a.getInt(com.glview.R.styleable.AbsListView_transcriptMode, TRANSCRIPT_MODE_DISABLED);
    setTranscriptMode(transcriptMode);

    int color = a.getColor(com.glview.R.styleable.AbsListView_cacheColorHint, 0);
    setCacheColorHint(color);

    boolean enableFastScroll = a.getBoolean(com.glview.R.styleable.AbsListView_fastScrollEnabled, false);
    setFastScrollEnabled(enableFastScroll);

    int fastScrollStyle = a.getResourceId(com.glview.R.styleable.AbsListView_fastScrollStyle, 0);
    setFastScrollStyle(fastScrollStyle);

    boolean smoothScrollbar = a.getBoolean(com.glview.R.styleable.AbsListView_smoothScrollbar, true);
    setSmoothScrollbarEnabled(smoothScrollbar);

    setChoiceMode(a.getInt(com.glview.R.styleable.AbsListView_choiceMode, CHOICE_MODE_NONE));
    setFastScrollAlwaysVisible(a.getBoolean(com.glview.R.styleable.AbsListView_fastScrollAlwaysVisible, false));

    a.recycle();
}

From source file:com.qurater.pivotal.ui.TwoWayView.java

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

    mNeedSync = false;/*w w  w  .j  a  v  a2 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);

    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.runmit.sweedee.view.DirectListView.java

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

    mNeedSync = false;//ww  w. j av 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.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.mist.sciryl.app.views.TwoWayView.java

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

    mNeedSync = false;//from   w  ww  . j ava 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);

    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.aliasapps.seq.scroller.TwoWayView.java

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

    mNeedSync = false;//from   www  .  j  av  a  2 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.propkaro.util.TwoWayView.java

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

    mNeedSync = false;//w  w  w .j  ava  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.artifex.mupdf.view.ThumbnailViews.java

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

    mNeedSync = false;//from   ww w .  j av a2  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.cmg.android.cmgpdf.view.TwoWayView.java

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

    mNeedSync = false;//from  w  ww  . j  a  va 2 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.appunite.list.AbsHorizontalListView.java

public AbsHorizontalListView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    initAbsListView();//from   w w w.  j ava 2s. c  o  m

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

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

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

    boolean stackFromRight = a.getBoolean(R.styleable.AbsListView_stackFromBottom, false);
    setStackFromRight(stackFromRight);

    boolean scrollingCacheEnabled = a.getBoolean(R.styleable.AbsListView_scrollingCache, true);
    setScrollingCacheEnabled(scrollingCacheEnabled);

    boolean useTextFilter = a.getBoolean(R.styleable.AbsListView_textFilterEnabled, false);
    setTextFilterEnabled(useTextFilter);

    int transcriptMode = a.getInt(R.styleable.AbsListView_transcriptMode, TRANSCRIPT_MODE_DISABLED);
    setTranscriptMode(transcriptMode);

    int color = a.getColor(R.styleable.AbsListView_cacheColorHint, 0);
    setCacheColorHint(color);

    boolean smoothScrollbar = a.getBoolean(R.styleable.AbsListView_smoothScrollbar, true);
    setSmoothScrollbarEnabled(smoothScrollbar);

    setChoiceMode(a.getInt(R.styleable.AbsListView_choiceMode, CHOICE_MODE_NONE));

    a.recycle();
}

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

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

    mNeedSync = false;/*from   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();
}