当前位置: 首页>>代码示例>>Java>>正文


Java ScrollerCompat类代码示例

本文整理汇总了Java中android.support.v4.widget.ScrollerCompat的典型用法代码示例。如果您正苦于以下问题:Java ScrollerCompat类的具体用法?Java ScrollerCompat怎么用?Java ScrollerCompat使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ScrollerCompat类属于android.support.v4.widget包,在下文中一共展示了ScrollerCompat类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: CustomViewDragHelper

import android.support.v4.widget.ScrollerCompat; //导入依赖的package包/类
/**
 * Apps should use ViewDragHelper.create() to get a new instance.
 * This will allow VDH to use internal compatibility implementations for different
 * platform versions.
 *
 * @param context Context to initialize config-dependent params from
 * @param forParent Parent view to monitor
 */
private CustomViewDragHelper(Context context, ViewGroup forParent, Callback cb) {
    if (forParent == null) {
        throw new IllegalArgumentException("Parent view may not be null");
    }
    if (cb == null) {
        throw new IllegalArgumentException("Callback may not be null");
    }

    mParentView = forParent;
    mCallback = cb;

    final ViewConfiguration vc = ViewConfiguration.get(context);
    final float density = context.getResources().getDisplayMetrics().density;
    mEdgeSize = (int) (EDGE_SIZE * density + 0.5f);

    mTouchSlop = vc.getScaledTouchSlop();
    mMaxVelocity = vc.getScaledMaximumFlingVelocity();
    mMinVelocity = vc.getScaledMinimumFlingVelocity();
    mScroller = ScrollerCompat.create(context, sInterpolator);
}
 
开发者ID:houshuai0816,项目名称:DragVideos,代码行数:29,代码来源:CustomViewDragHelper.java

示例2: ViewDragHelper

import android.support.v4.widget.ScrollerCompat; //导入依赖的package包/类
/**
 * Apps should use ViewDragHelper.create() to get a new instance. This will
 * allow VDH to use internal compatibility implementations for different
 * platform versions.
 *
 * @param context   Context to initialize config-dependent params from
 * @param forParent Parent view to monitor
 */
private ViewDragHelper(Context context, ViewGroup forParent, Callback cb) {
    if (forParent == null) {
        throw new IllegalArgumentException("Parent view may not be null");
    }
    if (cb == null) {
        throw new IllegalArgumentException("Callback may not be null");
    }

    mParentView = forParent;
    mCallback = cb;

    final ViewConfiguration vc = ViewConfiguration.get(context);
    final float density = context.getResources().getDisplayMetrics().density;
    mEdgeSize = (int) (EDGE_SIZE * density + 0.5f);

    mTouchSlop = vc.getScaledTouchSlop();
    mMaxVelocity = vc.getScaledMaximumFlingVelocity();
    mMinVelocity = vc.getScaledMinimumFlingVelocity();
    mScroller = ScrollerCompat.create(context, sInterpolator);
}
 
开发者ID:Zyj163,项目名称:yyox,代码行数:29,代码来源:ViewDragHelper.java

示例3: KDragViewHelper

import android.support.v4.widget.ScrollerCompat; //导入依赖的package包/类
/**
 * Apps should use ViewDragHelper.create() to get a new instance.
 * This will allow VDH to use internal compatibility implementations for different
 * platform versions.
 *
 * @param context Context to initialize config-dependent params from
 * @param forParent Parent view to monitor
 */
private KDragViewHelper(Context context, ViewGroup forParent, android.support.v4.widget.ViewDragHelper.Callback cb) {
    if (forParent == null) {
        throw new IllegalArgumentException("Parent view may not be null");
    }
    if (cb == null) {
        throw new IllegalArgumentException("Callback may not be null");
    }

    mParentView = forParent;
    mCallback = cb;

    final ViewConfiguration vc = ViewConfiguration.get(context);
    final float density = context.getResources().getDisplayMetrics().density;
    mEdgeSize = (int) (EDGE_SIZE * density + 0.5f);

    mTouchSlop = vc.getScaledTouchSlop();
    mMaxVelocity = vc.getScaledMaximumFlingVelocity();
    mMinVelocity = vc.getScaledMinimumFlingVelocity();
    mScroller = ScrollerCompat.create(context, sInterpolator);
}
 
开发者ID:Kaufland,项目名称:andswipeframework,代码行数:29,代码来源:KDragViewHelper.java

示例4: ViewDragHelper

import android.support.v4.widget.ScrollerCompat; //导入依赖的package包/类
/**
 * Apps should use ViewDragHelper.create() to get a new instance.
 * This will allow VDH to use internal compatibility implementations for different
 * platform versions.
 *
 * @param context   Context to initialize config-dependent params from
 * @param forParent Parent view to monitor
 */
