List of usage examples for android.view ViewConfiguration getScaledMinimumFlingVelocity
public int getScaledMinimumFlingVelocity()
From source file:com.android2.calculator3.view.CalculatorPadView.java
private void setup() { ViewConfiguration vc = ViewConfiguration.get(getContext()); mMinimumFlingVelocity = vc.getScaledMinimumFlingVelocity(); mMaximumFlingVelocity = vc.getScaledMaximumFlingVelocity(); mTouchSlop = vc.getScaledTouchSlop(); mOffset = getResources().getDimensionPixelSize(R.dimen.pad_page_margin); mOverlayMargin = getResources().getDimensionPixelSize(R.dimen.shadow_margin); getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @Override//from w w w .j a v a 2 s . c o m public void onGlobalLayout() { if (android.os.Build.VERSION.SDK_INT >= 16) { getViewTreeObserver().removeOnGlobalLayoutListener(this); } else { getViewTreeObserver().removeGlobalOnLayoutListener(this); } initializeLayout(getState()); } }); }
From source file:com.marshalchen.common.uimodule.superlistview.SwipeDismissListViewTouchListener.java
/** * Constructs a new swipe-to-dismiss touch listener for the given list view. * * @param listView 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. *//* w w w . j av a 2s . c om*/ public SwipeDismissListViewTouchListener(ListView listView, DismissCallbacks callbacks) { 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; mCallbacks = callbacks; }
From source file:individual.leobert.calendar.CalendarLayout.java
private void init() { final ViewConfiguration vc = ViewConfiguration.get(getContext()); mMaxVelocity = vc.getScaledMaximumFlingVelocity(); mMinVelocity = vc.getScaledMinimumFlingVelocity(); mScroller = ScrollerCompat.create(getContext(), sInterpolator); }
From source file:com.umeitime.common.views.ScrollableLayout.java
private void init(Context context, AttributeSet attrs) { float scale = context.getResources().getDisplayMetrics().density; int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android"); // ???//from www . j a v a 2 s .c om int statusBarHeight = getResources().getDimensionPixelSize(resourceId); TypedArray actionbarSizeTypedArray = context .obtainStyledAttributes(new int[] { android.R.attr.actionBarSize }); float actionbarHeight = actionbarSizeTypedArray.getDimension(0, 0); headerDistance = actionbarHeight + statusBarHeight; mHelper = new ScrollableHelper(); mScroller = new Scroller(context); final ViewConfiguration configuration = ViewConfiguration.get(context); mTouchSlop = configuration.getScaledTouchSlop(); mMinimumVelocity = configuration.getScaledMinimumFlingVelocity(); mMaximumVelocity = configuration.getScaledMaximumFlingVelocity(); }
From source file:es.ugr.swad.swadroid.gui.SwipeListViewTouchListener.java
/** * Constructs a new swipe-to-action touch listener for the given list view. * * @param listView 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. *///www. ja v a2s . c o m public SwipeListViewTouchListener(ListView listView, OnSwipeCallback callback) { ViewConfiguration vc = ViewConfiguration.get(listView.getContext()); mSlop = vc.getScaledTouchSlop(); mMinFlingVelocity = vc.getScaledMinimumFlingVelocity(); mMaxFlingVelocity = vc.getScaledMaximumFlingVelocity(); mAnimationTime = listView.getContext().getResources().getInteger(android.R.integer.config_shortAnimTime); mListView = listView; mCallback = callback; }
From source file:se.kth.csc.stayawhile.swipe.QueueTouchListener.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 a v a 2 s.co m*/ public QueueTouchListener(RecyclerView recyclerView, QueueSwipeListener 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; mQueueSwipeListener = listener; /** * This will ensure that this QueueTouchListener 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);/*from w w w.j ava 2s . c om*/ flingPixels = viewConfiguration.getScaledMinimumFlingVelocity(); maxFlingPixels = viewConfiguration.getScaledMaximumFlingVelocity(); scroller = new Scroller(getContext()); shadowPaint = new Paint(Paint.ANTI_ALIAS_FLAG); }
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 www. ja v a 2 s.c o m 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: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;/*from w w w . j a v a 2s. c om*/ }
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 w w . j a v a 2 s.c o 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); } }); }