Java Code Examples for android.view.ViewConfiguration#getScaledOverflingDistance()

The following examples show how to use android.view.ViewConfiguration#getScaledOverflingDistance() . 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: HorizontalIconView.java    From auid2 with Apache License 2.0 6 votes vote down vote up
/**
 * Perform one-time initialization
 *
 * @param context Context to load Resources and ViewConfiguration data
 */
private void init(Context context) {
    final Resources res = context.getResources();
    mIconSize = res.getDimensionPixelSize(R.dimen.icon_size);
    mIconSpacing = res.getDimensionPixelSize(R.dimen.icon_spacing);

    // Cache ViewConfiguration values
    final ViewConfiguration config = ViewConfiguration.get(context);
    mTouchSlop = config.getScaledTouchSlop();
    mMinimumVelocity = config.getScaledMinimumFlingVelocity();
    mMaximumVelocity = config.getScaledMaximumFlingVelocity();
    mOverflingDistance = config.getScaledOverflingDistance();
    mOverscrollDistance = config.getScaledOverscrollDistance();

    // Verify this View will be drawn
    setWillNotDraw(false);

    // Other setup
    mEdgeEffectLeft = new EdgeEffectCompat(context);
    mEdgeEffectRight = new EdgeEffectCompat(context);
    mScroller = new OverScroller(context);
    setFocusable(true);
}
 
Example 2
Source File: HorizontalScrollView.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
private void initScrollView() {
    mScroller = new OverScroller(getContext());
    setFocusable(true);
    setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
    setWillNotDraw(false);
    final ViewConfiguration configuration = ViewConfiguration.get(mContext);
    mTouchSlop = configuration.getScaledTouchSlop();
    mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
    mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
    mOverscrollDistance = configuration.getScaledOverscrollDistance();
    mOverflingDistance = configuration.getScaledOverflingDistance();
    mHorizontalScrollFactor = configuration.getScaledHorizontalScrollFactor();
}
 
Example 3
Source File: ScrollView.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
private void initScrollView() {
    mScroller = new OverScroller(getContext());
    setFocusable(true);
    setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
    setWillNotDraw(false);
    final ViewConfiguration configuration = ViewConfiguration.get(mContext);
    mTouchSlop = configuration.getScaledTouchSlop();
    mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
    mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
    mOverscrollDistance = configuration.getScaledOverscrollDistance();
    mOverflingDistance = configuration.getScaledOverflingDistance();
    mVerticalScrollFactor = configuration.getScaledVerticalScrollFactor();
}
 
Example 4
Source File: AnScrollView.java    From Animer with Apache License 2.0 5 votes vote down vote up
private void initScrollView() {
    mScroller = new AnOverScroller(getContext());
    //mScroller.setVertScroll(isVertScroll());
    setFocusable(true);
    setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
    setWillNotDraw(false);
    final ViewConfiguration configuration = ViewConfiguration.get(getContext());
    mTouchSlop = configuration.getScaledTouchSlop();
    mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
    mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
    mOverscrollDistance = configuration.getScaledOverscrollDistance();
    mOverflingDistance = configuration.getScaledOverflingDistance();
}
 
Example 5
Source File: AbsHListView.java    From letv with Apache License 2.0 5 votes vote down vote up
private void initAbsListView() {
    setClickable(true);
    setFocusableInTouchMode(true);
    setWillNotDraw(false);
    setAlwaysDrawnWithCacheEnabled(false);
    setScrollingCacheEnabled(true);
    ViewConfiguration configuration = ViewConfiguration.get(getContext());
    this.mTouchSlop = configuration.getScaledTouchSlop();
    this.mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
    this.mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
    this.mOverscrollDistance = configuration.getScaledOverscrollDistance() + 200;
    this.mOverflingDistance = configuration.getScaledOverflingDistance() + 100;
    this.mViewHelper = ViewHelperFactory.create(this);
}
 
Example 6
Source File: BothScrollView.java    From Nimingban with Apache License 2.0 5 votes vote down vote up
private void initBothScrollView(Context context) {
    mScroller = new SmoothOverScroller(context);
    setFocusable(true);
    setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
    setWillNotDraw(false);
    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mTouchSlop = configuration.getScaledTouchSlop();
    mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
    mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
    mOverscrollDistance = configuration.getScaledOverscrollDistance();
    mOverflingDistance = configuration.getScaledOverflingDistance();
}
 
Example 7
Source File: AbsHListView.java    From Klyph with MIT License 5 votes vote down vote up
private void initAbsListView() {
	setClickable( true );
	setFocusableInTouchMode( true );
	setWillNotDraw( false );
	setAlwaysDrawnWithCacheEnabled( false );
	setScrollingCacheEnabled( true );

	final ViewConfiguration configuration = ViewConfiguration.get( getContext() );
	mTouchSlop = configuration.getScaledTouchSlop();
	mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
	mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
	mOverscrollDistance = configuration.getScaledOverscrollDistance();
	mOverflingDistance = configuration.getScaledOverflingDistance();
	mViewHelper = ViewHelperFactory.create( this );
}
 
Example 8
Source File: FreeFlowContainer.java    From UltimateAndroid with Apache License 2.0 4 votes vote down vote up
@Override
protected void init(Context context) {

	viewpool = new ViewPool();
	frames = new LinkedHashMap<Object, FreeFlowItem>();

	ViewConfiguration configuration = ViewConfiguration.get(context);
	maxFlingVelocity = configuration.getScaledMaximumFlingVelocity();
	minFlingVelocity = configuration.getScaledMinimumFlingVelocity();
	overflingDistance = configuration.getScaledOverflingDistance();
	/*overscrollDistance = configuration.getScaledOverscrollDistance();*/

	touchSlop = configuration.getScaledTouchSlop();

	scroller = new OverScroller(context);

	setEdgeEffectsEnabled(true);

}
 
Example 9
Source File: FreeFlowContainer.java    From UltimateAndroid with Apache License 2.0 4 votes vote down vote up
@Override
protected void init(Context context) {

	viewpool = new ViewPool();
	frames = new LinkedHashMap<Object, FreeFlowItem>();

	ViewConfiguration configuration = ViewConfiguration.get(context);
	maxFlingVelocity = configuration.getScaledMaximumFlingVelocity();
	minFlingVelocity = configuration.getScaledMinimumFlingVelocity();
	overflingDistance = configuration.getScaledOverflingDistance();
	/*overscrollDistance = configuration.getScaledOverscrollDistance();*/

	touchSlop = configuration.getScaledTouchSlop();

	scroller = new OverScroller(context);

	setEdgeEffectsEnabled(true);

}
 
Example 10
Source File: FreeFlowContainer.java    From FreeFlow with Apache License 2.0 4 votes vote down vote up
@Override
protected void init(Context context) {

	viewpool = new ViewPool();
	frames = new LinkedHashMap<Object, FreeFlowItem>();

	ViewConfiguration configuration = ViewConfiguration.get(context);
	maxFlingVelocity = configuration.getScaledMaximumFlingVelocity();
	minFlingVelocity = configuration.getScaledMinimumFlingVelocity();
	overflingDistance = configuration.getScaledOverflingDistance();
	/*overscrollDistance = configuration.getScaledOverscrollDistance();*/

	touchSlop = configuration.getScaledTouchSlop();

	scroller = new OverScroller(context);

	setEdgeEffectsEnabled(true);

}