List of usage examples for android.view ViewConfiguration getScaledMaximumFlingVelocity
public int getScaledMaximumFlingVelocity()
From source file:com.brandon.mailbox.RecyclerSwipeListener.java
/** * Constructs a new swipe touch listener for the given {@link android.support.v7.widget.RecyclerView} * * @param recyclerView The recycler view whose items should be dismissable by swiping. * @param listener The listener for the swipe events. *//*from w w w .j a va2s . c om*/ public RecyclerSwipeListener(RecyclerView recyclerView, SwipeListener listener) { ViewConfiguration vc = ViewConfiguration.get(recyclerView.getContext()); mSlop = vc.getScaledTouchSlop(); mMinFlingVelocity = vc.getScaledMinimumFlingVelocity() * 16; mMaxFlingVelocity = vc.getScaledMaximumFlingVelocity(); mAnimationTime = recyclerView.getContext().getResources() .getInteger(android.R.integer.config_shortAnimTime); mRecyclerView = recyclerView; mSwipeListener = listener; /** * This will ensure that this SwipeableRecyclerViewTouchListener is paused during list view scrolling. * If a scroll listener is already assigned, the caller should still pass scroll changes through * to this listener. */ mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrollStateChanged(RecyclerView recyclerView, int newState) { setEnabled(newState != RecyclerView.SCROLL_STATE_DRAGGING); } @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { } }); }
From source file:org.floens.chan.controller.ui.NavigationControllerContainerLayout.java
private void init() { ViewConfiguration viewConfiguration = ViewConfiguration.get(getContext()); slopPixels = viewConfiguration.getScaledTouchSlop(); minimalMovedPixels = dp(3);/*w ww . j av a 2 s. c om*/ flingPixels = viewConfiguration.getScaledMinimumFlingVelocity(); maxFlingPixels = viewConfiguration.getScaledMaximumFlingVelocity(); scroller = new Scroller(getContext()); shadowPaint = new Paint(Paint.ANTI_ALIAS_FLAG); }
From source file:com.huaop2p.yqs.widget.scroll.ScrollableLayout.java
public void init(Context context) { this.context = context; mHelper = new ScrollableHelper(); mScroller = new Scroller(context); final ViewConfiguration configuration = ViewConfiguration.get(context); mTouchSlop = configuration.getScaledTouchSlop(); mMinimumVelocity = configuration.getScaledMinimumFlingVelocity(); mMaximumVelocity = configuration.getScaledMaximumFlingVelocity(); sysVersion = Build.VERSION.SDK_INT;//w w w.jav a 2 s .c o m }
From source file:com.android.messaging.ui.conversationlist.ConversationListSwipeHelper.java
public ConversationListSwipeHelper(final RecyclerView recyclerView) { mRecyclerView = recyclerView;// w w w.ja v a 2 s.co m final Context context = mRecyclerView.getContext(); final Resources res = context.getResources(); mDefaultRestoreAnimationDuration = res.getInteger(R.integer.swipe_duration_ms); mDefaultDismissAnimationDuration = res.getInteger(R.integer.swipe_duration_ms); mMaxTranslationAnimationDuration = res.getInteger(R.integer.swipe_duration_ms); final ViewConfiguration viewConfiguration = ViewConfiguration.get(context); mTouchSlop = viewConfiguration.getScaledPagingTouchSlop(); mMaximumFlingVelocity = Math.min(viewConfiguration.getScaledMaximumFlingVelocity(), res.getInteger(R.integer.swipe_max_fling_velocity_px_per_s)); mMinimumFlingVelocity = viewConfiguration.getScaledMinimumFlingVelocity(); }
From source file:br.com.devmix.baseapp.listener.OnSwipeableRecyclerViewTouchListener.java
/** * Constructs a new swipe touch listener for the given {@link android.support.v7.widget.RecyclerView} * * @param recyclerView The recycler view whose items should be dismissable by swiping. * @param listener The listener for the swipe events. *///from w ww . j a v a 2 s .co m public OnSwipeableRecyclerViewTouchListener(RecyclerView recyclerView, SwipeListener listener) { ViewConfiguration vc = ViewConfiguration.get(recyclerView.getContext()); mSlop = vc.getScaledTouchSlop(); mMinFlingVelocity = vc.getScaledMinimumFlingVelocity() * 16; mMaxFlingVelocity = vc.getScaledMaximumFlingVelocity(); mAnimationTime = recyclerView.getContext().getResources() .getInteger(android.R.integer.config_shortAnimTime); mRecyclerView = recyclerView; mSwipeListener = listener; /** * This will ensure that this SwipeableRecyclerViewTouchListener is paused during list view scrolling. * If a scroll listener is already assigned, the caller should still pass scroll changes through * to this listener. */ mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrollStateChanged(RecyclerView recyclerView, int newState) { super.onScrollStateChanged(recyclerView, newState); setEnabled(newState != RecyclerView.SCROLL_STATE_DRAGGING); } @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { super.onScrolled(recyclerView, dx, dy); } }); }
From source file:com.itude.mobile.mobbl.blueprint.app.view.listeners.SwipeDismissRecyclerViewTouchListener.java
public SwipeDismissRecyclerViewTouchListener(Builder builder) { ViewConfiguration vc = ViewConfiguration.get(builder.mRecyclerView.getContext()); mSlop = vc.getScaledTouchSlop();/*from w w w. j a v a 2s .c o m*/ mMinFlingVelocity = vc.getScaledMinimumFlingVelocity() * 16; mMaxFlingVelocity = vc.getScaledMaximumFlingVelocity(); mAnimationTime = builder.mRecyclerView.getContext().getResources() .getInteger(android.R.integer.config_shortAnimTime); mRecyclerView = builder.mRecyclerView; mCallbacks = builder.mCallbacks; mIsVertical = builder.mIsVertical; mItemTouchCallback = builder.mItemTouchCallback; }
From source file:br.com.halph.agendafeliz.util.SwipeableRecyclerViewTouchListener.java
/** * Constructs a new swipe touch listener for the given {@link android.support.v7.widget.RecyclerView} * * @param recyclerView The recycler view whose items should be dismissable by swiping. * @param listener The listener for the swipe events. */// w ww . j av a 2s. c om public SwipeableRecyclerViewTouchListener(RecyclerView recyclerView, SwipeListener listener) { ViewConfiguration vc = ViewConfiguration.get(recyclerView.getContext()); mSlop = vc.getScaledTouchSlop(); mMinFlingVelocity = vc.getScaledMinimumFlingVelocity() * 16; mMaxFlingVelocity = vc.getScaledMaximumFlingVelocity(); mAnimationTime = recyclerView.getContext().getResources() .getInteger(android.R.integer.config_shortAnimTime); mRecyclerView = recyclerView; mSwipeListener = listener; /** * This will ensure that this SwipeableRecyclerViewTouchListener is paused during list view scrolling. * If a scroll listener is already assigned, the caller should still pass scroll changes through * to this listener. */ mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrollStateChanged(RecyclerView recyclerView, int newState) { setEnabled(newState != RecyclerView.SCROLL_STATE_DRAGGING); } @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { } }); }
From source file:org.creativecommons.thelist.swipedismiss.SwipeDismissRecyclerViewTouchListener.java
/** * Constructs a new swipe-to-dismiss touch listener for the given list view. * * @param recyclerView The list view whose items should be dismissable. * @param callbacks The callback to trigger when the user has indicated that she would like to * dismiss one or more list items. *//*from w w w . j a va2s.co m*/ public SwipeDismissRecyclerViewTouchListener(RecyclerView recyclerView, final SwipeRefreshLayout layout, DismissCallbacks callbacks) { ViewConfiguration vc = ViewConfiguration.get(recyclerView.getContext()); mSlop = vc.getScaledTouchSlop(); mMinFlingVelocity = vc.getScaledMinimumFlingVelocity() * 16; mMaxFlingVelocity = vc.getScaledMaximumFlingVelocity(); mAnimationTime = recyclerView.getContext().getResources() .getInteger(android.R.integer.config_shortAnimTime); mRecyclerView = recyclerView; mRefreshLayout = layout; mCallbacks = callbacks; }
From source file:cn.bingoogolapple.refreshlayout.BGAStickyNavLayout.java
private void init(Context context) { setOrientation(VERTICAL);//from w ww. ja va2 s .c o m mOverScroller = new OverScroller(context); final ViewConfiguration configuration = ViewConfiguration.get(context); mTouchSlop = configuration.getScaledTouchSlop(); mMaximumVelocity = configuration.getScaledMaximumFlingVelocity(); mMinimumVelocity = configuration.getScaledMinimumFlingVelocity(); }
From source file:com.conduit.plastic.widget.NestedWebView.java
private void init() { this.mChildHelper = new NestedScrollingChildHelper(this); setNestedScrollingEnabled(true);/*from w ww . j av a 2 s. c om*/ ViewConfiguration configuration = ViewConfiguration.get(getContext()); this.mMinimumVelocity = configuration.getScaledMinimumFlingVelocity(); this.mMaximumVelocity = configuration.getScaledMaximumFlingVelocity(); this.mTouchSlop = configuration.getScaledTouchSlop(); this.directionDetector = new DirectionDetector(); this.density = getScale(); setOverScrollMode(View.OVER_SCROLL_NEVER); this.settings = getSettings(); // addJavascriptInterface(new JSGetContentHeight(), "InjectedObject"); Log.i(TAG, "max -- min Velocity = " + this.mMaximumVelocity + " -- " + this.mMinimumVelocity + " touchSlop = " + this.mTouchSlop); }