android.support.v4.view.ViewCompat#setChildrenDrawingOrderEnabled ( )源码实例Demo

下面列出了android.support.v4.view.ViewCompat#setChildrenDrawingOrderEnabled ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: MaterialQQLite   文件: PullRefreshLayout.java
public PullRefreshLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
        TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.PullRefreshLayout);
        final int type = a.getInteger(R.styleable.PullRefreshLayout_type, STYLE_MATERIAL);
        final int colorsId = a.getResourceId(R.styleable.PullRefreshLayout_colors, R.array.google_colors);
        a.recycle();

        mDecelerateInterpolator = new DecelerateInterpolator(DECELERATE_INTERPOLATION_FACTOR);
        mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
        mMediumAnimationDuration = getResources().getInteger(
                android.R.integer.config_mediumAnimTime);
        mSpinnerFinalOffset = mTotalDragDistance = dp2px(DRAG_MAX_DISTANCE);

        mRefreshView = new ImageView(context);
        mColorSchemeColors = context.getResources().getIntArray(colorsId);
        setRefreshStyle(type);
//        mRefreshDrawable.setColorSchemeColors(new int[]{Color.rgb(0xC9, 0x34, 0x37), Color.rgb(0x37, 0x5B, 0xF1), Color.rgb(0xF7, 0xD2, 0x3E), Color.rgb(0x34, 0xA3, 0x50)});
        mRefreshView.setVisibility(View.GONE);
        addView(mRefreshView);

        setWillNotDraw(false);
        ViewCompat.setChildrenDrawingOrderEnabled(this, true);
    }
 
源代码2 项目: Phoenix   文件: PullToRefreshView.java
public PullToRefreshView(Context context, AttributeSet attrs) {
    super(context, attrs);
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.RefreshView);
    final int type = a.getInteger(R.styleable.RefreshView_type, STYLE_SUN);
    a.recycle();

    mDecelerateInterpolator = new DecelerateInterpolator(DECELERATE_INTERPOLATION_FACTOR);
    mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
    mTotalDragDistance = Utils.convertDpToPixel(context, DRAG_MAX_DISTANCE);

    mRefreshView = new ImageView(context);

    setRefreshStyle(type);

    addView(mRefreshView);

    setWillNotDraw(false);
    ViewCompat.setChildrenDrawingOrderEnabled(this, true);
}
 
源代码3 项目: Taurus   文件: PullToRefreshView.java
public PullToRefreshView(Context context, AttributeSet attrs) {
    super(context, attrs);

    mDecelerateInterpolator = new DecelerateInterpolator(DECELERATE_INTERPOLATION_FACTOR);
    mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
    float density = context.getResources().getDisplayMetrics().density;
    mTotalDragDistance = Math.round((float) DRAG_MAX_DISTANCE * density);

    mRefreshImageView = new ImageView(context);
    mRefreshView = new RefreshView(getContext(), this);
    mRefreshImageView.setImageDrawable(mRefreshView);

    addView(mRefreshImageView);
    setWillNotDraw(false);
    ViewCompat.setChildrenDrawingOrderEnabled(this, true);
}
 
源代码4 项目: Android-Application-ZJB   文件: SwipeRefresh.java
/**
 * Constructor that is called when inflating SwipeRefreshLayout from XML.
 *
 * @param context
 */
public SwipeRefresh(Context context, AttributeSet attrs) {
    super(context, attrs);

    mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();

    mMediumAnimationDuration = getResources().getInteger(
            android.R.integer.config_mediumAnimTime);

    setWillNotDraw(false);
    mDecelerateInterpolator = new DecelerateInterpolator(DECELERATE_INTERPOLATION_FACTOR);

    final TypedArray a = context.obtainStyledAttributes(attrs, LAYOUT_ATTRS);
    setEnabled(a.getBoolean(0, true));
    a.recycle();

    final DisplayMetrics metrics = getResources().getDisplayMetrics();
    mCircleWidth = (int) (CIRCLE_DIAMETER * metrics.density);
    mCircleHeight = (int) (CIRCLE_DIAMETER * metrics.density);

    createProgressView();
    ViewCompat.setChildrenDrawingOrderEnabled(this, true);
    // the absolute offset has to take into account that the circle starts at an offset
    mSpinnerFinalOffset = DEFAULT_CIRCLE_TARGET * metrics.density;
    mTotalDragDistance = mSpinnerFinalOffset;
}
 
