Java 类android.support.v4.widget.EdgeEffectCompat 实例源码

项目:WebPager    文件:CustomViewPager.java   
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);
    }
}
项目:microMathematics    文件:TwoDScrollView.java   
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);
}
项目:CuiMarket    文件:PagerTab.java   
/** 初始化一些常量 */
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);
}
项目:weex-analyzer-android    文件:Viewport.java   
/**
 * 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();
}
项目:SprintNBA    文件:VerticalViewPager.java   
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);
  }
}
项目:920-text-editor-v2    文件:TabViewPager.java   
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);
    }
}
项目:expandable-recyclerview-with-gridlayout    文件:BaseEdgeEffectDecorator.java   
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);
}
项目:AndroidBase    文件:LazyViewPager.java   
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);
}
项目:FMTech    文件:RecyclerView.java   
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);
  }
}
项目:FMTech    文件:ViewPager.java   
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);
  }
}
项目:MultiTreeListView    文件:HorizontalListView.java   
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);
    }
}
项目:Android-BluetoothSPPLibrary-master    文件:Viewport.java   
/**
 * 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();
}
项目:auid2    文件:HorizontalIconView.java   
/**
 * 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);
}
项目:nexus-gallery    文件:ImageShow.java   
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);
}
项目:TLint    文件:VerticalViewPager.java   
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);
    }
}
项目:GooglePlay    文件:PagerTab.java   
/** 初始化一些常量 */
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);
}
项目:MiBandDecompiled    文件:ViewPager.java   
void a()
{
    setWillNotDraw(false);
    setDescendantFocusability(0x40000);
    setFocusable(true);
    Context context = getContext();
    u = new Scroller(context, l);
    ViewConfiguration viewconfiguration = ViewConfiguration.get(context);
    float f1 = context.getResources().getDisplayMetrics().density;
    N = ViewConfigurationCompat.getScaledPagingTouchSlop(viewconfiguration);
    V = (int)(400F * f1);
    W = viewconfiguration.getScaledMaximumFlingVelocity();
    ae = new EdgeEffectCompat(context);
    af = new EdgeEffectCompat(context);
    Z = (int)(25F * f1);
    aa = (int)(2.0F * f1);
    L = (int)(16F * f1);
    ViewCompat.setAccessibilityDelegate(this, new aD(this));
    if (ViewCompat.getImportantForAccessibility(this) == 0)
    {
        ViewCompat.setImportantForAccessibility(this, 1);
    }
}
项目:DoubleViewPager    文件:HorizontalViewPager.java   
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);
    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);
    }
}
项目:MyCTFWriteUps    文件:ViewPager.java   
void initViewPager()
{
    setWillNotDraw(false);
    setDescendantFocusability(0x40000);
    setFocusable(true);
    Context context = getContext();
    mScroller = new Scroller(context, sInterpolator);
    ViewConfiguration viewconfiguration = ViewConfiguration.get(context);
    float f = context.getResources().getDisplayMetrics().density;
    mTouchSlop = ViewConfigurationCompat.getScaledPagingTouchSlop(viewconfiguration);
    mMinimumVelocity = (int)(400F * f);
    mMaximumVelocity = viewconfiguration.getScaledMaximumFlingVelocity();
    mLeftEdge = new EdgeEffectCompat(context);
    mRightEdge = new EdgeEffectCompat(context);
    mFlingDistance = (int)(25F * f);
    mCloseEnough = (int)(2.0F * f);
    mDefaultGutterSize = (int)(16F * f);
    ViewCompat.setAccessibilityDelegate(this, new MyAccessibilityDelegate());
    if (ViewCompat.getImportantForAccessibility(this) == 0)
    {
        ViewCompat.setImportantForAccessibility(this, 1);
    }
}
项目:ZJFrameForAndroid    文件:HorizontalListView.java   
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);
    }
}
项目:OnTheRoad    文件:LoopViewPager.java   
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);
    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);
    }
}
项目:countdown    文件:StaggeredGridView.java   
public StaggeredGridView(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    final ViewConfiguration vc = ViewConfiguration.get(context);
    mTouchSlop = vc.getScaledTouchSlop();
    mMaximumVelocity = vc.getScaledMaximumFlingVelocity();
    mFlingVelocity = vc.getScaledMinimumFlingVelocity();
    mScroller = new OverScrollerSGV(context);

    mTopEdge = new EdgeEffectCompat(context);
    mBottomEdge = new EdgeEffectCompat(context);
    setWillNotDraw(false);
    setClipToPadding(false);

    SgvAnimationHelper.initialize(context);

    mDragState = ReorderUtils.DRAG_STATE_NONE;
    mIsDragReorderingEnabled = true;
    mWindowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
    final ViewConfiguration configuration = ViewConfiguration.get(context);
    mOverscrollDistance = configuration.getScaledOverflingDistance();
    // Disable splitting event. Only one of the children can handle motion event.
    setMotionEventSplittingEnabled(false);
}
项目:itheima    文件:LazyViewPager.java   
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);

    float density = context.getResources().getDisplayMetrics().density;
    mBaseLineFlingVelocity = 2500.0f * density;
    mFlingVelocityInfluence = 0.4f;
}
项目:android-periodic-table    文件:ZoomableScrollView.java   
private void initZoomableScrollView(Context context) {
    setWillNotDraw(false);

    setHorizontalScrollBarEnabled(true);
    setVerticalScrollBarEnabled(true);

    setClickable(true);

    mOverScroller = new OverScroller(context);
    mZoomer = new Zoomer(context);
    mScaleDetector = new ScaleGestureDetector(context, this);
    mGestureDetector = new GestureDetector(context, this);

    mEdgeEffectTop = new EdgeEffectCompat(context);
    mEdgeEffectBottom = new EdgeEffectCompat(context);
    mEdgeEffectLeft = new EdgeEffectCompat(context);
    mEdgeEffectRight = new EdgeEffectCompat(context);
}
项目:-KJFrameForAndroid    文件:HorizontalListView.java   
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);
    }
}
项目:android-support-v11    文件:ViewPager.java   
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 = configuration.getScaledPagingTouchSlop();//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);

    if (Build.VERSION.SDK_INT >= 16){
        if (getImportantForAccessibility() == IMPORTANT_FOR_ACCESSIBILITY_AUTO) {
            setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES);
        }
    }
}
项目:Yarrn    文件:HorizontalListView.java   
public HorizontalListView(final Context context, final 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);
    }
}
项目:CenterLockViewPager    文件:ViewPager.java   
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);
    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);
    }
}
项目:mobile-client    文件:ViewPager.java   
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);

    float density = context.getResources().getDisplayMetrics().density;
    mBaseLineFlingVelocity = 2500.0f * density;
    mFlingVelocityInfluence = 0.4f;
}
项目:Joszolgalat_Android_App    文件:ViewPager.java   
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);
}
项目:GitHub    文件:VerticalViewPager.java   
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);
    }
}
项目:SwipeImageView    文件:SwipeImageView.java   
private void drawEdgeEffect(
        Canvas canvas,
        EdgeEffectCompat edgeEffect,
        int degrees) {
    if (canvas == null || edgeEffect == null ||
            edgeEffect.isFinished()) {
        return;
    }

    int restoreCount = canvas.getSaveCount();
    int width = getWidth();
    int height = getHeight() - getPaddingTop() - getPaddingBottom();

    canvas.rotate(degrees);

    if (degrees == 270) {
        canvas.translate(
                (float) -height + getPaddingTop(),
                0);
    } else {
        canvas.translate(
                -getPaddingTop(),
                -width);
    }

    edgeEffect.setSize(height, width);

    if (edgeEffect.draw(canvas)) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
            postInvalidateOnAnimation();
        } else {
            postInvalidate();
        }
    }

    canvas.restoreToCount(restoreCount);
}
项目:SwipeImageView    文件:SwipeImageView.java   
private void initView(Context context) {
    float dp = context.getResources().getDisplayMetrics().density;
    swipeThreshold = 16f * dp;

    edgeEffectLeft = new EdgeEffectCompat(context);
    edgeEffectRight = new EdgeEffectCompat(context);

    for (int i = radius * 2 + 1; i-- > 0;) {
        previewImages.add(new PreviewImage());
    }
}
项目:airgram    文件:RecyclerView.java   
void applyEdgeEffectColor(EdgeEffectCompat edgeEffectCompat) {
    if (Build.VERSION.SDK_INT >= 21 && glowColor != 0) {
        try {
            Field field = EdgeEffectCompat.class.getDeclaredField("mEdgeEffect");
            field.setAccessible(true);
            EdgeEffect edgeEffect = (EdgeEffect) field.get(edgeEffectCompat);
            if (edgeEffect != null) {
                edgeEffect.setColor(glowColor);
            }
        } catch (Exception e) {
            FileLog.e("tmessages", e);
        }
    }
}
项目:Renrentou    文件:XCCycleViewPager.java   
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);
    }
}
项目:VerticalWebView    文件:VerticalParentViewPager.java   
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);
    }
}
项目:letv    文件:AbsHListView.java   
public void setOverScrollMode(int mode) {
    if (mode == 2) {
        this.mEdgeGlowTop = null;
        this.mEdgeGlowBottom = null;
    } else if (this.mEdgeGlowTop == null) {
        Context context = getContext();
        this.mEdgeGlowTop = new EdgeEffectCompat(context);
        this.mEdgeGlowBottom = new EdgeEffectCompat(context);
    }
    super.setOverScrollMode(mode);
}
项目:letv    文件:RecyclerView.java   
void ensureLeftGlow() {
    if (this.mLeftGlow == null) {
        this.mLeftGlow = new EdgeEffectCompat(getContext());
        if (this.mClipToPadding) {
            this.mLeftGlow.setSize((getMeasuredHeight() - getPaddingTop()) - getPaddingBottom(), (getMeasuredWidth() - getPaddingLeft()) - getPaddingRight());
        } else {
            this.mLeftGlow.setSize(getMeasuredHeight(), getMeasuredWidth());
        }
    }
}
项目:letv    文件:RecyclerView.java   
void ensureRightGlow() {
    if (this.mRightGlow == null) {
        this.mRightGlow = new EdgeEffectCompat(getContext());
        if (this.mClipToPadding) {
            this.mRightGlow.setSize((getMeasuredHeight() - getPaddingTop()) - getPaddingBottom(), (getMeasuredWidth() - getPaddingLeft()) - getPaddingRight());
        } else {
            this.mRightGlow.setSize(getMeasuredHeight(), getMeasuredWidth());
        }
    }
}
项目:letv    文件:RecyclerView.java   
void ensureTopGlow() {
    if (this.mTopGlow == null) {
        this.mTopGlow = new EdgeEffectCompat(getContext());
        if (this.mClipToPadding) {
            this.mTopGlow.setSize((getMeasuredWidth() - getPaddingLeft()) - getPaddingRight(), (getMeasuredHeight() - getPaddingTop()) - getPaddingBottom());
        } else {
            this.mTopGlow.setSize(getMeasuredWidth(), getMeasuredHeight());
        }
    }
}