List of usage examples for android.view ViewConfiguration getScaledTouchSlop
public int getScaledTouchSlop()
From source file:com.android.backups.StaggeredGridViewByJaumo.java
public StaggeredGridViewByJaumo(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); if (attrs != null) { TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.StaggeredGridView); mColCount = a.getInteger(R.styleable.StaggeredGridView_numColumns, 2); mDrawSelectorOnTop = a.getBoolean(R.styleable.StaggeredGridView_drawSelectorOnTop, false); } else {// ww w. ja v a2 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(); } }
From source file:com.android.backups.BackupStaggeredGridView.java
public BackupStaggeredGridView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); if (attrs != null) { TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.StaggeredGridView); mColCount = a.getInteger(R.styleable.StaggeredGridView_numColumns, 2); mDrawSelectorOnTop = a.getBoolean(R.styleable.StaggeredGridView_drawSelectorOnTop, false); } else {/*from w w w . j av a 2s. co 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(); } }
From source file:com.dishes.views.stageredggridview.StaggeredGridView.java
public StaggeredGridView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); if (attrs != null) { TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.StaggeredGridView); mColCount = a.getInteger(R.styleable.StaggeredGridView_numColumns, 2); mDrawSelectorOnTop = a.getBoolean(R.styleable.StaggeredGridView_drawSelectorOnTop, false); a.recycle();// w ww . j a va 2 s . co m } else { 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(); } }
From source file:com.bulletnoid.android.widget.StaggeredGridView.StaggeredGridView3.java
public StaggeredGridView3(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 ww . j av a 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(); }
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 {//www.ja v a 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);// w ww.ja va 2s. com 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 ww .j ava 2s.c o m 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/* w w w .j ava 2 s .co 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);/*www . 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; }