源代码5 项目: TLint   文件: PullToRefreshView.java
public PullToRefreshView(Context context, AttributeSet attrs) {
    super(context, attrs);
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.RefreshView);
    final int type = a.getInteger(R.styleable.RefreshView_type, STYLE_SUN);
    a.recycle();

    mDecelerateInterpolator = new DecelerateInterpolator(DECELERATE_INTERPOLATION_FACTOR);
    mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
    mTotalDragDistance = Utils.convertDpToPixel(context, DRAG_MAX_DISTANCE);

    mRefreshView = new ImageView(context);
    Logger.d("width:" + getWidth());
    setRefreshStyle(type);

    addView(mRefreshView);

    setWillNotDraw(false);
    ViewCompat.setChildrenDrawingOrderEnabled(this, true);
}
 
源代码6 项目: AndroidStudyDemo   文件: SwipeRefreshLayout.java
/**
 * Constructor that is called when inflating SwipeRefreshLayout from XML.
 *
 * @param context
 * @param attrs
 */
public SwipeRefreshLayout(Context context, AttributeSet attrs) {
    super(context, attrs);

    mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();

    mMediumAnimationDuration = getResources().getInteger(
            android.R.integer.config_mediumAnimTime);

    setWillNotDraw(false);
    mDecelerateInterpolator = new DecelerateInterpolator(DECELERATE_INTERPOLATION_FACTOR);

    final TypedArray a = context.obtainStyledAttributes(attrs, LAYOUT_ATTRS);
    setEnabled(a.getBoolean(0, true));
    a.recycle();

    final DisplayMetrics metrics = getResources().getDisplayMetrics();
    mCircleWidth = (int) (CIRCLE_DIAMETER * metrics.density);
    mCircleHeight = (int) (CIRCLE_DIAMETER * metrics.density);

    createProgressView();
    ViewCompat.setChildrenDrawingOrderEnabled(this, true);
    // the absolute offset has to take into account that the circle starts at an offset
    mSpinnerFinalOffset = DEFAULT_CIRCLE_TARGET * metrics.density;
    mTotalDragDistance = mSpinnerFinalOffset;
}
 
@SuppressWarnings("deprecation")
public SuperSwipeRefreshLayout(Context context, AttributeSet attrs) {
    super(context, attrs);

    /**
     * getScaledTouchSlop是一个距离,表示滑动的时候,手的移动要大于这个距离才开始移动控件。如果小于这个距离就不触发移动控件
     */
    mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();

    mMediumAnimationDuration = getResources().getInteger(
            android.R.integer.config_mediumAnimTime);

    setWillNotDraw(false);
    mDecelerateInterpolator = new DecelerateInterpolator(
            DECELERATE_INTERPOLATION_FACTOR);

     TypedArray a = context
            .obtainStyledAttributes(attrs, LAYOUT_ATTRS);
    setEnabled(a.getBoolean(0, true));
    a.recycle();

    WindowManager wm = (WindowManager) context
            .getSystemService(Context.WINDOW_SERVICE);
    Display display = wm.getDefaultDisplay();
     DisplayMetrics metrics = getResources().getDisplayMetrics();
    mHeaderViewWidth = display.getWidth();
    mHeaderViewHeight = (int) (HEADER_VIEW_HEIGHT * metrics.density);
    createHeaderViewContainer();
    ViewCompat.setChildrenDrawingOrderEnabled(this, true);
    mSpinnerFinalOffset = DEFAULT_CIRCLE_TARGET * metrics.density;
    density = metrics.density;
    mTotalDragDistance = mSpinnerFinalOffset;
}
 
源代码8 项目: fangzhuishushenqi   文件: SwipeRefreshLayout.java
/**
 * Constructor that is called when inflating SwipeRefreshLayout from XML.
 *
 * @param context
 * @param attrs
 */
