List of usage examples for android.view ViewConfiguration getScaledMaximumFlingVelocity
public int getScaledMaximumFlingVelocity()
From source file:com.haarman.listviewanimations.itemmanipulation.SwipeDismissListViewTouchListener.java
/** * Constructs a new swipe-to-dismiss touch listener for the given list view. * * @param listView/*from w w w . j a v a 2s.c om*/ * The list view whose items should be dismissable. * @param callback * The callback to trigger when the user has indicated that she * would like to dismiss one or more list items. */ public SwipeDismissListViewTouchListener(AbsListView listView, OnDismissCallback callback, SwipeOnScrollListener onScroll) { ViewConfiguration vc = ViewConfiguration.get(listView.getContext()); mSlop = vc.getScaledTouchSlop(); mMinFlingVelocity = vc.getScaledMinimumFlingVelocity() * 16; mMaxFlingVelocity = vc.getScaledMaximumFlingVelocity(); mAnimationTime = listView.getContext().getResources().getInteger(android.R.integer.config_shortAnimTime); mListView = listView; mCallback = callback; onScroll.setTouchListener(this); mListView.setOnScrollListener(onScroll); }
From source file:com.google.android.apps.santatracker.map.BottomSheetBehavior.java
/** * Default constructor for inflating BottomSheetBehaviors from layout. * * @param context The {@link Context}.// w w w . jav a2 s . co m * @param attrs The {@link AttributeSet}. */ public BottomSheetBehavior(Context context, AttributeSet attrs) { super(context, attrs); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.BottomSheetBehavior_Params); setPeekHeight(a.getDimensionPixelSize(R.styleable.BottomSheetBehavior_Params_behavior_peekHeight, 0)); setHideable(a.getBoolean(R.styleable.BottomSheetBehavior_Params_behavior_hideable, false)); setHiddenPeekHeight( a.getDimensionPixelSize(R.styleable.BottomSheetBehavior_Params_behavior_hiddenPeekHeight, 0)); a.recycle(); ViewConfiguration configuration = ViewConfiguration.get(context); mMaximumVelocity = configuration.getScaledMaximumFlingVelocity(); }
From source file:com.xyczero.customswipelistview.CustomSwipeListView.java
private void initCustomSwipeListView() { final Context context = getContext(); final ViewConfiguration configuration = ViewConfiguration.get(context); mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop() * 5; mMaximumVelocity = configuration.getScaledMaximumFlingVelocity(); // set minimum velocity according to the MIN_VELOCITY. mMinimumVelocity = CustomSwipeUtils.convertDptoPx(context, MIN_VELOCITY); mScreenWidth = CustomSwipeUtils.getScreenWidth(context); mScroller = new Scroller(context); initSwipeItemTriggerDeltaX();// w w w . j av a 2 s .c o m // set default value. mCurTouchSwipeMode = TOUCH_SWIPE_NONE; mSelectedPosition = INVALID_POSITION; }
From source file:android.support.designox.widget.BottomSheetBehavior.java
/** * Default constructor for inflating BottomSheetBehaviors from layout. * * @param context The {@link Context}./* w ww . j a v a 2s . com*/ * @param attrs The {@link AttributeSet}. */ public BottomSheetBehavior(Context context, AttributeSet attrs) { super(context, attrs); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.BottomSheetBehavior_Params); setPeekHeight(a.getDimensionPixelSize(R.styleable.BottomSheetBehavior_Params_behavior_peekHeight_ox, 0)); setHideable(a.getBoolean(R.styleable.BottomSheetBehavior_Params_behavior_hideable_ox, false)); a.recycle(); ViewConfiguration configuration = ViewConfiguration.get(context); mMaximumVelocity = configuration.getScaledMaximumFlingVelocity(); }
From source file:com.example.administrator.myapplication.recycler_swipe.swpie.SwipeMenuLayout.java
public SwipeMenuLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.SwipeMenuLayout); mLeftViewId = typedArray.getResourceId(R.styleable.SwipeMenuLayout_leftViewId, mLeftViewId); mContentViewId = typedArray.getResourceId(R.styleable.SwipeMenuLayout_contentViewId, mContentViewId); mRightViewId = typedArray.getResourceId(R.styleable.SwipeMenuLayout_rightViewId, mRightViewId); typedArray.recycle();/*from w w w . j ava 2 s .co m*/ ViewConfiguration configuration = ViewConfiguration.get(getContext()); mScaledTouchSlop = configuration.getScaledTouchSlop(); mScaledMinimumFlingVelocity = configuration.getScaledMinimumFlingVelocity(); mScaledMaximumFlingVelocity = configuration.getScaledMaximumFlingVelocity(); mScroller = new OverScroller(getContext()); }
From source file:com.iangclifton.auid.horizontaliconview.HorizontalIconView.java
/** * Perform one-time initialization/*from w w w . ja v a 2s . co m*/ * * @param context Context to load Resources and ViewConfiguration data */ private void init(Context context) { final Resources res = context.getResources(); mIconSize = res.getDimensionPixelSize(R.dimen.icon_size); mIconSpacing = res.getDimensionPixelSize(R.dimen.icon_spacing); // Cache ViewConfiguration values final ViewConfiguration config = ViewConfiguration.get(context); mTouchSlop = config.getScaledTouchSlop(); mMinimumVelocity = config.getScaledMinimumFlingVelocity(); mMaximumVelocity = config.getScaledMaximumFlingVelocity(); mOverflingDistance = config.getScaledOverflingDistance(); mOverscrollDistance = config.getScaledOverscrollDistance(); // Verify this View will be drawn setWillNotDraw(false); // Other setup mEdgeEffectLeft = new EdgeEffectCompat(context); mEdgeEffectRight = new EdgeEffectCompat(context); mScroller = new OverScroller(context); setFocusable(true); }
From source file:com.demos.support_23_2.MyBottomBehavior.java
/** * Default constructor for inflating BottomSheetBehaviors from layout. * * @param context The {@link Context}./* w w w . j ava 2 s . com*/ * @param attrs The {@link AttributeSet}. */ public MyBottomBehavior(Context context, AttributeSet attrs) { super(context, attrs); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.BottomSheetBehavior_Params); setPeekHeight(a.getDimensionPixelSize(R.styleable.BottomSheetBehavior_Params_behavior_peekHeight, 0)); setHideable(a.getBoolean(R.styleable.BottomSheetBehavior_Params_behavior_hideable, false)); a.recycle(); ViewConfiguration configuration = ViewConfiguration.get(context); mMaximumVelocity = configuration.getScaledMaximumFlingVelocity(); }
From source file:com.shizhefei.view.largeimage.LargeImageView.java
public LargeImageView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); mScroller = ScrollerCompat.create(getContext(), null); scaleHelper = new ScaleHelper(); setFocusable(true);/* w ww . java 2s . co m*/ setWillNotDraw(false); gestureDetector = new GestureDetector(context, simpleOnGestureListener); scaleGestureDetector = new ScaleGestureDetector(context, onScaleGestureListener); imageBlockLoader = new BlockImageLoader(context); imageBlockLoader.setOnImageLoadListener(this); final ViewConfiguration configuration = ViewConfiguration.get(getContext()); mMinimumVelocity = configuration.getScaledMinimumFlingVelocity(); mMaximumVelocity = configuration.getScaledMaximumFlingVelocity(); }
From source file:com.hardsoftstudio.anchorbottomsheet.AnchorSheetBehavior.java
/** * Default constructor for inflating AnchorSheetBehavior from layout. * * @param context The {@link Context}.//from ww w . jav a 2s.c o m * @param attrs The {@link AttributeSet}. */ public AnchorSheetBehavior(Context context, AttributeSet attrs) { super(context, attrs); TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.AnchorSheetBehavior_Params); setPeekHeight(a.getDimensionPixelSize(R.styleable.AnchorSheetBehavior_Params_peekHeight, 0)); setHideable(a.getBoolean(R.styleable.AnchorSheetBehavior_Params_hideable, false)); a.recycle(); ViewConfiguration configuration = ViewConfiguration.get(context); mMaximumVelocity = configuration.getScaledMaximumFlingVelocity(); }
From source file:com.andview.refreshview.swipe.SwipeMenuLayout.java
public SwipeMenuLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.SwipeMenuLayout); mLeftViewId = typedArray.getResourceId(R.styleable.SwipeMenuLayout_leftViewId, mLeftViewId); mContentViewId = typedArray.getResourceId(R.styleable.SwipeMenuLayout_contentViewId, mContentViewId); mRightViewId = typedArray.getResourceId(R.styleable.SwipeMenuLayout_rightViewId, mRightViewId); typedArray.recycle();//from w ww.j ava 2 s. com ViewConfiguration mViewConfig = ViewConfiguration.get(getContext()); mScaledTouchSlop = mViewConfig.getScaledTouchSlop(); mScroller = new OverScroller(getContext()); mScaledMinimumFlingVelocity = mViewConfig.getScaledMinimumFlingVelocity(); mScaledMaximumFlingVelocity = mViewConfig.getScaledMaximumFlingVelocity(); }