Java 类android.support.v4.view.NestedScrollingParentHelper 实例源码

项目:weex-3d-map    文件:WXSwipeLayout.java   
private void initAttrs(Context context, AttributeSet attrs) {

    if (getChildCount() > 1) {
      throw new RuntimeException("WXSwipeLayout should not have more than one child");
    }

    parentHelper = new NestedScrollingParentHelper(this);

    if (isInEditMode() && attrs == null) {
      return;
    }

    mRefreshViewBgColor = Color.TRANSPARENT;
    mProgressBgColor = Color.TRANSPARENT;
    mProgressColor = Color.RED;
  }
项目:ucar-weex-core    文件:WXSwipeLayout.java   
private void initAttrs(Context context, AttributeSet attrs) {

    if (getChildCount() > 1) {
      throw new RuntimeException("WXSwipeLayout should not have more than one child");
    }

    parentHelper = new NestedScrollingParentHelper(this);

    if (isInEditMode() && attrs == null) {
      return;
    }

    mRefreshViewBgColor = Color.TRANSPARENT;
    mProgressBgColor = Color.TRANSPARENT;
    mProgressColor = Color.RED;
  }
项目:letv    文件:NestedScrollView.java   
public NestedScrollView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    this.mTempRect = new Rect();
    this.mIsLayoutDirty = true;
    this.mIsLaidOut = false;
    this.mChildToScrollTo = null;
    this.mIsBeingDragged = false;
    this.mSmoothScrollingEnabled = true;
    this.mActivePointerId = -1;
    this.mScrollOffset = new int[2];
    this.mScrollConsumed = new int[2];
    initScrollView();
    TypedArray a = context.obtainStyledAttributes(attrs, SCROLLVIEW_STYLEABLE, defStyleAttr, 0);
    setFillViewport(a.getBoolean(0, false));
    a.recycle();
    this.mParentHelper = new NestedScrollingParentHelper(this);
    this.mChildHelper = new NestedScrollingChildHelper(this);
    setNestedScrollingEnabled(true);
    ViewCompat.setAccessibilityDelegate(this, ACCESSIBILITY_DELEGATE);
}
项目:boohee_v5.6    文件:NestedScrollView.java   
public NestedScrollView(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    this.mTempRect = new Rect();
    this.mIsLayoutDirty = true;
    this.mIsLaidOut = false;
    this.mChildToScrollTo = null;
    this.mIsBeingDragged = false;
    this.mSmoothScrollingEnabled = true;
    this.mActivePointerId = -1;
    this.mScrollOffset = new int[2];
    this.mScrollConsumed = new int[2];
    initScrollView();
    TypedArray a = context.obtainStyledAttributes(attrs, SCROLLVIEW_STYLEABLE, defStyleAttr, 0);
    setFillViewport(a.getBoolean(0, false));
    a.recycle();
    this.mParentHelper = new NestedScrollingParentHelper(this);
    this.mChildHelper = new NestedScrollingChildHelper(this);
    setNestedScrollingEnabled(true);
    ViewCompat.setAccessibilityDelegate(this, ACCESSIBILITY_DELEGATE);
}
项目:weex-uikit    文件:WXSwipeLayout.java   
private void initAttrs(Context context, AttributeSet attrs) {

    if (getChildCount() > 1) {
      throw new RuntimeException("WXSwipeLayout should not have more than one child");
    }

    parentHelper = new NestedScrollingParentHelper(this);

    if (isInEditMode() && attrs == null) {
      return;
    }

    mRefreshViewBgColor = Color.TRANSPARENT;
    mProgressBgColor = Color.TRANSPARENT;
    mProgressColor = Color.RED;
  }
项目:YalantisInternship    文件: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);

    mNestedScrollingParentHelper = new NestedScrollingParentHelper(this);

    mNestedScrollingChildHelper = new NestedScrollingChildHelper(this);
    setNestedScrollingEnabled(true);
}
项目:weex-3d-map    文件:WXSwipeLayout.java   
private void initAttrs(Context context, AttributeSet attrs) {

    if (getChildCount() > 1) {
      throw new RuntimeException("WXSwipeLayout should not have more than one child");
    }

    parentHelper = new NestedScrollingParentHelper(this);

    if (isInEditMode() && attrs == null) {
      return;
    }

    mRefreshViewBgColor = Color.TRANSPARENT;
    mProgressBgColor = Color.TRANSPARENT;
    mProgressColor = Color.RED;
  }
项目:CoolRefreshView    文件:CoolRefreshView.java   
private void init() {
    mPullHandler = new ProxyPullHeader(HEADER_FACTORY.made(getContext()));
    mIsPinContent = HEADER_FACTORY.isPinContent();
    if (mIsPinContent) {
        scrollerHelper = new PinContentScroller();
    } else {
        scrollerHelper = new AllScroller();
    }
    setWillNotDraw(false);
    addHeadView();
    final ViewConfiguration configuration = ViewConfiguration.get(getContext());
    mTouchSlop = configuration.getScaledTouchSlop();

    mNestedScrollingParentHelper = new NestedScrollingParentHelper(this);

    mNestedScrollingChildHelper = new NestedScrollingChildHelper(this);
    setNestedScrollingEnabled(true);
}
项目:Weex-TestDemo    文件:WXSwipeLayout.java   
private void initAttrs(Context context, AttributeSet attrs) {

    if (getChildCount() > 1) {
      throw new RuntimeException("WXSwipeLayout should not have more than one child");
    }

    parentHelper = new NestedScrollingParentHelper(this);

    if (isInEditMode() && attrs == null) {
      return;
    }

    mRefreshViewBgColor = Color.TRANSPARENT;
    mProgressBgColor = Color.TRANSPARENT;
    mProgressColor = Color.RED;
  }