private ViewDragHelper(Context context, ViewGroup forParent, Callback cb) {
    if (forParent == null) {
        throw new IllegalArgumentException("Parent view may not be null");
    }
    if (cb == null) {
        throw new IllegalArgumentException("Callback may not be null");
    }

    mParentView = forParent;
    mCallback = cb;

    final ViewConfiguration vc = ViewConfiguration.get(context);
    final float density = context.getResources().getDisplayMetrics().density;
    mEdgeSize = (int) (EDGE_SIZE * density + 0.5f);

    mTouchSlop = vc.getScaledTouchSlop();
    mMaxVelocity = vc.getScaledMaximumFlingVelocity();
    mMinVelocity = vc.getScaledMinimumFlingVelocity();
    mScroller = ScrollerCompat.create(context, sInterpolator);
}
 
开发者ID:Vinetos,项目名称:Hello-Music-droid,代码行数:29,代码来源:ViewDragHelper.java

示例5: ViewDragHelper

import android.support.v4.widget.ScrollerCompat; //导入依赖的package包/类
/**
 * Apps should use ViewDragHelper.create() to get a new instance. This will
 * allow VDH to use internal compatibility implementations for different
 * platform versions.
 *
 * @param context
 *            Context to initialize config-dependent params from
 * @param forParent
 *            Parent view to monitor
 */
private ViewDragHelper(Context context, ViewGroup forParent, Callback cb) {
	if (forParent == null) {
		throw new IllegalArgumentException("Parent view may not be null");
	}
	if (cb == null) {
		throw new IllegalArgumentException("Callback may not be null");
	}

	mParentView = forParent;
	mCallback = cb;

	final ViewConfiguration vc = ViewConfiguration.get(context);
	final float density = context.getResources().getDisplayMetrics().density;
	mEdgeSize = (int) (EDGE_SIZE * density + 0.5f);

	mTouchSlop = vc.getScaledTouchSlop();
	mMaxVelocity = vc.getScaledMaximumFlingVelocity();
	mMinVelocity = vc.getScaledMinimumFlingVelocity();
	mScroller = ScrollerCompat.create(context, sInterpolator);
}
 
开发者ID:dibakarece,项目名称:DMAudioStreamer,代码行数:31,代码来源:ViewDragHelper.java

示例6: ViewDragHelper

import android.support.v4.widget.ScrollerCompat; //导入依赖的package包/类
/**
 * Apps should use ViewDragHelper.create() to get a new instance.
 * This will allow VDH to use internal compatibility implementations for different
 * platform versions.
 *
 * @param context Context to initialize config-dependent params from
 * @param forParent Parent view to monitor
 */
private ViewDragHelper(Context context, ViewGroup forParent, Callback cb) {
    if (forParent == null) {
        throw new IllegalArgumentException("Parent view may not be null");
    }
    if (cb == null) {
        throw new IllegalArgumentException("Callback may not be null");
    }

    mParentView = forParent;
    mCallback = cb;

    final ViewConfiguration vc = ViewConfiguration.get(context);
    final float density = context.getResources().getDisplayMetrics().density;
    mEdgeSize = (int) (EDGE_SIZE * density + 0.5f);

    mTouchSlop = vc.getScaledTouchSlop();
    mMaxVelocity = vc.getScaledMaximumFlingVelocity();
    mMinVelocity = vc.getScaledMinimumFlingVelocity();
    mScroller = ScrollerCompat.create(context, sInterpolator);
}
 
开发者ID:eventtus,项目名称:photo-editor-android,代码行数:29,代码来源:ViewDragHelper.java

示例7: SlideViewDragHelper

import android.support.v4.widget.ScrollerCompat; //导入依赖的package包/类
/**
 * Apps should use ViewDragHelper.create() to get a new instance.
 * This will allow VDH to use internal compatibility implementations for different
 * platform versions.
 *
 * @param context   Context to initialize config-dependent params from
 * @param forParent Parent view to monitor
 */
private SlideViewDragHelper(Context context, ViewGroup forParent, SlideViewDragHelper.Callback cb) {
    if (forParent == null) {
        throw new IllegalArgumentException("Parent view may not be null");
    }
    if (cb == null) {
        throw new IllegalArgumentException("Callback may not be null");
    }

    mParentView = forParent;
    mCallback = cb;

    final ViewConfiguration vc = ViewConfiguration.get(context);
    final float density = context.getResources().getDisplayMetrics().density;
    mEdgeSize = (int) (EDGE_SIZE * density + 0.5f);

    mTouchSlop = vc.getScaledTouchSlop();
    mMaxVelocity = vc.getScaledMaximumFlingVelocity();
    mMinVelocity = vc.getScaledMinimumFlingVelocity();
    mScroller = ScrollerCompat.create(context, sInterpolator);
}
 
