Example usage for android.view ViewConfiguration getScrollFriction

List of usage examples for android.view ViewConfiguration getScrollFriction

Introduction

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

Prototype

public static float getScrollFriction() 

Source Link

Document

The amount of friction applied to scrolls and flings.

Usage

From source file:com.redinput.datetimepickercompat.date.DayPickerView.java

@SuppressLint("NewApi")
protected void setUpListView() {
    // Transparent background on scroll
    setCacheColorHint(0);/*from ww  w . j a  v a 2s  .c  o m*/
    // No dividers
    setDivider(null);
    // Items are clickable
    setItemsCanFocus(true);
    // The thumb gets in the way, so disable it
    setFastScrollEnabled(false);
    setVerticalScrollBarEnabled(false);
    setOnScrollListener(this);
    setFadingEdgeLength(0);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        // Make the scrolling behavior nicer
        setFriction(ViewConfiguration.getScrollFriction() * mFriction);
    }
}

From source file:com.etmay.brescrollpager.ui.MyScroller.java

/**
 * Create a Scroller with the specified interpolator. If the interpolator is
 * null, the default (viscous) interpolator will be used. Specify whether or
 * not to support progressive "flywheel" behavior in flinging.
 */// ww  w.jav  a  2  s  . com
public MyScroller(Context context, Interpolator interpolator, boolean flywheel) {
    mFinished = true;
    if (interpolator == null) {
        //            mInterpolator = new LinearOutSlowInInterpolator();
        mInterpolator = new OvershootInterpolator(1.1f);
    } else {
        //            mInterpolator = interpolator;
        mInterpolator = new LinearOutSlowInInterpolator();
        //            mInterpolator = new DecelerateInterpolator();
    }

    mPpi = context.getResources().getDisplayMetrics().density * 160.0f;
    mDeceleration = computeDeceleration(ViewConfiguration.getScrollFriction());
    mFlywheel = flywheel;

    mPhysicalCoeff = computeDeceleration(0.84f); // look and feel tuning
}

From source file:com.android.calendar.month.SimpleDayPickerFragment.java

/**
 * Sets all the required fields for the list view. Override this method to
 * set a different list view behavior.//  w  w w . ja va  2  s.co  m
 */
protected void setUpListView() {
    // Configure the listview
    mListView = getListView();
    // Transparent background on scroll
    mListView.setCacheColorHint(0);
    // No dividers
    mListView.setDivider(null);
    // Items are clickable
    mListView.setItemsCanFocus(true);
    // The thumb gets in the way, so disable it
    mListView.setFastScrollEnabled(false);
    mListView.setVerticalScrollBarEnabled(false);
    mListView.setOnScrollListener(this);
    mListView.setFadingEdgeLength(0);
    // Make the scrolling behavior nicer
    mListView.setFriction(ViewConfiguration.getScrollFriction() * mFriction);
}