List of usage examples for android.view ViewConfiguration getScaledMaximumFlingVelocity
public int getScaledMaximumFlingVelocity()
From source file:com.lovejjfg.blogdemo.ui.BottomSheet.java
public BottomSheet(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); final ViewConfiguration viewConfiguration = ViewConfiguration.get(context); MIN_FLING_VELOCITY = viewConfiguration.getScaledMinimumFlingVelocity(); MAX_FLING_VELOCITY = viewConfiguration.getScaledMaximumFlingVelocity(); }
From source file:com.waz.zclient.pages.main.conversationlist.views.listview.SwipeListView.java
/** * CTOR - checking animation const and wrapping context to get rod of overscroll animation. *///w w w .j a v a 2s. c o m public SwipeListView(Context context) { super(new ContextWrapperEdgeEffect(context)); ((ContextWrapperEdgeEffect) getContext()).setEdgeEffectColor(Color.TRANSPARENT); touchSlop = 10; //ViewConfigurationCompat.getScaledPagingTouchSlop(configuration); ViewConfiguration vc = ViewConfiguration.get(getContext()); minFlingVelocity = vc.getScaledMinimumFlingVelocity(); maxFlingVelocity = vc.getScaledMaximumFlingVelocity(); listRowMenuIndicatorMaxSwipeOffset = context.getResources() .getDimensionPixelSize(R.dimen.list__menu_indicator__max_swipe_offset); }
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/*w w w. j av a 2 s .co 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.app.gongza.libs.view.scrollablelayout.ScrollableLayout.java
private void init(Context context) { 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: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. *///from ww w .j av a 2 s . c o m 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: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 .j av a 2 s . 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. *///from w w w. ja va 2 s.c o 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: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 w w w. j a v a 2 s . c o m*/ 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:com.xandy.calendar.month.MonthByWeekFragment.java
@Override public void onAttach(Activity activity) { super.onAttach(activity); mTZUpdater.run();/*from www .j a va2 s .c om*/ if (mAdapter != null) { mAdapter.setSelectedDay(mSelectedDay); } mIsDetached = false; ViewConfiguration viewConfig = ViewConfiguration.get(activity); mMinimumTwoMonthFlingVelocity = viewConfig.getScaledMaximumFlingVelocity() / 2; Resources res = activity.getResources(); mShowCalendarControls = Utils.getConfigBool(activity, R.bool.show_calendar_controls); // Synchronized the loading time of the month's events with the animation of the // calendar controls. if (mShowCalendarControls) { mEventsLoadingDelay = res.getInteger(R.integer.calendar_controls_animation_time); } mShowDetailsInMonth = res.getBoolean(R.bool.show_details_in_month); }
From source file:com.android.calendar.month.MonthByWeekFragment.java
@Override public void onAttach(Activity activity) { super.onAttach(activity); mTZUpdater.run();//from w ww . j av a 2s. co m if (mAdapter != null) { mAdapter.setSelectedDay(mSelectedDay); } mIsDetached = false; ViewConfiguration viewConfig = ViewConfiguration.get(activity); mMinimumTwoMonthFlingVelocity = viewConfig.getScaledMaximumFlingVelocity() / 2; Resources res = activity.getResources(); mShowCalendarControls = Utils.getConfigBool(activity, R.bool.show_calendar_controls); // Synchronized the loading time of the month's events with the // animation of the // calendar controls. if (mShowCalendarControls) { mEventsLoadingDelay = res.getInteger(R.integer.calendar_controls_animation_time); } mShowDetailsInMonth = res.getBoolean(R.bool.show_details_in_month); }