List of usage examples for android.view ViewConfiguration getScaledMaximumFlingVelocity
public int getScaledMaximumFlingVelocity()
From source file:com.android.hcframe.DraggableGridViewPager.java
private void initDraggableGridViewPager() { mDividerPaint = new Paint(); mDividerPaint.setAntiAlias(true);/*from w ww.j av a2 s .c o m*/ mDividerPaint.setColor(mDividerColor); mDividerPaint.setStyle(Style.STROKE); mDividerPaint.setStrokeWidth(mDividerWidth); setWillNotDraw(false); setDescendantFocusability(FOCUS_AFTER_DESCENDANTS); setFocusable(true); setChildrenDrawingOrderEnabled(true); final Context context = getContext(); final ViewConfiguration configuration = ViewConfiguration.get(context); final float density = context.getResources().getDisplayMetrics().density; mGridGap = (int) (DEFAULT_GRID_GAP * density); // internal paddings mPaddingLeft = getPaddingLeft(); mPaddingTop = getPaddingTop(); mPaddingRight = getPaddingRight(); mPaddingButtom = getPaddingBottom(); super.setPadding(0, 0, 0, 0); mScroller = new Scroller(context, sInterpolator); mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration); mMinimumVelocity = (int) (MIN_FLING_VELOCITY * density); mMaximumVelocity = configuration.getScaledMaximumFlingVelocity(); mFlingDistance = (int) (MIN_DISTANCE_FOR_FLING * density); mCloseEnough = (int) (CLOSE_ENOUGH * density); }
From source file:com.hxqc.mall.core.views.CustomScrollView.java
private void initScrollView() { mScroller = ScrollerCompat.create(getContext(), null); setFocusable(true);//from w ww . ja v a2s . c om setDescendantFocusability(FOCUS_AFTER_DESCENDANTS); setWillNotDraw(false); final ViewConfiguration configuration = ViewConfiguration.get(getContext()); mTouchSlop = configuration.getScaledTouchSlop(); mMinimumVelocity = configuration.getScaledMinimumFlingVelocity(); mMaximumVelocity = configuration.getScaledMaximumFlingVelocity(); }
From source file:com.oguzbabaoglu.cardpager.CardPager.java
void initCardPager() { setWillNotDraw(true);/*from ww w .j a va2 s. c o m*/ setDescendantFocusability(FOCUS_AFTER_DESCENDANTS); setFocusable(true); setChildrenDrawingOrderEnabled(true); final Context context = getContext(); final ViewConfiguration configuration = ViewConfiguration.get(context); density = context.getResources().getDisplayMetrics().density; scroller = new Scroller(context, INTERPOLATOR); touchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration); maximumVelocity = configuration.getScaledMaximumFlingVelocity(); minimumVelocity = (int) (MIN_FLING_VELOCITY * density); flingDistance = (int) (MIN_DISTANCE_FOR_FLING * density); catchAllowance = (int) (CATCH_ALLOWANCE * density); }
From source file:com.skurro.pricesnapp1.customviews.swipeback.ViewDragHelper.java
/** * Apps should use ViewDragHelper.create() to get a new instance. This will * allow VDH to use internal compatibility implementations for different * platform versions./*from w w w .j av a 2s. c o m*/ * * @param context Context to initialize config-dependent params from * @param forParent Parent view to monitor */ private ViewDragHelper(Context context, ViewGroup forParent, Callback cb) { if (forParent == null) { throw new IllegalArgumentException("Parent view may not be null"); } if (cb == null) { throw new IllegalArgumentException("Callback may not be null"); } mParentView = forParent; mCallback = cb; final ViewConfiguration vc = ViewConfiguration.get(context); final float density = context.getResources().getDisplayMetrics().widthPixels; // final float density = context.getResources().getDisplayMetrics().density; // int pixel = context.getWindowManager().getDefaultDisplay().getWidth(); // mEdgeSize = (int) (density); mEdgeSize = (int) (EDGE_SIZE * density + 0.5f); mTouchSlop = vc.getScaledTouchSlop(); mMaxVelocity = vc.getScaledMaximumFlingVelocity(); mMinVelocity = vc.getScaledMinimumFlingVelocity(); mScroller = ScrollerCompat.create(context, sInterpolator); }
From source file:com.apptentive.android.sdk.view.ApptentiveNestedScrollView.java
private void initScrollView() { //mScroller = new ScrollerCompat(getContext(), null); mScroller = ScrollerCompat.create(getContext(), null); setFocusable(true);/*w ww. j a va2s . c o m*/ setDescendantFocusability(FOCUS_AFTER_DESCENDANTS); setWillNotDraw(false); final ViewConfiguration configuration = ViewConfiguration.get(getContext()); mTouchSlop = configuration.getScaledTouchSlop(); mMinimumVelocity = configuration.getScaledMinimumFlingVelocity(); mMaximumVelocity = configuration.getScaledMaximumFlingVelocity(); }
From source file:com.cmbb.smartkids.widget.NestedScrollView.java
private void initScrollView() { mScroller = ScrollerCompat.create(getContext(), null); setFocusable(true);/*from www. j a v a 2 s. co m*/ setDescendantFocusability(FOCUS_AFTER_DESCENDANTS); setWillNotDraw(false); final ViewConfiguration configuration = ViewConfiguration.get(getContext()); mTouchSlop = configuration.getScaledTouchSlop(); mMinimumVelocity = configuration.getScaledMinimumFlingVelocity(); mMaximumVelocity = configuration.getScaledMaximumFlingVelocity(); }
From source file:com.android.launcher2.PagedView.java
/** * Initializes various states for this workspace. *//*from w w w.ja va 2 s . com*/ protected void init() { mDirtyPageContent = new ArrayList<Boolean>(); mDirtyPageContent.ensureCapacity(32); mScroller = new Scroller(getContext(), new ScrollInterpolator()); mCurrentPage = 0; mCenterPagesVertically = true; final ViewConfiguration configuration = ViewConfiguration.get(getContext()); mTouchSlop = configuration.getScaledTouchSlop(); mPagingTouchSlop = configuration.getScaledPagingTouchSlop(); mMaximumVelocity = configuration.getScaledMaximumFlingVelocity(); mDensity = getResources().getDisplayMetrics().density; mFlingThresholdVelocity = (int) (FLING_THRESHOLD_VELOCITY * mDensity); mMinFlingVelocity = (int) (MIN_FLING_VELOCITY * mDensity); mMinSnapVelocity = (int) (MIN_SNAP_VELOCITY * mDensity); setOnHierarchyChangeListener(this); }
From source file:com.icloud.listenbook.base.view.DraggableGridViewPager.java
private void initDraggableGridViewPager() { // OnDraw// w w w . j ava2 s . c o m setWillNotDraw(false); // ?Child View?Child View??? setDescendantFocusability(FOCUS_AFTER_DESCENDANTS); // ?? setFocusable(true); // ?? ?? setChildrenDrawingOrderEnabled(true); final Context context = getContext(); final ViewConfiguration configuration = ViewConfiguration.get(context); final float density = context.getResources().getDisplayMetrics().density; mGridGap = (int) (DEFAULT_GRID_GAP * density); // internal paddings mPaddingLeft = getPaddingLeft(); mPaddingTop = getPaddingTop(); mPaddingRight = getPaddingRight(); mPaddingButtom = getPaddingBottom(); super.setPadding(0, 0, 0, 0); mScroller = new Scroller(context, sInterpolator); mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration); mMinimumVelocity = (int) (MIN_FLING_VELOCITY * density); mMaximumVelocity = configuration.getScaledMaximumFlingVelocity(); mFlingDistance = (int) (MIN_DISTANCE_FOR_FLING * density); mCloseEnough = (int) (CLOSE_ENOUGH * density); }
From source file:com.chenglong.muscle.ui.LazyViewPager.java
void initViewPager() { setWillNotDraw(false);//w w w. j ava 2 s.com setDescendantFocusability(FOCUS_AFTER_DESCENDANTS); setFocusable(true); final Context context = getContext(); mScroller = new Scroller(context, sInterpolator); final ViewConfiguration configuration = ViewConfiguration.get(context); mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration); mMinimumVelocity = configuration.getScaledMinimumFlingVelocity(); mMaximumVelocity = configuration.getScaledMaximumFlingVelocity(); mLeftEdge = new EdgeEffectCompat(context); mRightEdge = new EdgeEffectCompat(context); final float density = context.getResources().getDisplayMetrics().density; mFlingDistance = (int) (MIN_DISTANCE_FOR_FLING * density); }
From source file:de.andacaydin.bidirectionalviewpagerlibrary.BiDirectionalViewPager.java
void initViewPager() { setDescendantFocusability(FOCUS_AFTER_DESCENDANTS); setFocusable(true);/*from ww w. j ava 2 s . c o m*/ final Context context = getContext(); final ViewConfiguration configuration = ViewConfiguration.get(context); mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration); mMinimumVelocity = configuration.getScaledMinimumFlingVelocity(); mMaximumVelocity = configuration.getScaledMaximumFlingVelocity(); mLeftEdge = new EdgeEffectCompat(context); mRightEdge = new EdgeEffectCompat(context); final float density = context.getResources().getDisplayMetrics().density; mFlingDistance = (int) (MIN_DISTANCE_FOR_FLING * density); mCloseEnough = (int) (CLOSE_ENOUGH * density); mDefaultGutterSize = (int) (DEFAULT_GUTTER_SIZE * density); ViewCompat.setAccessibilityDelegate(this, getAccessibilityDelegateCompat()); if (ViewCompat.getImportantForAccessibility(this) == ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_AUTO) { ViewCompat.setImportantForAccessibility(this, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES); } setWillNotDraw(false); mScroller = new Scroller(getContext()); mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration); mMinimumVelocity = configuration.getScaledMinimumFlingVelocity(); mMaximumVelocity = configuration.getScaledMaximumFlingVelocity(); }