public SwipeRefreshLayout(Context context, AttributeSet attrs) {
    super(context, attrs);

    mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();

    mMediumAnimationDuration = getResources().getInteger(
            android.R.integer.config_mediumAnimTime);

    setWillNotDraw(false);
    mDecelerateInterpolator = new DecelerateInterpolator(DECELERATE_INTERPOLATION_FACTOR);

    final TypedArray a = context.obtainStyledAttributes(attrs, LAYOUT_ATTRS);
    setEnabled(a.getBoolean(0, true));
    a.recycle();

    final DisplayMetrics metrics = getResources().getDisplayMetrics();
    mCircleWidth = (int) (CIRCLE_DIAMETER * metrics.density);
    mCircleHeight = (int) (CIRCLE_DIAMETER * metrics.density);

    createProgressView();
    ViewCompat.setChildrenDrawingOrderEnabled(this, true);
    // the absolute offset has to take into account that the circle starts at an offset
    mSpinnerFinalOffset = DEFAULT_CIRCLE_TARGET * metrics.density;
    mTotalDragDistance = mSpinnerFinalOffset;

    requestDisallowInterceptTouchEvent(true);
}
 
源代码9 项目: Overchan-Android   文件: SwipeRefreshLayout.java
/**
 * Constructor that is called when inflating SwipeRefreshLayout from XML.
 *
 * @param context
 * @param attrs
 */
public SwipeRefreshLayout(Context context, AttributeSet attrs) {
    super(context, attrs);

    mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();

    mMediumAnimationDuration = getResources().getInteger(
            android.R.integer.config_mediumAnimTime);

    setWillNotDraw(false);
    mDecelerateInterpolator = new DecelerateInterpolator(DECELERATE_INTERPOLATION_FACTOR);

    final TypedArray a = context.obtainStyledAttributes(attrs, LAYOUT_ATTRS);
    setEnabled(a.getBoolean(0, true));
    a.recycle();

    final DisplayMetrics metrics = getResources().getDisplayMetrics();
    mCircleWidth = (int) (CIRCLE_DIAMETER * metrics.density);
    mCircleHeight = (int) (CIRCLE_DIAMETER * metrics.density);

    mFastScrollWidth = (int) (FAST_SCROLL_WIDTH_DP * metrics.density); //добавлено

    createProgressView();
    ViewCompat.setChildrenDrawingOrderEnabled(this, true);
    // the absolute offset has to take into account that the circle starts at an offset
    mSpinnerFinalOffset = DEFAULT_CIRCLE_TARGET * metrics.density;
    mTotalDragDistance = mSpinnerFinalOffset;
}
 
源代码10 项目: Ticket-Analysis   文件: SuperSwipeRefreshLayout.java
@SuppressWarnings("deprecation")
public SuperSwipeRefreshLayout(Context context, AttributeSet attrs) {
    super(context, attrs);

    /**
     * getScaledTouchSlop是一个距离,表示滑动的时候,手的移动要大于这个距离才开始移动控件。如果小于这个距离就不触发移动控件
     */
    mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();

    mMediumAnimationDuration = getResources().getInteger(
            android.R.integer.config_mediumAnimTime);

    setWillNotDraw(false);
    mDecelerateInterpolator = new DecelerateInterpolator(
            DECELERATE_INTERPOLATION_FACTOR);

    final TypedArray a = context
            .obtainStyledAttributes(attrs, LAYOUT_ATTRS);
    setEnabled(a.getBoolean(0, true));
    a.recycle();

    WindowManager wm = (WindowManager) context
            .getSystemService(Context.WINDOW_SERVICE);
    Display display = wm.getDefaultDisplay();
    final DisplayMetrics metrics = getResources().getDisplayMetrics();
    mHeaderViewWidth = (int) display.getWidth();
    mFooterViewWidth = (int) display.getWidth();
    mHeaderViewHeight = (int) (HEADER_VIEW_HEIGHT * metrics.density);
    mFooterViewHeight = (int) (HEADER_VIEW_HEIGHT * metrics.density);
    defaultProgressView = new CircleProgressView(getContext());
    createHeaderViewContainer();
    createFooterViewContainer();
    ViewCompat.setChildrenDrawingOrderEnabled(this, true);
    mSpinnerFinalOffset = DEFAULT_CIRCLE_TARGET * metrics.density;
    density = metrics.density;
    mTotalDragDistance = mSpinnerFinalOffset;
}
 