项目:Android-sticky-navigation-layout    文件:StickyNavigationLayout_medlinker.java   
public StickyNavigationLayout(Context context, AttributeSet attrs) {
    super(context, attrs);
    //setOrientation(LinearLayout.VERTICAL);
    mGroupStickyDelegate = new GroupStickyDelegate();
    mNestedScrollingParentHelper = new NestedScrollingParentHelper(this);
    mNestedScrollingChildHelper = new NestedScrollingChildHelper(this);

    mScroller = new OverScroller(context);
    mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();//触摸阙值
    mMaximumVelocity = ViewConfiguration.get(context).getScaledMaximumFlingVelocity();
    mMinimumVelocity = ViewConfiguration.get(context).getScaledMinimumFlingVelocity();

    final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.StickyNavigationLayout);
    // mCodeSet will set stick view from onFinishInflate.

    mTopViewId = a.getResourceId(R.styleable.StickyNavigationLayout_stickyLayout_top_id, 0);
    mIndicatorId = a.getResourceId(R.styleable.StickyNavigationLayout_stickyLayout_indicator_id, 0);
    mContentId = a.getResourceId(R.styleable.StickyNavigationLayout_stickyLayout_content_id, 0);

    mAutoFitScroll = a.getBoolean(R.styleable.StickyNavigationLayout_stickyLayout_auto_fit_scroll, false);
    a.recycle();

    //getWindowVisibleDisplayFrame(mExpectTopRect);
}
项目:Android-sticky-navigation-layout    文件:StickyNavigationLayout_backup.java   
public StickyNavigationLayout_backup(Context context, AttributeSet attrs) {
    super(context, attrs);
    //setOrientation(LinearLayout.VERTICAL);
    mGroupStickyDelegate = new GroupStickyDelegate();
    mNestedScrollingParentHelper = new NestedScrollingParentHelper(this);
    mNestedScrollingChildHelper = new NestedScrollingChildHelper(this);

    mScroller = new OverScroller(context);
    mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();//触摸阙值
    mMaximumVelocity = ViewConfiguration.get(context).getScaledMaximumFlingVelocity();
    mMinimumVelocity = ViewConfiguration.get(context).getScaledMinimumFlingVelocity();

    final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.StickyNavigationLayout);
    // mCodeSet will set stick view from onFinishInflate.

    if(!mCodeSet) {
        mTopViewId = a.getResourceId(R.styleable.StickyNavigationLayout_stickyLayout_top_id, 0);
        mIndicatorId = a.getResourceId(R.styleable.StickyNavigationLayout_stickyLayout_indicator_id, 0);
        mContentId = a.getResourceId(R.styleable.StickyNavigationLayout_stickyLayout_content_id, 0);
    }
    mAutoFitScroll = a.getBoolean(R.styleable.StickyNavigationLayout_stickyLayout_auto_fit_scroll, false);
    mAutoFitPercent = a.getFloat(R.styleable.StickyNavigationLayout_stickyLayout_threshold_percent, 0.5f);
    a.recycle();

    //getWindowVisibleDisplayFrame(mExpectTopRect);
}
项目:weex    文件:WXSwipeLayout.java   
private void initAttrs(Context context, AttributeSet attrs) {

    if (getChildCount() > 1) {
      throw new RuntimeException("WXSwipeLayout should not have more than one child");
    }

    parentHelper = new NestedScrollingParentHelper(this);

    loadingViewHeight = dipToPx(context, REFRESH_VIEW_HEIGHT);
    refreshViewFlowHeight = loadingViewHeight * (float)1.5;

    if (isInEditMode() && attrs == null) {
      return;
    }

    mRefreshViewBgColor = Color.TRANSPARENT;
    mProgressBgColor = Color.TRANSPARENT;
    mProgressColor = Color.RED;
  }
