Java Code Examples for android.widget.Scroller#setFriction()

The following examples show how to use android.widget.Scroller#setFriction() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HorizontalListView.java    From BigApp_Discuz_Android with Apache License 2.0 4 votes vote down vote up
/**
 * Sets the friction for the provided scroller
 */
public static void setFriction(Scroller scroller, float friction) {
    if (scroller != null) {
        scroller.setFriction(friction);
    }
}
 
Example 2
Source File: HorizontalListView.java    From sealtalk-android with MIT License 4 votes vote down vote up
/** Sets the friction for the provided scroller */
public static void setFriction(Scroller scroller, float friction) {
    if (scroller != null) {
        scroller.setFriction(friction);
    }
}
 
Example 3
Source File: HorizontalListView.java    From RxZhihuDaily with MIT License 4 votes vote down vote up
/**
 * Sets the friction for the provided scroller
 */
public static void setFriction(Scroller scroller, float friction) {
    if (scroller != null) {
        scroller.setFriction(friction);
    }
}
 
Example 4
Source File: EPG.java    From android-tv-epg with MIT License 4 votes vote down vote up
public EPG(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    setWillNotDraw(false);

    resetBoundaries();

    mDrawingRect = new Rect();
    mClipRect = new Rect();
    mMeasuringRect = new Rect();
    mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mGestureDetector = new GestureDetector(context, new OnGestureListener());
    mChannelImageCache = Maps.newHashMap();
    mChannelImageTargetCache = Maps.newHashMap();

    // Adding some friction that makes the epg less flappy.
    mScroller = new Scroller(context);
    mScroller.setFriction(0.2f);

    mEPGBackground = getResources().getColor(R.color.epg_background);

    mChannelLayoutMargin = getResources().getDimensionPixelSize(R.dimen.epg_channel_layout_margin);
    mChannelLayoutPadding = getResources().getDimensionPixelSize(R.dimen.epg_channel_layout_padding);
    mChannelLayoutHeight = getResources().getDimensionPixelSize(R.dimen.epg_channel_layout_height);
    mChannelLayoutWidth = getResources().getDimensionPixelSize(R.dimen.epg_channel_layout_width);
    mChannelLayoutBackground = getResources().getColor(R.color.epg_channel_layout_background);

    mEventLayoutBackground = getResources().getColor(R.color.epg_event_layout_background);
    mEventLayoutBackgroundCurrent = getResources().getColor(R.color.epg_event_layout_background_current);
    mEventLayoutTextColor = getResources().getColor(R.color.epg_event_layout_text);
    mEventLayoutTextSize = getResources().getDimensionPixelSize(R.dimen.epg_event_layout_text);

    mTimeBarHeight = getResources().getDimensionPixelSize(R.dimen.epg_time_bar_height);
    mTimeBarTextSize = getResources().getDimensionPixelSize(R.dimen.epg_time_bar_text);
    mTimeBarLineWidth = getResources().getDimensionPixelSize(R.dimen.epg_time_bar_line_width);
    mTimeBarLineColor = getResources().getColor(R.color.epg_time_bar);

    mResetButtonSize = getResources().getDimensionPixelSize(R.dimen.epg_reset_button_size);
    mResetButtonMargin = getResources().getDimensionPixelSize(R.dimen.epg_reset_button_margin);

    BitmapFactory.Options options = new BitmapFactory.Options();
    options.outWidth = mResetButtonSize;
    options.outHeight = mResetButtonSize;
    mResetButtonIcon = BitmapFactory.decodeResource(getResources(), R.drawable.reset, options);
}
 
Example 5
Source File: HorizontalListView.java    From GalleryFinal with Apache License 2.0 4 votes vote down vote up
/** Sets the friction for the provided scroller */
public static void setFriction(Scroller scroller, float friction) {
    if (scroller != null) {
        scroller.setFriction(friction);
    }
}