源代码11 项目: AgentWebX5   文件: ProgressLayout.java
public ProgressLayout(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    final DisplayMetrics metrics = getResources().getDisplayMetrics();
    mCircleWidth = (int) (CIRCLE_DIAMETER * metrics.density);
    mCircleHeight = (int) (CIRCLE_DIAMETER * metrics.density);
    createProgressView();
    ViewCompat.setChildrenDrawingOrderEnabled(this, true);
    // the absolute offset has to take into account that the circle starts at an offset
}
 
public PullRefreshLayout(Context context, AttributeSet attrs) {
    super(context, attrs);
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.refresh_PullRefreshLayout);
    final int type = a.getInteger(R.styleable.refresh_PullRefreshLayout_refreshType, STYLE_MATERIAL);
    final int colorsId = a.getResourceId(R.styleable.refresh_PullRefreshLayout_refreshColors, 0);
    final int colorId = a.getResourceId(R.styleable.refresh_PullRefreshLayout_refreshColor, 0);
    a.recycle();

    mDecelerateInterpolator = new DecelerateInterpolator(DECELERATE_INTERPOLATION_FACTOR);
    mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
    int defaultDuration = getResources().getInteger(android.R.integer.config_mediumAnimTime);
    mDurationToStartPosition = defaultDuration;
    mDurationToCorrectPosition = defaultDuration;
    mSpinnerFinalOffset = mTotalDragDistance = dp2px(DRAG_MAX_DISTANCE);

    if (colorsId > 0) {
        mColorSchemeColors = context.getResources().getIntArray(colorsId);
    } else {
        mColorSchemeColors = new int[]{Color.rgb(0xC9, 0x34, 0x37), Color.rgb(0x37, 0x5B, 0xF1), Color.rgb(0xF7, 0xD2, 0x3E), Color.rgb(0x34, 0xA3, 0x50)};
    }

    if (colorId > 0) {
        mColorSchemeColors = new int[]{context.getResources().getColor(colorId)};
    }

    mRefreshView = new ImageView(context);
    setRefreshStyle(type);
    mRefreshView.setVisibility(View.GONE);
    addView(mRefreshView, 0);
    setWillNotDraw(false);
    ViewCompat.setChildrenDrawingOrderEnabled(this, true);
}
 
源代码13 项目: AndroidUiKit   文件: ISwipeRefreshLayout.java
/**
 * Constructor that is called when inflating ISwipeRefreshLayout from XML.
 *
 * @param context
 * @param attrs
 */
public ISwipeRefreshLayout(Context context, AttributeSet attrs) {
    super(context, attrs);

    mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();

    mMediumAnimationDuration = getResources().getInteger(
            android.R.integer.config_mediumAnimTime);

    setWillNotDraw(false);
    mDecelerateInterpolator = new DecelerateInterpolator(DECELERATE_INTERPOLATION_FACTOR);

    final DisplayMetrics metrics = getResources().getDisplayMetrics();
    mRefreshViewHeight = (int) (DEFAULT_HEADER_HEIGHT * metrics.density);
    HEADER_VIEW_MIN_HEIGHT = mRefreshViewHeight;
    ViewCompat.setChildrenDrawingOrderEnabled(this, true);
    mTotalDragDistance = (int) (DEFAULT_HEADER_TARGET * metrics.density);
    mNestedScrollingParentHelper = new NestedScrollingParentHelper(this);

    mNestedScrollingChildHelper = new NestedScrollingChildHelper(this);
    setNestedScrollingEnabled(true);

    final TypedArray a = context.obtainStyledAttributes(attrs, LAYOUT_ATTRS);
    setEnabled(a.getBoolean(0, true));
    a.recycle();

    //add default refreshview
    setRefreshHeaderView(new ClassicIRefreshHeaderView(getContext()));
}
 