开发者ID:Zweihui,项目名称:Aurora,代码行数:29,代码来源:SlideViewDragHelper.java

示例8: ViewDragHelper

import android.support.v4.widget.ScrollerCompat; //导入依赖的package包/类
private ViewDragHelper(Context context, ViewGroup forParent, Callback cb) {
    if (forParent == null) {
        throw new IllegalArgumentException("Parent view may not be null");
    } else if (cb == null) {
        throw new IllegalArgumentException("Callback may not be null");
    } else {
        this.mParentView = forParent;
        this.mCallback = cb;
        ViewConfiguration vc = ViewConfiguration.get(context);
        this.mEdgeSize = (int) ((20.0f * context.getResources().getDisplayMetrics().density)
                + 0.5f);
        this.mTouchSlop = vc.getScaledTouchSlop();
        this.mMaxVelocity = (float) vc.getScaledMaximumFlingVelocity();
        this.mMinVelocity = (float) vc.getScaledMinimumFlingVelocity();
        this.mScroller = ScrollerCompat.create(context, sInterpolator);
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:18,代码来源:ViewDragHelper.java

示例9: fling

import android.support.v4.widget.ScrollerCompat; //导入依赖的package包/类
final boolean fling(CoordinatorLayout coordinatorLayout, V layout, int minOffset, int maxOffset, float velocityY) {
    if (this.mFlingRunnable != null) {
        layout.removeCallbacks(this.mFlingRunnable);
        this.mFlingRunnable = null;
    }
    if (this.mScroller == null) {
        this.mScroller = ScrollerCompat.create(layout.getContext());
    }
    this.mScroller.fling(0, getTopAndBottomOffset(), 0, Math.round(velocityY), 0, 0, minOffset, maxOffset);
    if (this.mScroller.computeScrollOffset()) {
        this.mFlingRunnable = new FlingRunnable(coordinatorLayout, layout);
        ViewCompat.postOnAnimation(layout, this.mFlingRunnable);
        return true;
    }
    onFlingFinished(coordinatorLayout, layout);
    return false;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:18,代码来源:HeaderBehavior.java

示例10: getLastVelocity

import android.support.v4.widget.ScrollerCompat; //导入依赖的package包/类
/**
 * 滚动结束后时的速率
 */
public float getLastVelocity() {
    Object mViewFlinger = Reflect.getMember(RecyclerView.class, this, "mViewFlinger");
    Object mScroller = Reflect.getMember(mViewFlinger, "mScroller");
    float currVelocity = 0f;
    if (mScroller instanceof OverScroller) {
        currVelocity = ((OverScroller) mScroller).getCurrVelocity();
    } else if (mScroller instanceof ScrollerCompat) {
        currVelocity = ((ScrollerCompat) mScroller).getCurrVelocity();
    } else {
        throw new IllegalArgumentException("未兼容的mScroller类型:" + mScroller.getClass().getSimpleName());
    }

    if (Float.isNaN(currVelocity)) {
        currVelocity = mLastVelocity;
    } else {
        mLastVelocity = currVelocity;
    }
    return currVelocity;
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:23,代码来源:RRecyclerView.java

示例11: TranslationViewDragHelper

import android.support.v4.widget.ScrollerCompat; //导入依赖的package包/类
/**
 * Apps should use ViewDragHelper.create() to get a new instance.
 * This will allow VDH to use internal compatibility implementations for different
 * platform versions.
 *
 * @param context Context to initialize config-dependent params from
 * @param forParent Parent view to monitor
 */
private TranslationViewDragHelper(Context context, ViewGroup forParent, Callback cb) {
    if (forParent == null) {
        throw new IllegalArgumentException("Parent view may not be null");
    }
    if (cb == null) {
        throw new IllegalArgumentException("Callback may not be null");
    }

    mParentView = forParent;
    mCallback = cb;

    final ViewConfiguration vc = ViewConfiguration.get(context);
    final float density = context.getResources().getDisplayMetrics().density;
    mEdgeSize = (int) (EDGE_SIZE * density + 0.5f);

    mTouchSlop = vc.getScaledTouchSlop();
    mMaxVelocity = vc.getScaledMaximumFlingVelocity();
    mMinVelocity = vc.getScaledMinimumFlingVelocity();
    mScroller = ScrollerCompat.create(context, sInterpolator);
}
 
开发者ID:Commit451,项目名称:TranslationViewDragHelper,代码行数:29,代码来源:TranslationViewDragHelper.java

示例12: ViewDragHelper

import android.support.v4.widget.ScrollerCompat; //导入依赖的package包/类
/**
 * Apps should use ViewDragHelper.create() to get a new instance. This will
 * allow VDH to use internal compatibility implementations for different
 * platform versions.
 *
 * @param context   Context to initialize config-dependent params from
 * @param forParent Parent view to monitor
 */
private ViewDragHelper(Context context, ViewGroup forParent, Callback cb) {
    if (forParent == null) {
        throw new IllegalArgumentException("Parent view may not be null");
    }
    if (cb == null) {
        throw new IllegalArgumentException("Callback may not be null");
    }

    mParentView = forParent;
    mCallback = cb;

    final ViewConfiguration vc = ViewConfiguration.get(context);
    density = context.getResources().getDisplayMetrics().density;
    mEdgeSize = (int) (EDGE_SIZE * density + 0.5f);

    mTouchSlop = vc.getScaledTouchSlop();
    mMaxVelocity = vc.getScaledMaximumFlingVelocity();
    mMinVelocity = vc.getScaledMinimumFlingVelocity();
    mScroller = ScrollerCompat.create(context, sInterpolator);
}
 
开发者ID:zwx191044354,项目名称:RxZhiHu,代码行数:29,代码来源:ViewDragHelper.java

示例13: init

import android.support.v4.widget.ScrollerCompat; //导入依赖的package包/类
/** 初始化一些常量 */
private void init() {
	//把一个值从dip转换成px
	mIndicatorHeight = UIUtils.dip2px(mIndicatorHeight);
	mDividerPadding = UIUtils.dip2px(mDividerPadding);
	mTabPadding = UIUtils.dip2px(mTabPadding);
	mDividerWidth = UIUtils.dip2px(mDividerWidth);
	mTabTextSize = UIUtils.dip2px(mTabTextSize);
	//创建一个scroller
	mScroller = ScrollerCompat.create(mActivity);
	//获取一个系统关于View的常量配置类
	final ViewConfiguration configuration = ViewConfiguration.get(mActivity);
	//获取滑动的最小距离
	mTouchSlop = configuration.getScaledTouchSlop();
	//获取fling的最小速度
	mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
	//获取fling的最大速度
	mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();

	mLeftEdge = new EdgeEffectCompat(mActivity);
	mRightEdge = new EdgeEffectCompat(mActivity);
}
 
开发者ID:cuilitang,项目名称:CuiMarket,代码行数:23,代码来源:PagerTab.java

示例14: ViewDragHelper

import android.support.v4.widget.ScrollerCompat; //导入依赖的package包/类
/**
 * Apps should use ViewDragHelper.create() to get a new instance. This will
 * allow VDH to use internal compatibility implementations for different
 * platform versions.
 *
 * @param context   Context to initialize config-dependent params from
 * @param forParent Parent view to monitor
 */
private ViewDragHelper(Context context, ViewGroup forParent, Callback cb) {
    if (forParent == null) {
        throw new IllegalArgumentException("Parent view may not be null");
    }
    if (cb == null) {
        throw new IllegalArgumentException("Callback may not be null");
    }

    mParentView = forParent;
    mCallback = cb;

    final ViewConfiguration vc = ViewConfiguration.get(context);
    final float density = context.getResources().getDisplayMetrics().density;
    mEdgeSize = (int) (EDGE_SIZE * density + 0.5f);
    mTouchSlop = vc.getScaledTouchSlop();
    mMaxVelocity = vc.getScaledMaximumFlingVelocity();
    mMinVelocity = vc.getScaledMinimumFlingVelocity();
    mScroller = ScrollerCompat.create(context, sInterpolator);
}
 
开发者ID:pinguo-sunjianfei,项目名称:Android-Application-ZJB,代码行数:28,代码来源:ViewDragHelper.java

示例15: ViewDragHelper

import android.support.v4.widget.ScrollerCompat; //导入依赖的package包/类
/**
 * Apps should use ViewDragHelper.create() to get a new instance. This will
 * allow VDH to use internal compatibility implementations for different
 * platform versions.
 * 
 * @param context Context to initialize config-dependent params from
 * @param forParent Parent view to monitor
 */
private ViewDragHelper(Context context, ViewGroup forParent, Callback cb) {
    if (forParent == null) {
        throw new IllegalArgumentException("Parent view may not be null");
    }
    if (cb == null) {
        throw new IllegalArgumentException("Callback may not be null");
    }

    mParentView = forParent;
    mCallback = cb;

    final ViewConfiguration vc = ViewConfiguration.get(context);
    final float density = context.getResources().getDisplayMetrics().density;
    mEdgeSize = (int) (EDGE_SIZE * density + 0.5f);

    mTouchSlop = vc.getScaledTouchSlop();
    mMaxVelocity = vc.getScaledMaximumFlingVelocity();
    mMinVelocity = vc.getScaledMinimumFlingVelocity();
    mScroller = ScrollerCompat.create(context, sInterpolator);
}
 
开发者ID:LiangMaYong,项目名称:android-base,代码行数:29,代码来源:ViewDragHelper.java


注:本文中的android.support.v4.widget.ScrollerCompat类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。