项目:FMTech    文件:NestedScrollView.java   
public NestedScrollView(Context paramContext, AttributeSet paramAttributeSet, int paramInt)
{
  super(paramContext, paramAttributeSet, paramInt);
  setFocusable(true);
  setDescendantFocusability(262144);
  setWillNotDraw(false);
  ViewConfiguration localViewConfiguration = ViewConfiguration.get(getContext());
  this.mTouchSlop = localViewConfiguration.getScaledTouchSlop();
  this.mMinimumVelocity = localViewConfiguration.getScaledMinimumFlingVelocity();
  this.mMaximumVelocity = localViewConfiguration.getScaledMaximumFlingVelocity();
  TypedArray localTypedArray = paramContext.obtainStyledAttributes(paramAttributeSet, SCROLLVIEW_STYLEABLE, paramInt, 0);
  setFillViewport(localTypedArray.getBoolean(0, false));
  localTypedArray.recycle();
  this.mParentHelper = new NestedScrollingParentHelper(this);
  this.mChildHelper = new NestedScrollingChildHelper(this);
  setNestedScrollingEnabled(true);
  ViewCompat.setAccessibilityDelegate(this, ACCESSIBILITY_DELEGATE);
}
项目:FMTech    文件:SwipeRefreshLayout.java   
public SwipeRefreshLayout(Context paramContext, AttributeSet paramAttributeSet)
{
  super(paramContext, paramAttributeSet);
  this.mTouchSlop = ViewConfiguration.get(paramContext).getScaledTouchSlop();
  this.mMediumAnimationDuration = getResources().getInteger(17694721);
  setWillNotDraw(false);
  this.mDecelerateInterpolator = new DecelerateInterpolator(2.0F);
  TypedArray localTypedArray = paramContext.obtainStyledAttributes(paramAttributeSet, LAYOUT_ATTRS);
  setEnabled(localTypedArray.getBoolean(0, true));
  localTypedArray.recycle();
  DisplayMetrics localDisplayMetrics = getResources().getDisplayMetrics();
  this.mCircleWidth = ((int)(40.0F * localDisplayMetrics.density));
  this.mCircleHeight = ((int)(40.0F * localDisplayMetrics.density));
  this.mCircleView = new CircleImageView(getContext());
  this.mProgress = new MaterialProgressDrawable(getContext(), this);
  this.mProgress.setBackgroundColor(-328966);
  this.mCircleView.setImageDrawable(this.mProgress);
  this.mCircleView.setVisibility(8);
  addView(this.mCircleView);
  ViewCompat.setChildrenDrawingOrderEnabled$4d3af60(this);
  this.mSpinnerFinalOffset = (64.0F * localDisplayMetrics.density);
  this.mTotalDragDistance = this.mSpinnerFinalOffset;
  this.mNestedScrollingParentHelper = new NestedScrollingParentHelper(this);
  this.mNestedScrollingChildHelper = new NestedScrollingChildHelper(this);
  setNestedScrollingEnabled(true);
}
项目:NestRefreshLayout    文件:AbsRefreshLayout.java   
/**
 */
@SuppressWarnings("deprecation")
public AbsRefreshLayout(View listView) {
    this(listView.getContext());
    mNestedScrollingParentHelper = new NestedScrollingParentHelper(this);

    mNestedScrollingChildHelper = new NestedScrollingChildHelper(this);
    setNestedScrollingEnabled(true);
    mTargetView = listView;
    ViewGroup group = (ViewGroup) mTargetView.getParent();
    if (group != null) {
        LayoutParams params = mTargetView.getLayoutParams();
        int index = group.indexOfChild(listView);
        group.removeView(listView);
        group.addView(this, index, params);
    }
    mTargetView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,
            LayoutParams.MATCH_PARENT));
    super.addView(mTargetView);
}
项目:NestRefreshLayout    文件:AbsRefreshLayout.java   
/**
 * @param context
 * @param attrs
 * @param defStyleAttr
 */