@SuppressWarnings("deprecation")
public SuperSwipeRefreshLayout(Context context, AttributeSet attrs) {
    super(context, attrs);

    /**
     * getScaledTouchSlop是一个距离,表示滑动的时候,手的移动要大于这个距离才开始移动控件。如果小于这个距离就不触发移动控件
     */
    mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();

    mMediumAnimationDuration = getResources().getInteger(
            android.R.integer.config_mediumAnimTime);

    setWillNotDraw(false);
    mDecelerateInterpolator = new DecelerateInterpolator(
            DECELERATE_INTERPOLATION_FACTOR);

    final TypedArray a = context
            .obtainStyledAttributes(attrs, LAYOUT_ATTRS);
    setEnabled(a.getBoolean(0, true));
    a.recycle();

    WindowManager wm = (WindowManager) context
            .getSystemService(Context.WINDOW_SERVICE);
    Display display = wm.getDefaultDisplay();
    final DisplayMetrics metrics = getResources().getDisplayMetrics();
    mHeaderViewWidth = (int) display.getWidth();
    mFooterViewWidth = (int) display.getWidth();
    mHeaderViewHeight = (int) (HEADER_VIEW_HEIGHT * metrics.density);
    mFooterViewHeight = (int) (HEADER_VIEW_HEIGHT * metrics.density);
    defaultProgressView = new CircleProgressView(getContext());
    createHeaderViewContainer();
    createFooterViewContainer();
    ViewCompat.setChildrenDrawingOrderEnabled(this, true);
    mSpinnerFinalOffset = DEFAULT_CIRCLE_TARGET * metrics.density;
    density = metrics.density;
    mTotalDragDistance = mSpinnerFinalOffset;
}
 
源代码15 项目: SwipeToRefresh   文件: SwipeToRefreshLayout.java
/**
 * Constructor that is called when inflating SwipeRefreshLayout from XML.
 *
 * @param context
 * @param attrs
 */
public SwipeToRefreshLayout(Context context, AttributeSet attrs) {
    super(context, attrs);

    mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();

    mMediumAnimationDuration = getResources().getInteger(
            android.R.integer.config_mediumAnimTime);

    setWillNotDraw(false);
    mDecelerateInterpolator = new DecelerateInterpolator(DECELERATE_INTERPOLATION_FACTOR);

    final TypedArray a = context.obtainStyledAttributes(attrs, LAYOUT_ATTRS);
    setEnabled(a.getBoolean(0, true));
    a.recycle();

    final TypedArray a2 = context.obtainStyledAttributes(attrs, R.styleable.SwipeToRefreshLayout);
    RefreshDirection direction
            = RefreshDirection.getFromInt(a2.getInt(R.styleable.SwipeToRefreshLayout_srl_direction, 0));
    int drawableRes = a2.getResourceId(R.styleable.SwipeToRefreshLayout_srl_icon, 0);
    int animation = a2.getInt(R.styleable.SwipeToRefreshLayout_srl_animation, 0);
    if (direction != RefreshDirection.BOTH) {
        mDirection = direction;
        mBothDirection = false;
    } else {
        mDirection = RefreshDirection.TOP;
        mBothDirection = true;
    }
    a2.recycle();

    final DisplayMetrics metrics = getResources().getDisplayMetrics();
    mCircleWidth = (int) (CIRCLE_DIAMETER * metrics.density);
    mCircleHeight = (int) (CIRCLE_DIAMETER * metrics.density);

    createProgressView(drawableRes, animation);
    ViewCompat.setChildrenDrawingOrderEnabled(this, true);
    // the absolute offset has to take into account that the circle starts at an offset
    mSpinnerFinalOffset = DEFAULT_CIRCLE_TARGET * metrics.density;
}
 
源代码16 项目: TwinklingRefreshLayout   文件: ProgressLayout.java
public ProgressLayout(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    final DisplayMetrics metrics = getResources().getDisplayMetrics();
    mCircleWidth = (int) (CIRCLE_DIAMETER * metrics.density);
    mCircleHeight = (int) (CIRCLE_DIAMETER * metrics.density);
    createProgressView();
    ViewCompat.setChildrenDrawingOrderEnabled(this, true);
    // the absolute offset has to take into account that the circle starts at an offset
}
 
源代码17 项目: PullToRefresh   文件: PullToRefreshView.java
public PullToRefreshView(Context context, AttributeSet attrs) {
    super(context, attrs);
    mInterpolator = new DecelerateInterpolator(DEFAULT_DECELERATE_INTERPOLATION_FACTOR);
    mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
    mRefreshView = new ImageView(context);
    mDragRate = DEFAULT_DRAG_RATE;

    setDefaultRefreshStype(context);
    addView(mRefreshView);
    setWillNotDraw(false);
    ViewCompat.setChildrenDrawingOrderEnabled(this, true);
}
 
