Example usage for android.view ViewConfiguration getScaledMinimumFlingVelocity

List of usage examples for android.view ViewConfiguration getScaledMinimumFlingVelocity

Introduction

In this page you can find the example usage for android.view ViewConfiguration getScaledMinimumFlingVelocity.

Prototype

public int getScaledMinimumFlingVelocity() 

Source Link

Usage

From source file:Main.java

/**
 * initialize method, called inside the Chart.init() method.
 *
 * @param context/*  w  w  w .j a  va 2  s . c o  m*/
 */
@SuppressWarnings("deprecation")
public static void init(Context context) {

    if (context == null) {
        // noinspection deprecation
        mMinimumFlingVelocity = ViewConfiguration.getMinimumFlingVelocity();
        // noinspection deprecation
        mMaximumFlingVelocity = ViewConfiguration.getMaximumFlingVelocity();

        Log.e("MPChartLib-Utils", "Utils.init(...) PROVIDED CONTEXT OBJECT IS NULL");

    } else {
        ViewConfiguration viewConfiguration = ViewConfiguration.get(context);
        mMinimumFlingVelocity = viewConfiguration.getScaledMinimumFlingVelocity();
        mMaximumFlingVelocity = viewConfiguration.getScaledMaximumFlingVelocity();

        Resources res = context.getResources();
        mMetrics = res.getDisplayMetrics();
    }
}

From source file:ngoctdn.vng.gesture.CupcakeGestureDetector.java

public CupcakeGestureDetector(Context context) {
    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
    mTouchSlop = configuration.getScaledTouchSlop();
}

From source file:ngoctdn.vng.gesture.DragGestureDetector.java

public DragGestureDetector(Context context) {
    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
    mTouchSlop = configuration.getScaledTouchSlop();
}

From source file:cn.goodjobs.common.view.photodraweeview.ScaleDragDetector.java

public ScaleDragDetector(Context context, OnScaleDragGestureListener scaleDragGestureListener) {
    mScaleDetector = new ScaleGestureDetector(context, this);
    mScaleDragGestureListener = scaleDragGestureListener;

    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
    mTouchSlop = configuration.getScaledTouchSlop();
}

From source file:com.example.tt.pullrefresh.widget.SwipItemLayout.java

public SwipItemLayout(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    final ViewConfiguration viewConfiguration = ViewConfiguration.get(context);
    MIN_FLING_VELOCITY = viewConfiguration.getScaledMinimumFlingVelocity();
}

From source file:com.personal.taskmanager2.utilities.RecyclerViewTouchListener.java

public RecyclerViewTouchListener(RecyclerView recyclerView, SwipeRefreshLayout refreshLayout,
        DismissCallbacks callbacks) {/*ww  w. java 2 s. com*/
    ViewConfiguration vc = ViewConfiguration.get(recyclerView.getContext());
    mMinFlingVelocity = vc.getScaledMinimumFlingVelocity() * 16;
    mMaxFlingVelocity = vc.getScaledMaximumFlingVelocity();
    mAnimationTime = recyclerView.getContext().getResources()
            .getInteger(android.R.integer.config_shortAnimTime);
    mSlop = vc.getScaledTouchSlop();
    mRecyclerView = recyclerView;
    mRefreshLayout = refreshLayout;
    mCallbacks = callbacks;
}

From source file:com.github.shareme.gwsswwipetodismiss.library.SwipeDismissTouchListener.java

/**
 * Constructs a new swipe-to-dismiss touch listener for the given view.
 * //  w  w  w.  ja v a2 s. com
 * @param view
 *            The view to make dismissable.
 * @param token
 *            An optional token/cookie object to be passed through to the
 *            callback.
 * @param callback
 *            The callback to trigger when the user has indicated that she
 *            would like to dismiss this view.
 */
public SwipeDismissTouchListener(View view, Object token, OnDismissCallback callback) {
    ViewConfiguration vc = ViewConfiguration.get(view.getContext());
    mSlop = vc.getScaledTouchSlop();
    mMinFlingVelocity = vc.getScaledMinimumFlingVelocity();
    mMaxFlingVelocity = vc.getScaledMaximumFlingVelocity();
    mAnimationTime = view.getContext().getResources().getInteger(android.R.integer.config_shortAnimTime);
    mView = view;
    mToken = token;
    mCallback = callback;
}

From source file:com.nononsenseapps.feeder.ui.SwipeDismissTouchListener.java

/**
 * Constructs a new swipe-to-dismiss touch listener for the given view.
 *
 * @param view     The view to make dismissable.
 * @param token    An optional token/cookie object to be passed through to the callback.
 * @param callbacks The callback to trigger when the user has indicated that she would like to
 *                 dismiss this view.//from w  ww.  j  a  v a  2  s.  co m
 */
public SwipeDismissTouchListener(View view, Object token, DismissCallbacks callbacks) {
    ViewConfiguration vc = ViewConfiguration.get(view.getContext());
    mSlop = vc.getScaledTouchSlop();
    mMinFlingVelocity = vc.getScaledMinimumFlingVelocity() * 16;
    mMaxFlingVelocity = vc.getScaledMaximumFlingVelocity();
    mAnimationTime = view.getContext().getResources().getInteger(android.R.integer.config_shortAnimTime);
    mView = view;
    mSwipingView = callbacks.getSwipingView();

    mToken = token;
    mCallbacks = callbacks;

    mInterpolator = new FastOutLinearInInterpolator();
}

From source file:com.arthurpitman.common.SlidingPanel.java

/**
 * Performs shared initialization of the {@code SlidingPanel}.
 *//*from w  ww.j  a  v a2 s  .  co m*/
private final void initializeView() {
    scroller = new Scroller(getContext());
    final ViewConfiguration configuration = ViewConfiguration.get(getContext());
    touchSlop = configuration.getScaledTouchSlop();
    minimumflingVelocity = configuration.getScaledMinimumFlingVelocity() * 4;
}

From source file:com.sj.android.appusage.ui.widgets.listview.SwipeListViewTouchListener.java

/**
 * Constructor/*w  w  w.  j a  v a2 s.  com*/
 *
 * @param swipeListView  SwipeListView
 * @param swipeFrontView front view Identifier
 * @param swipeBackView  back view Identifier
 */
public SwipeListViewTouchListener(SwipeListView swipeListView, int swipeFrontView, int swipeBackView) {
    this.swipeFrontView = swipeFrontView;
    this.swipeBackView = swipeBackView;
    ViewConfiguration vc = ViewConfiguration.get(swipeListView.getContext());
    slop = vc.getScaledTouchSlop();
    minFlingVelocity = vc.getScaledMinimumFlingVelocity();
    maxFlingVelocity = vc.getScaledMaximumFlingVelocity();
    this.swipeListView = swipeListView;
}