private void init(Context context, AttributeSet attrs, int defStyleAttr) {
    mNestedScrollingParentHelper = new NestedScrollingParentHelper(this);

    mNestedScrollingChildHelper = new NestedScrollingChildHelper(this);
    setNestedScrollingEnabled(true);
    mScroller = new Scroller(context, new DecelerateInterpolator());
    TypedArray a = context.obtainStyledAttributes(attrs,
            R.styleable.AbsRefreshLayout, defStyleAttr, 0);
    final int N = a.getIndexCount();
    int resFooter = R.layout.layout_loadmore;
    for (int i = 0; i < N; i++) {
        int attr = a.getIndex(i);
        if (attr == R.styleable.AbsRefreshLayout_footerNestLayout) {
            resFooter = a.getResourceId(attr, resFooter);
            break;
        }
    }
    a.recycle();
    /**
     * Convert values in dp to values in px;
     */
    setFooterView(inflate(context, resFooter, null));
}
项目:OpenLinkWith    文件:ResolverDrawerLayout.java   
public ResolverDrawerLayout(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ResolverDrawerLayout,
            defStyleAttr, 0);
    mMaxWidth = a.getDimensionPixelSize(R.styleable.ResolverDrawerLayout_resolverMaxWidth, -1);
    mMaxCollapsedHeight = a.getDimensionPixelSize(
            R.styleable.ResolverDrawerLayout_maxCollapsedHeight, 0);
    mMaxCollapsedHeightSmall = a.getDimensionPixelSize(
            R.styleable.ResolverDrawerLayout_maxCollapsedHeightSmall,
            mMaxCollapsedHeight);
    a.recycle();

    mParentHelper = new NestedScrollingParentHelper(this);

    mScroller = new OverScroller(context, AnimationUtils.loadInterpolator(context,
            android.R.interpolator.decelerate_quint));
    mVelocityTracker = VelocityTracker.obtain();

    final ViewConfiguration vc = ViewConfiguration.get(context);
    mTouchSlop = vc.getScaledTouchSlop();
    mMinFlingVelocity = vc.getScaledMinimumFlingVelocity();
}
项目:MyCTFWriteUps    文件:NestedScrollView.java   
public NestedScrollView(Context context, AttributeSet attributeset, int i)
{
    super(context, attributeset, i);
    mTempRect = new Rect();
    mIsLayoutDirty = true;
    mIsLaidOut = false;
    mChildToScrollTo = null;
    mIsBeingDragged = false;
    mSmoothScrollingEnabled = true;
    mActivePointerId = -1;
    mScrollOffset = new int[2];
    mScrollConsumed = new int[2];
    initScrollView();
    context = context.obtainStyledAttributes(attributeset, SCROLLVIEW_STYLEABLE, i, 0);
    setFillViewport(context.getBoolean(0, false));
    context.recycle();
    mParentHelper = new NestedScrollingParentHelper(this);
    mChildHelper = new NestedScrollingChildHelper(this);
    setNestedScrollingEnabled(true);
    ViewCompat.setAccessibilityDelegate(this, ACCESSIBILITY_DELEGATE);
}
项目: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()));
}
项目:boohee_v5.6    文件:CoordinatorLayout.java   
public CoordinatorLayout(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    this.mLayoutDependencyComparator = new Comparator<View>() {
        public int compare(View lhs, View rhs) {
            if (lhs == rhs) {
                return 0;
            }
            if (((LayoutParams) lhs.getLayoutParams()).dependsOn(CoordinatorLayout.this, lhs, rhs)) {
                return 1;
            }
            return ((LayoutParams) rhs.getLayoutParams()).dependsOn(CoordinatorLayout.this, rhs, lhs) ? -1 : 0;
        }
    };
    this.mDependencySortedChildren = new ArrayList();
    this.mTempList1 = new ArrayList();
    this.mTempDependenciesList = new ArrayList();
    this.mTempRect1 = new Rect();
    this.mTempRect2 = new Rect();
    this.mTempRect3 = new Rect();
    this.mTempIntPair = new int[2];
    this.mNestedScrollingParentHelper = new NestedScrollingParentHelper(this);
    ThemeUtils.checkAppCompatTheme(context);
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CoordinatorLayout, defStyleAttr, R.style.Widget_Design_CoordinatorLayout);
    int keylineArrayRes = a.getResourceId(R.styleable.CoordinatorLayout_keylines, 0);
    if (keylineArrayRes != 0) {
        Resources res = context.getResources();
        this.mKeylines = res.getIntArray(keylineArrayRes);
        float density = res.getDisplayMetrics().density;
        int count = this.mKeylines.length;
        for (int i = 0; i < count; i++) {
            int[] iArr = this.mKeylines;
            iArr[i] = (int) (((float) iArr[i]) * density);
        }
    }
    this.mStatusBarBackground = a.getDrawable(R.styleable.CoordinatorLayout_statusBarBackground);
    a.recycle();
    if (INSETS_HELPER != null) {
        INSETS_HELPER.setupForWindowInsets(this, new ApplyInsetsListener());
    }
    super.setOnHierarchyChangeListener(new HierarchyChangeListener());
}
项目:android-source-codes    文件: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 DisplayMetrics metrics = getResources().getDisplayMetrics();
    mCircleDiameter = (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
    mSpinnerOffsetEnd = (int) (DEFAULT_CIRCLE_TARGET * metrics.density);
    mTotalDragDistance = mSpinnerOffsetEnd;
    mNestedScrollingParentHelper = new NestedScrollingParentHelper(this);

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

    mOriginalOffsetTop = mCurrentTargetOffsetTop = -mCircleDiameter;
    moveToStart(1.0f);

    final TypedArray a = context.obtainStyledAttributes(attrs, LAYOUT_ATTRS);
    setEnabled(a.getBoolean(0, true));
    a.recycle();
}
项目:JSSample    文件:SAllView.java   
private void init() {
    setOrientation(VERTICAL);
    scrollingParentHelper = new NestedScrollingParentHelper(this);

    headLayout = new LinearLayout(getContext());
    headLayout.setOrientation(VERTICAL);
    myScrollView = new LinearLayout(getContext());
    ViewCompat.setNestedScrollingEnabled(myScrollView, true);
    footLayout = new LinearLayout(getContext());
    footLayout.setOrientation(VERTICAL);
    addView(headLayout, new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    addView(myScrollView, new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    addView(footLayout, new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));

}
项目:JSSample    文件:SScrollview.java   
private void init() {
    setOrientation(VERTICAL);
    scrollingParentHelper = new NestedScrollingParentHelper(this);

    headLayout = new LinearLayout(getContext());
    headLayout.setOrientation(VERTICAL);
    myScrollView = new MyScrollView(getContext());
    ViewCompat.setNestedScrollingEnabled(myScrollView, true);
    footLayout = new LinearLayout(getContext());
    footLayout.setOrientation(VERTICAL);
    addView(headLayout, new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    addView(myScrollView, new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    addView(footLayout, new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));

}
项目:JSSample    文件:SRecyclerView.java   
private void init() {
    setOrientation(VERTICAL);
    scrollingParentHelper = new NestedScrollingParentHelper(this);

    headLayout = new LinearLayout(getContext());
    headLayout.setOrientation(VERTICAL);
    myRecyclerView = new MyRecyclerView(getContext());
    myRecyclerView.setNestedScrollingEnabled(true);
    footLayout = new LinearLayout(getContext());
    footLayout.setOrientation(VERTICAL);

    addView(headLayout, new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    addView(myRecyclerView, new RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    addView(footLayout, new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
}
项目:RefreshLoadLayout    文件:RefreshLoadLayout.java   
private void init(Context context) {
    int childCount = getChildCount();
    if (childCount > 1) {
        throw new IllegalStateException("Only support one child");
    }
    nestedScrollingParentHelper = new NestedScrollingParentHelper(this);
    mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
    if (refreshingEnabled) {
        addDefaultRefreshView();
    }
    if (loadingEnabled) {
        addDefaultLoadingIndicator();
    }
}
项目:PullToLoad    文件:PullToRefreshLayout.java   
private void init() {
    mNestedScrollingParentHelper = new NestedScrollingParentHelper(this);
    mNestedScrollingChildHelper = new NestedScrollingChildHelper(this);
    setNestedScrollingEnabled(true);

    mScroller = new Scroller(getContext(), new DecelerateInterpolator());
    ViewConfiguration configuration = ViewConfiguration.get(getContext());
    mTouchSlop = configuration.getScaledTouchSlop();

    mRefreshContainer.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM);

    mDefaultScrollUpProcessor = new DefaultScrollUpProcessor();

    addRefreshStateListener(mRefreshStateWatcher);
}
项目:DistRefreshLayout    文件:DistRefreshLayout.java   
/**
     * Constructor that is called when inflating SwipeRefreshLayout from XML.
     *
     * @param context
     * @param attrs
     */
    public DistRefreshLayout(Context context, AttributeSet attrs) {
        super(context, attrs);

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

        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();

        // the absolute offset has to take into account that the circle starts at an offset
//        mSpinnerFinalOffset =
        mTotalDragDistance = DEFAULT_REFRESH_TARGET * metrics.density;

        createProgressView();
        ViewCompat.setChildrenDrawingOrderEnabled(this, true);

        mNestedScrollingParentHelper = new NestedScrollingParentHelper(this);

        mNestedScrollingChildHelper = new NestedScrollingChildHelper(this);
        setNestedScrollingEnabled(true);
    }
项目:android-CircleRefreshLayout    文件:SwipeRefreshLayout.java   
/**
 * Constructor that is called when inflating SwipeRefreshLayout from XML.
 */
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;
    mNestedScrollingParentHelper = new NestedScrollingParentHelper(this);

    mNestedScrollingChildHelper = new NestedScrollingChildHelper(this);
    setNestedScrollingEnabled(true);
}
项目:NestedScroll    文件:NestedLinearLayout.java   
public NestedLinearLayout(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    // 通过 NestedScrolling 机制来处理嵌套滚动
    mNestedScrollingParentHelper = new NestedScrollingParentHelper(this);
    mScroller = new OverScroller(context);
    scrollerCompat = ScrollerCompat.create(context);
    mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop();
    mMaximumVelocity = ViewConfiguration.get(context)
            .getScaledMaximumFlingVelocity();
    mMinimumVelocity = ViewConfiguration.get(context)
            .getScaledMinimumFlingVelocity();
}
项目:NestedScroll    文件:GoldScrollView.java   
private void init() {
    setOverScrollMode(View.OVER_SCROLL_NEVER);
    this.mParentHelper = new NestedScrollingParentHelper(this);
    this.touchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();
    SENSOR_DISTANCE = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 100.0F, getResources().getDisplayMetrics());
    Log.i(TAG, "touch slop = " + this.touchSlop + "  SENSOR_DISTANCE = " + SENSOR_DISTANCE);
}
项目:NestedScroll    文件:EmbeddedScrollView.java   
private void init() {
    setOverScrollMode(View.OVER_SCROLL_NEVER);
    this.mParentHelper = new NestedScrollingParentHelper(this);
    this.touchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();
    SENSOR_DISTANCE = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 200.0F, getResources().getDisplayMetrics());
    // Log.i(TAG, "touch slop = " + this.touchSlop + "  SENSOR_DISTANCE = " + SENSOR_DISTANCE);
}
项目:Mysplash    文件:NestedScrollFrameLayout.java   
private void initialize() {
    this.nestedScrollingChildHelper = new NestedScrollingChildHelper(this);
    this.nestedScrollingParentHelper = new NestedScrollingParentHelper(this);
    setNestedScrollingEnabled(true);

    setForceScrolling(false);

    this.touchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();
}
项目:Mysplash    文件:BothWaySwipeRefreshLayout.java   
public BothWaySwipeRefreshLayout(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();
    mCircleWidth = (int) (CIRCLE_DIAMETER * metrics.density);
    mCircleHeight = (int) (CIRCLE_DIAMETER * metrics.density);
    mDragTriggerDistances[DIRECTION_TOP] = DEFAULT_CIRCLE_TARGET * metrics.density;
    mDragTriggerDistances[DIRECTION_BOTTOM] = DEFAULT_CIRCLE_TARGET * metrics.density;

    createProgressView();
    ViewCompat.setChildrenDrawingOrderEnabled(this, true);

    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();
}
项目:SwipeRefreshPlusLayout    文件:SwipeRefreshPlusLayout.java   
/**
 * Constructor that is called when inflating SwipeRefreshLayout from XML.
 *
 * @param context
 * @param attrs
 */
public SwipeRefreshPlusLayout(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();
    createLoadMoreProgressView();
    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;
    mNestedScrollingParentHelper = new NestedScrollingParentHelper(this);

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

}
项目:RefreshLayout    文件:RefreshLayout.java   
/**
 * Constructor that is called when inflating SwipeRefreshLayout from XML.
 *
 * @param context
 * @param attrs
 */
public RefreshLayout(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);
    mAccelerateInterpolator = new AccelerateInterpolator(ACCELERATE_INTERPOLATION_FACTOR);

    final DisplayMetrics metrics = getResources().getDisplayMetrics();
    mCircleDiameter = (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
    mHeaderSpinnerOffsetEnd = (int) (DEFAULT_CIRCLE_TARGET * metrics.density);
    mHeaderTotalDragDistance = mHeaderSpinnerOffsetEnd;
    mNestedScrollingParentHelper = new NestedScrollingParentHelper(this);

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

    mHeaderOriginalOffsetTop = mHeaderCurrentTargetOffsetTop = -mCircleDiameter;
    moveToStart(1.0f);

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

    mProgressBar = new SwipeProgressBar(this);
    mProgressBarHeight = (int) (metrics.density * PROGRESS_BAR_HEIGHT);
}
项目:MyBlogDemo    文件:HeaderRefreshLayout.java   
public HeaderRefreshLayout(Context context, AttributeSet attrs,
                           int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    mNestedScrollingParentHelper = new NestedScrollingParentHelper(this);
    mNestedScrollingChildHelper = new NestedScrollingChildHelper(this);
    setNestedScrollingEnabled(true);
    header = new TouchCircleView(getContext());
    header.addLoadingListener(this);
    float density = context.getResources().getDisplayMetrics().density;
    addView(header, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, (int) (density * 120)));
}
项目:MyBlogDemo    文件:HeadViewFrameLayout.java   
public HeadViewFrameLayout(Context context, AttributeSet attrs,
                           int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    mNestedScrollingParentHelper = new NestedScrollingParentHelper(this);
    mNestedScrollingChildHelper = new NestedScrollingChildHelper(this);
    setNestedScrollingEnabled(true);
}
项目:FlyRefresh    文件:PullHeaderLayout.java   
public PullHeaderLayout(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);

    int headerHeight = DEFAULT_HEIGHT;
    int headerExpandHeight = DEFAULT_EXPAND;
    int headerShrinkHeight = DEFAULT_SHRINK;

    if (attrs != null) {
        TypedArray arr = context.obtainStyledAttributes(attrs, R.styleable.PullHeaderLayout);
        headerHeight = arr.getDimensionPixelOffset(R.styleable.PullHeaderLayout_phl_header_height,
                DEFAULT_HEIGHT);
        headerExpandHeight = arr.getDimensionPixelOffset(R.styleable.PullHeaderLayout_phl_header_expand_height,
                DEFAULT_EXPAND);
        headerShrinkHeight = arr.getDimensionPixelOffset(R.styleable.PullHeaderLayout_phl_header_shrink_height,
                DEFAULT_SHRINK);

        mHeaderId = arr.getResourceId(R.styleable.PullHeaderLayout_phl_header, mHeaderId);
        mContentId = arr.getResourceId(R.styleable.PullHeaderLayout_phl_content, mContentId);

        mActionDrawable = arr.getDrawable(R.styleable.PullHeaderLayout_phl_action);

        arr.recycle();
    }

    mHeaderController = new HeaderController(headerHeight, headerExpandHeight, headerShrinkHeight);

    final ViewConfiguration conf = ViewConfiguration.get(getContext());

    mParentHelper = new NestedScrollingParentHelper(this);
    mChildHelper = new NestedScrollingChildHelper(this);

    setNestedScrollingEnabled(true);

    init();
}
项目:GitHub    文件:SmartRefreshLayout.java   
private void initView(Context context, AttributeSet attrs) {
    setClipToPadding(false);

    DensityUtil density = new DensityUtil();
    ViewConfiguration configuration = ViewConfiguration.get(context);

    mScroller = new Scroller(context);
    mScreenHeightPixels = context.getResources().getDisplayMetrics().heightPixels;
    mReboundInterpolator = new ViscousFluidInterpolator();
    mTouchSlop = configuration.getScaledTouchSlop();
    mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
    mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();

    mNestedScrollingParentHelper = new NestedScrollingParentHelper(this);
    mNestedScrollingChildHelper = new NestedScrollingChildHelper(this);

    TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.SmartRefreshLayout);

    ViewCompat.setNestedScrollingEnabled(this, ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnableNestedScrolling, false));
    mDragRate = ta.getFloat(R.styleable.SmartRefreshLayout_srlDragRate, mDragRate);
    mHeaderMaxDragRate = ta.getFloat(R.styleable.SmartRefreshLayout_srlHeaderMaxDragRate, mHeaderMaxDragRate);
    mFooterMaxDragRate = ta.getFloat(R.styleable.SmartRefreshLayout_srlFooterMaxDragRate, mFooterMaxDragRate);
    mHeaderTriggerRate = ta.getFloat(R.styleable.SmartRefreshLayout_srlHeaderTriggerRate, mHeaderTriggerRate);
    mFooterTriggerRate = ta.getFloat(R.styleable.SmartRefreshLayout_srlFooterTriggerRate, mFooterTriggerRate);
    mEnableRefresh = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnableRefresh, mEnableRefresh);
    mReboundDuration = ta.getInt(R.styleable.SmartRefreshLayout_srlReboundDuration, mReboundDuration);
    mEnableLoadmore = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnableLoadmore, mEnableLoadmore);
    mHeaderHeight = ta.getDimensionPixelOffset(R.styleable.SmartRefreshLayout_srlHeaderHeight, density.dip2px(100));
    mFooterHeight = ta.getDimensionPixelOffset(R.styleable.SmartRefreshLayout_srlFooterHeight, density.dip2px(60));
    mDisableContentWhenRefresh = ta.getBoolean(R.styleable.SmartRefreshLayout_srlDisableContentWhenRefresh, mDisableContentWhenRefresh);
    mDisableContentWhenLoading = ta.getBoolean(R.styleable.SmartRefreshLayout_srlDisableContentWhenLoading, mDisableContentWhenLoading);
    mEnableHeaderTranslationContent = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnableHeaderTranslationContent, mEnableHeaderTranslationContent);
    mEnableFooterTranslationContent = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnableFooterTranslationContent, mEnableFooterTranslationContent);
    mEnablePreviewInEditMode = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnablePreviewInEditMode, mEnablePreviewInEditMode);
    mEnableAutoLoadmore = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnableAutoLoadmore, mEnableAutoLoadmore);
    mEnableOverScrollBounce = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnableOverScrollBounce, mEnableOverScrollBounce);
    mEnablePureScrollMode = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnablePureScrollMode, mEnablePureScrollMode);
    mEnableScrollContentWhenLoaded = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnableScrollContentWhenLoaded, mEnableScrollContentWhenLoaded);
    mEnableLoadmoreWhenContentNotFull = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnableLoadmoreWhenContentNotFull, mEnableLoadmoreWhenContentNotFull);
    mFixedHeaderViewId = ta.getResourceId(R.styleable.SmartRefreshLayout_srlFixedHeaderViewId, View.NO_ID);
    mFixedFooterViewId = ta.getResourceId(R.styleable.SmartRefreshLayout_srlFixedFooterViewId, View.NO_ID);

    mManualLoadmore = ta.hasValue(R.styleable.SmartRefreshLayout_srlEnableLoadmore);
    mManualNestedScrolling = ta.hasValue(R.styleable.SmartRefreshLayout_srlEnableNestedScrolling);
    mHeaderHeightStatus = ta.hasValue(R.styleable.SmartRefreshLayout_srlHeaderHeight) ? DimensionStatus.XmlLayoutUnNotify : mHeaderHeightStatus;
    mFooterHeightStatus = ta.hasValue(R.styleable.SmartRefreshLayout_srlFooterHeight) ? DimensionStatus.XmlLayoutUnNotify : mFooterHeightStatus;

    mHeaderExtendHeight = (int) Math.max((mHeaderHeight * (mHeaderMaxDragRate - 1)), 0);
    mFooterExtendHeight = (int) Math.max((mFooterHeight * (mFooterMaxDragRate - 1)), 0);

    int accentColor = ta.getColor(R.styleable.SmartRefreshLayout_srlAccentColor, 0);
    int primaryColor = ta.getColor(R.styleable.SmartRefreshLayout_srlPrimaryColor, 0);
    if (primaryColor != 0) {
        if (accentColor != 0) {
            mPrimaryColors = new int[]{primaryColor, accentColor};
        } else {
            mPrimaryColors = new int[]{primaryColor};
        }
    }

    ta.recycle();

}
项目:Rxjava2.0Demo    文件:SmartRefreshLayout.java   
private void initView(Context context, AttributeSet attrs) {
    setClipToPadding(false);

    DensityUtil density = new DensityUtil();
    ViewConfiguration configuration = ViewConfiguration.get(context);

    mKernel = new RefreshKernelImpl();
    mScroller = new Scroller(context);
    mVelocityTracker = VelocityTracker.obtain();
    mScreenHeightPixels = context.getResources().getDisplayMetrics().heightPixels;
    mReboundInterpolator = new ViscousFluidInterpolator();
    mTouchSlop = configuration.getScaledTouchSlop();
    mMinimumVelocity = configuration.getScaledMinimumFlingVelocity();
    mMaximumVelocity = configuration.getScaledMaximumFlingVelocity();

    mNestedScrollingParentHelper = new NestedScrollingParentHelper(this);
    mNestedScrollingChildHelper = new NestedScrollingChildHelper(this);

    TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.SmartRefreshLayout);

    ViewCompat.setNestedScrollingEnabled(this, ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnableNestedScrolling, false));
    mDragRate = ta.getFloat(R.styleable.SmartRefreshLayout_srlDragRate, mDragRate);
    mHeaderMaxDragRate = ta.getFloat(R.styleable.SmartRefreshLayout_srlHeaderMaxDragRate, mHeaderMaxDragRate);
    mFooterMaxDragRate = ta.getFloat(R.styleable.SmartRefreshLayout_srlFooterMaxDragRate, mFooterMaxDragRate);
    mHeaderTriggerRate = ta.getFloat(R.styleable.SmartRefreshLayout_srlHeaderTriggerRate, mHeaderTriggerRate);
    mFooterTriggerRate = ta.getFloat(R.styleable.SmartRefreshLayout_srlFooterTriggerRate, mFooterTriggerRate);
    mEnableRefresh = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnableRefresh, mEnableRefresh);
    mReboundDuration = ta.getInt(R.styleable.SmartRefreshLayout_srlReboundDuration, mReboundDuration);
    mEnableLoadmore = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnableLoadmore, mEnableLoadmore);
    mHeaderHeight = ta.getDimensionPixelOffset(R.styleable.SmartRefreshLayout_srlHeaderHeight, density.dip2px(100));
    mFooterHeight = ta.getDimensionPixelOffset(R.styleable.SmartRefreshLayout_srlFooterHeight, density.dip2px(60));
    mDisableContentWhenRefresh = ta.getBoolean(R.styleable.SmartRefreshLayout_srlDisableContentWhenRefresh, mDisableContentWhenRefresh);
    mDisableContentWhenLoading = ta.getBoolean(R.styleable.SmartRefreshLayout_srlDisableContentWhenLoading, mDisableContentWhenLoading);
    mEnableHeaderTranslationContent = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnableHeaderTranslationContent, mEnableHeaderTranslationContent);
    mEnableFooterTranslationContent = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnableFooterTranslationContent, mEnableFooterTranslationContent);
    mEnablePreviewInEditMode = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnablePreviewInEditMode, mEnablePreviewInEditMode);
    mEnableAutoLoadmore = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnableAutoLoadmore, mEnableAutoLoadmore);
    mEnableOverScrollBounce = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnableOverScrollBounce, mEnableOverScrollBounce);
    mEnablePureScrollMode = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnablePureScrollMode, mEnablePureScrollMode);
    mEnableScrollContentWhenLoaded = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnableScrollContentWhenLoaded, mEnableScrollContentWhenLoaded);
    mEnableLoadmoreWhenContentNotFull = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnableLoadmoreWhenContentNotFull, mEnableLoadmoreWhenContentNotFull);
    mEnableFooterFollowWhenLoadFinished = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnableFooterFollowWhenLoadFinished, mEnableFooterFollowWhenLoadFinished);
    mEnableOverScrollDrag = ta.getBoolean(R.styleable.SmartRefreshLayout_srlEnableOverScrollDrag, mEnableOverScrollDrag);
    mFixedHeaderViewId = ta.getResourceId(R.styleable.SmartRefreshLayout_srlFixedHeaderViewId, View.NO_ID);
    mFixedFooterViewId = ta.getResourceId(R.styleable.SmartRefreshLayout_srlFixedFooterViewId, View.NO_ID);

    mManualLoadmore = ta.hasValue(R.styleable.SmartRefreshLayout_srlEnableLoadmore);
    mManualNestedScrolling = ta.hasValue(R.styleable.SmartRefreshLayout_srlEnableNestedScrolling);
    mHeaderHeightStatus = ta.hasValue(R.styleable.SmartRefreshLayout_srlHeaderHeight) ? DimensionStatus.XmlLayoutUnNotify : mHeaderHeightStatus;
    mFooterHeightStatus = ta.hasValue(R.styleable.SmartRefreshLayout_srlFooterHeight) ? DimensionStatus.XmlLayoutUnNotify : mFooterHeightStatus;

    mHeaderExtendHeight = (int) Math.max((mHeaderHeight * (mHeaderMaxDragRate - 1)), 0);
    mFooterExtendHeight = (int) Math.max((mFooterHeight * (mFooterMaxDragRate - 1)), 0);

    int accentColor = ta.getColor(R.styleable.SmartRefreshLayout_srlAccentColor, 0);
    int primaryColor = ta.getColor(R.styleable.SmartRefreshLayout_srlPrimaryColor, 0);
    if (primaryColor != 0) {
        if (accentColor != 0) {
            mPrimaryColors = new int[]{primaryColor, accentColor};
        } else {
            mPrimaryColors = new int[]{primaryColor};
        }
    }

    ta.recycle();

}