源代码18 项目: Chandelier   文件: ChandelierLayout.java
/**
 * Constructor that is called when inflating SwipeRefreshLayout from XML.
 */
public ChandelierLayout(Context context, AttributeSet attrs) {
  super(context, attrs);
  this.attrs = attrs;

  final Resources res = getResources();
  // Defaults
  final int defaultElevation = res.getDimensionPixelSize(R.dimen.default_elevation);

  touchSlop = ViewConfiguration.get(context).getScaledTouchSlop();

  setWillNotDraw(false);
  decelerateInterpolator = new DecelerateInterpolator(DECELERATE_INTERPOLATION_FACTOR);

  final TypedArray a = context.obtainStyledAttributes(attrs, LAYOUT_ATTRS);
  setEnabled(a.getBoolean(0, true));

  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    setElevation(
        a.getDimensionPixelSize(R.styleable.ChandelierLayout_chandelier_elevation, defaultElevation));
  }

  animateToStartDuration =
      a.getInteger(R.styleable.ChandelierLayout_chandelier_animate_to_start_duration,
          ANIMATE_TO_START_DURATION);

  a.recycle();

  createProgressView();
  ViewCompat.setChildrenDrawingOrderEnabled(this, true);
}
 
源代码19 项目: BookReader   文件: SwipeRefreshLayout.java
/**
 * Constructor that is called when inflating SwipeRefreshLayout from XML.
 *
 * @param context
 * @param attrs
 */
public SwipeRefreshLayout(Context context, AttributeSet attrs) {
    super(context, attrs);

    mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();

    mMediumAnimationDuration = getResources().getInteger(
            android.R.integer.config_mediumAnimTime);

    setWillNotDraw(false);
    mDecelerateInterpolator = new DecelerateInterpolator(DECELERATE_INTERPOLATION_FACTOR);

    final TypedArray a = context.obtainStyledAttributes(attrs, LAYOUT_ATTRS);
    setEnabled(a.getBoolean(0, true));
    a.recycle();

    final DisplayMetrics metrics = getResources().getDisplayMetrics();
    mCircleWidth = (int) (CIRCLE_DIAMETER * metrics.density);
    mCircleHeight = (int) (CIRCLE_DIAMETER * metrics.density);

    createProgressView();
    ViewCompat.setChildrenDrawingOrderEnabled(this, true);
    // the absolute offset has to take into account that the circle starts at an offset
    mSpinnerFinalOffset = DEFAULT_CIRCLE_TARGET * metrics.density;
    mTotalDragDistance = mSpinnerFinalOffset;

    requestDisallowInterceptTouchEvent(true);
}
 
@SuppressWarnings("deprecation")
public SuperSwipeRefreshLayout(Context context, AttributeSet attrs) {
    super(context, attrs);

    /**
     * getScaledTouchSlop是一个距离,表示滑动的时候,手的移动要大于这个距离才开始移动控件。如果小于这个距离就不触发移动控件
     */
    mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();

    mMediumAnimationDuration = getResources().getInteger(
            android.R.integer.config_mediumAnimTime);

    setWillNotDraw(false);
    mDecelerateInterpolator = new DecelerateInterpolator(
            DECELERATE_INTERPOLATION_FACTOR);

    final TypedArray a = context
            .obtainStyledAttributes(attrs, LAYOUT_ATTRS);
    setEnabled(a.getBoolean(0, true));
    a.recycle();

    WindowManager wm = (WindowManager) context
            .getSystemService(Context.WINDOW_SERVICE);
    Display display = wm.getDefaultDisplay();
    final DisplayMetrics metrics = getResources().getDisplayMetrics();
    mHeaderViewWidth = (int) display.getWidth();
    mFooterViewWidth = (int) display.getWidth();
    mHeaderViewHeight = (int) (HEADER_VIEW_HEIGHT * metrics.density);
    mFooterViewHeight = (int) (HEADER_VIEW_HEIGHT * metrics.density);
    defaultProgressView = new CircleProgressView(getContext());
    createHeaderViewContainer();
    createFooterViewContainer();
    ViewCompat.setChildrenDrawingOrderEnabled(this, true);
    mSpinnerFinalOffset = DEFAULT_CIRCLE_TARGET * metrics.density;
    density = metrics.density;
    mTotalDragDistance = mSpinnerFinalOffset;
}
 
 同类方法