本文整理汇总了Java中android.support.v4.widget.EdgeEffectCompat类的典型用法代码示例。如果您正苦于以下问题:Java EdgeEffectCompat类的具体用法?Java EdgeEffectCompat怎么用?Java EdgeEffectCompat使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
EdgeEffectCompat类属于android.support.v4.widget包,在下文中一共展示了EdgeEffectCompat类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initViewPager
import android.support.v4.widget.EdgeEffectCompat; //导入依赖的package包/类
void initViewPager() {
setWillNotDraw(false);
setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
setFocusable(true);
final Context context = getContext();
mScroller = new Scroller(context, sInterpolator);
final ViewConfiguration configuration = ViewConfiguration.get(context);
final float density = context.getResources().getDisplayMetrics().density;
mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
mMinimumVelocity = (int) (MIN_FLING_VELOCITY * density);
mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
mLeftEdge = new EdgeEffectCompat(context);
mRightEdge = new EdgeEffectCompat(context);
mFlingDistance = (int) (MIN_DISTANCE_FOR_FLING * density);
mCloseEnough = (int) (CLOSE_ENOUGH * density);
mDefaultGutterSize = (int) (DEFAULT_GUTTER_SIZE * density);
ViewCompat.setAccessibilityDelegate(this, new MyAccessibilityDelegate());
if (ViewCompat.getImportantForAccessibility(this) == ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
ViewCompat.setImportantForAccessibility(this,
ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);
}
}
示例2: prepare
import android.support.v4.widget.EdgeEffectCompat; //导入依赖的package包/类
private void prepare(AttributeSet attrs)
{
setFocusable(true);
setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
setWillNotDraw(false);
mScroller = new Scroller(getContext());
mScaleGestureDetector = new ScaleGestureDetector(getContext(), mScaleListener);
mGestureDetector = new GestureDetectorCompat(getContext(), mGestureListener);
if (attrs != null)
{
TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.CustomViewExtension, 0, 0);
autoScrollMargins = a.getDimensionPixelSize(R.styleable.CustomViewExtension_autoScrollMargins, 0);
a.recycle();
}
mEdgeGlowLeft = new EdgeEffectCompat(getContext());
mEdgeGlowTop = new EdgeEffectCompat(getContext());
mEdgeGlowRight = new EdgeEffectCompat(getContext());
mEdgeGlowBottom = new EdgeEffectCompat(getContext());
setWillNotDraw(false);
}
示例3: init
import android.support.v4.widget.EdgeEffectCompat; //导入依赖的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);
}
示例4: Viewport
import android.support.v4.widget.EdgeEffectCompat; //导入依赖的package包/类
/**
* creates the viewport
*
* @param graphView graphview
*/
Viewport(ChartView graphView) {
mScroller = new OverScroller(graphView.getContext());
mEdgeEffectTop = new EdgeEffectCompat(graphView.getContext());
mEdgeEffectBottom = new EdgeEffectCompat(graphView.getContext());
mEdgeEffectLeft = new EdgeEffectCompat(graphView.getContext());
mEdgeEffectRight = new EdgeEffectCompat(graphView.getContext());
mGestureDetector = new GestureDetector(graphView.getContext(), mGestureListener);
mScaleGestureDetector = new ScaleGestureDetector(graphView.getContext(), mScaleGestureListener);
mGraphView = graphView;
mXAxisBoundsStatus = AxisBoundsStatus.INITIAL;
mYAxisBoundsStatus = AxisBoundsStatus.INITIAL;
mBackgroundColor = Color.TRANSPARENT;
mPaint = new Paint();
}
示例5: initViewPager
import android.support.v4.widget.EdgeEffectCompat; //导入依赖的package包/类
void initViewPager() {
setWillNotDraw(false);
setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
setFocusable(true);
final Context context = getContext();
mScroller = new Scroller(context, sInterpolator);
final ViewConfiguration configuration = ViewConfiguration.get(context);
final float density = context.getResources().getDisplayMetrics().density;
mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
mMinimumVelocity = (int) (MIN_FLING_VELOCITY * density);
mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
mTopEdge = new EdgeEffectCompat(context);
mBottomEdge = new EdgeEffectCompat(context);
mFlingDistance = (int) (MIN_DISTANCE_FOR_FLING * density);
mCloseEnough = (int) (CLOSE_ENOUGH * density);
mDefaultGutterSize = (int) (DEFAULT_GUTTER_SIZE * density);
ViewCompat.setAccessibilityDelegate(this, new MyAccessibilityDelegate());
if (ViewCompat.getImportantForAccessibility(this)
== ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
ViewCompat.setImportantForAccessibility(this, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);
}
}
示例6: initViewPager
import android.support.v4.widget.EdgeEffectCompat; //导入依赖的package包/类
void initViewPager() {
setWillNotDraw(false);
setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
setFocusable(true);
final Context context = getContext();
mScroller = new Scroller(context, sInterpolator);
final float density = context.getResources().getDisplayMetrics().density;
mLeftEdge = new EdgeEffectCompat(context);
mRightEdge = new EdgeEffectCompat(context);
ViewCompat.setAccessibilityDelegate(this, new MyAccessibilityDelegate());
if (ViewCompat.getImportantForAccessibility(this)
== ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
ViewCompat.setImportantForAccessibility(this,
ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);
}
}
示例7: updateGlowSize
import android.support.v4.widget.EdgeEffectCompat; //导入依赖的package包/类
private static void updateGlowSize(RecyclerView rv, EdgeEffectCompat glow, int dir) {
int width = rv.getMeasuredWidth();
int height = rv.getMeasuredHeight();
if (getClipToPadding(rv)) {
width -= rv.getPaddingLeft() + rv.getPaddingRight();
height -= rv.getPaddingTop() + rv.getPaddingBottom();
}
width = Math.max(0, width);
height = Math.max(0, height);
if (dir == EDGE_LEFT || dir == EDGE_RIGHT) {
int t = width;
width = height;
height = t;
}
glow.setSize(width, height);
}
开发者ID:fabricethilaw,项目名称:expandable-recyclerview-with-gridlayout,代码行数:21,代码来源:BaseEdgeEffectDecorator.java
示例8: initViewPager
import android.support.v4.widget.EdgeEffectCompat; //导入依赖的package包/类
void initViewPager() {
setWillNotDraw(false);
setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
setFocusable(true);
final Context context = getContext();
mScroller = new Scroller(context, sInterpolator);
final ViewConfiguration configuration = ViewConfiguration.get(context);
mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
mLeftEdge = new EdgeEffectCompat(context);
mRightEdge = new EdgeEffectCompat(context);
final float density = context.getResources().getDisplayMetrics().density;
mFlingDistance = (int) (MIN_DISTANCE_FOR_FLING * density);
}
示例9: resetTouch
import android.support.v4.widget.EdgeEffectCompat; //导入依赖的package包/类
private void resetTouch()
{
if (this.mVelocityTracker != null) {
this.mVelocityTracker.clear();
}
stopNestedScroll();
EdgeEffectCompat localEdgeEffectCompat = this.mLeftGlow;
boolean bool = false;
if (localEdgeEffectCompat != null) {
bool = this.mLeftGlow.onRelease();
}
if (this.mTopGlow != null) {
bool |= this.mTopGlow.onRelease();
}
if (this.mRightGlow != null) {
bool |= this.mRightGlow.onRelease();
}
if (this.mBottomGlow != null) {
bool |= this.mBottomGlow.onRelease();
}
if (bool) {
ViewCompat.postInvalidateOnAnimation(this);
}
}
示例10: initViewPager
import android.support.v4.widget.EdgeEffectCompat; //导入依赖的package包/类
private void initViewPager()
{
setWillNotDraw(false);
setDescendantFocusability(262144);
setFocusable(true);
Context localContext = getContext();
this.mScroller = new Scroller(localContext, sInterpolator);
ViewConfiguration localViewConfiguration = ViewConfiguration.get(localContext);
float f = localContext.getResources().getDisplayMetrics().density;
this.mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(localViewConfiguration);
this.mMinimumVelocity = ((int)(400.0F * f));
this.mMaximumVelocity = localViewConfiguration.getScaledMaximumFlingVelocity();
this.mLeftEdge = new EdgeEffectCompat(localContext);
this.mRightEdge = new EdgeEffectCompat(localContext);
this.mFlingDistance = ((int)(25.0F * f));
this.mCloseEnough = ((int)(2.0F * f));
this.mDefaultGutterSize = ((int)(16.0F * f));
ViewCompat.setAccessibilityDelegate(this, new MyAccessibilityDelegate());
if (ViewCompat.getImportantForAccessibility(this) == 0) {
ViewCompat.setImportantForAccessibility(this, 1);
}
}
示例11: HorizontalListView
import android.support.v4.widget.EdgeEffectCompat; //导入依赖的package包/类
public HorizontalListView(Context context, AttributeSet attrs) {
super(context, attrs);
mEdgeGlowLeft = new EdgeEffectCompat(context);
mEdgeGlowRight = new EdgeEffectCompat(context);
mGestureDetector = new GestureDetector(context, mGestureListener);
bindGestureDetector();
initView();
retrieveXmlConfiguration(context, attrs);
setWillNotDraw(false);
// If the OS version is high enough then set the friction on the fling
// tracker */
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
HoneycombPlus.setFriction(mFlingTracker, FLING_FRICTION);
}
}
示例12: Viewport
import android.support.v4.widget.EdgeEffectCompat; //导入依赖的package包/类
/**
* creates the viewport
*
* @param graphView graphview
*/
Viewport(GraphView graphView) {
mScroller = new OverScroller(graphView.getContext());
mEdgeEffectTop = new EdgeEffectCompat(graphView.getContext());
mEdgeEffectBottom = new EdgeEffectCompat(graphView.getContext());
mEdgeEffectLeft = new EdgeEffectCompat(graphView.getContext());
mEdgeEffectRight = new EdgeEffectCompat(graphView.getContext());
mGestureDetector = new GestureDetector(graphView.getContext(), mGestureListener);
mScaleGestureDetector = new ScaleGestureDetector(graphView.getContext(), mScaleGestureListener);
mGraphView = graphView;
mXAxisBoundsStatus = AxisBoundsStatus.INITIAL;
mYAxisBoundsStatus = AxisBoundsStatus.INITIAL;
mBackgroundColor = Color.TRANSPARENT;
mPaint = new Paint();
}
示例13: init
import android.support.v4.widget.EdgeEffectCompat; //导入依赖的package包/类
/**
* 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);
}
示例14: setupImageShow
import android.support.v4.widget.EdgeEffectCompat; //导入依赖的package包/类
private void setupImageShow(Context context) {
Resources res = context.getResources();
mTextSize = res.getDimensionPixelSize(R.dimen.photoeditor_text_size);
mTextPadding = res.getDimensionPixelSize(R.dimen.photoeditor_text_padding);
mOriginalTextMargin = res.getDimensionPixelSize(R.dimen.photoeditor_original_text_margin);
mOriginalTextSize = res.getDimensionPixelSize(R.dimen.photoeditor_original_text_size);
mBackgroundColor = res.getColor(R.color.background_screen);
mOriginalText = res.getString(R.string.original_picture_text);
mShadow = (NinePatchDrawable) res.getDrawable(R.drawable.geometry_shadow);
setupGestureDetector(context);
mActivity = (FilterShowActivity) context;
if (sMask == null) {
Bitmap mask = BitmapFactory.decodeResource(res, R.drawable.spot_mask);
sMask = convertToAlphaMask(mask);
}
mEdgeEffect = new EdgeEffectCompat(context);
mEdgeSize = res.getDimensionPixelSize(R.dimen.edge_glow_size);
}
示例15: initViewPager
import android.support.v4.widget.EdgeEffectCompat; //导入依赖的package包/类
void initViewPager() {
setWillNotDraw(false);
setDescendantFocusability(FOCUS_AFTER_DESCENDANTS);
setFocusable(true);
final Context context = getContext();
mScroller = new Scroller(context, sInterpolator);
final ViewConfiguration configuration = ViewConfiguration.get(context);
final float density = context.getResources().getDisplayMetrics().density;
mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(configuration);
mMinimumVelocity = (int) (MIN_FLING_VELOCITY * density);
mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();
mTopEdge = new EdgeEffectCompat(context);
mBottomEdge = new EdgeEffectCompat(context);
mFlingDistance = (int) (MIN_DISTANCE_FOR_FLING * density);
mCloseEnough = (int) (CLOSE_ENOUGH * density);
mDefaultGutterSize = (int) (DEFAULT_GUTTER_SIZE * density);
ViewCompat.setAccessibilityDelegate(this, new MyAccessibilityDelegate());
if (ViewCompat.getImportantForAccessibility(this)
== ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
ViewCompat.setImportantForAccessibility(this, ViewCompat.IMPORTANT_FOR_ACCESSIBILITY_YES);
}
}