List of usage examples for android.view ViewConfiguration getScaledMinimumFlingVelocity
public int getScaledMinimumFlingVelocity()
From source file:com.bulletnoid.android.widget.StaggeredGridView.StaggeredGridView2.java
public StaggeredGridView2(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); if (attrs != null) { TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.StgStaggeredGridView); mColCount = a.getInteger(R.styleable.StgStaggeredGridView_stgNumColumns, 2); mDrawSelectorOnTop = a.getBoolean(R.styleable.StgStaggeredGridView_stgDrawSelectorOnTop, false); } else {//from w w w.ja va 2 s.c o m mColCount = 2; mDrawSelectorOnTop = false; } final ViewConfiguration vc = ViewConfiguration.get(context); mTouchSlop = vc.getScaledTouchSlop(); mMaximumVelocity = vc.getScaledMaximumFlingVelocity(); mFlingVelocity = vc.getScaledMinimumFlingVelocity(); //mScroller=ScrollerCompat.from(context); mTopEdge = new EdgeEffectCompat(context); mBottomEdge = new EdgeEffectCompat(context); setWillNotDraw(false); setClipToPadding(false); this.setFocusableInTouchMode(false); if (mSelector == null) { useDefaultSelector(); } mMinimumVelocity = vc.getScaledMinimumFlingVelocity(); mMaximumVelocity = vc.getScaledMaximumFlingVelocity(); mOverscrollDistance = vc.getScaledOverscrollDistance(); //TODO mOverflingDistance = vc.getScaledOverflingDistance(); }
From source file:app.umitems.greenclock.widget.sgv.StaggeredGridView.java
public StaggeredGridView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); final ViewConfiguration vc = ViewConfiguration.get(context); mTouchSlop = vc.getScaledTouchSlop(); mMaximumVelocity = vc.getScaledMaximumFlingVelocity(); mFlingVelocity = vc.getScaledMinimumFlingVelocity(); mScroller = new OverScrollerSGV(context); mTopEdge = new EdgeEffectCompat(context); mBottomEdge = new EdgeEffectCompat(context); setWillNotDraw(false);/*from w w w .j a va2 s . c o m*/ setClipToPadding(false); SgvAnimationHelper.initialize(context); mDragState = ReorderUtils.DRAG_STATE_NONE; mIsDragReorderingEnabled = true; mWindowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); final ViewConfiguration configuration = ViewConfiguration.get(context); mOverscrollDistance = configuration.getScaledOverflingDistance(); // Disable splitting event. Only one of the children can handle motion event. setMotionEventSplittingEnabled(false); }
From source file:com.lovely3x.eavlibrary.EasyAdapterView.java
public EasyAdapterView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); this.mDebugPaint = new Paint(Paint.ANTI_ALIAS_FLAG); this.mDebugPaint.setColor(Color.RED); this.mDebugPaint.setStrokeWidth(5); this.mDebugPaint.setTextSize( TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 20, getResources().getDisplayMetrics())); ViewConfiguration config = ViewConfiguration.get(context); mTouchSlop = config.getScaledTouchSlop() / 2; this.mVelocity = VelocityTracker.obtain(); mMinimumVelocity = config.getScaledMinimumFlingVelocity(); mMaximumVelocity = config.getScaledMaximumFlingVelocity(); this.mTopEdgeEffect = new EdgeEffect(getContext()); this.mBottomEdgeEffect = new EdgeEffect(getContext()); this.mLeftEdgeEffect = new EdgeEffect(getContext()); this.mRightEdgeEffect = new EdgeEffect(getContext()); mDividerHeight = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 1f, getResources().getDisplayMetrics()); mDivider = new ColorDrawable(Color.LTGRAY); if (attrs != null) initAttrs(attrs);/*from w w w . ja va 2 s . c om*/ setWillNotDraw(false); previewInEditMode(); }
From source file:android.support.v7.widget.RecyclerView.java
public RecyclerView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); final int version = Build.VERSION.SDK_INT; mPostUpdatesOnAnimation = version >= 16; final ViewConfiguration vc = ViewConfiguration.get(context); mTouchSlop = vc.getScaledTouchSlop(); mMinFlingVelocity = vc.getScaledMinimumFlingVelocity(); mMaxFlingVelocity = vc.getScaledMaximumFlingVelocity(); setWillNotDraw(ViewCompat.getOverScrollMode(this) == ViewCompat.OVER_SCROLL_NEVER); mItemAnimator.setListener(mItemAnimatorListener); }
From source file:com.example.libwidgettv.bak.AbsListView.java
private void initAbsListView() { // Setting focusable in touch mode will set the focusable property to // true/*from w w w . java 2s . c o m*/ setClickable(true); setFocusableInTouchMode(true); setWillNotDraw(false); setAlwaysDrawnWithCacheEnabled(false); setScrollingCacheEnabled(true); final ViewConfiguration configuration = ViewConfiguration.get(getContext()); mTouchSlop = configuration.getScaledTouchSlop(); mMinimumVelocity = configuration.getScaledMinimumFlingVelocity(); mMaximumVelocity = configuration.getScaledMaximumFlingVelocity(); mOverscrollDistance = configuration.getScaledOverscrollDistance(); mOverflingDistance = configuration.getScaledOverflingDistance(); mDensityScale = getContext().getResources().getDisplayMetrics().density; }
From source file:com.appunite.list.AbsHorizontalListView.java
private void initAbsListView() { // Setting focusable in touch mode will set the focusable property to true setClickable(true);/* w w w . ja v a 2 s .c o m*/ setFocusableInTouchMode(true); setWillNotDraw(false); setAlwaysDrawnWithCacheEnabled(false); setScrollingCacheEnabled(true); final Context context = getContext(); final ViewConfiguration configuration = ViewConfiguration.get(context); mTouchSlop = configuration.getScaledTouchSlop(); mMinimumVelocity = configuration.getScaledMinimumFlingVelocity(); mMaximumVelocity = configuration.getScaledMaximumFlingVelocity(); mOverscrollDistance = configuration.getScaledOverscrollDistance(); mOverflingDistance = configuration.getScaledOverflingDistance(); mDensityScale = context.getResources().getDisplayMetrics().density; }
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 .ja v 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); 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;/* w w w.ja v 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.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 w w. j a v a2s . 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); 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;//from w ww . 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(); }