/** * Constructor that is called when inflating SwipeRefreshLayout from XML. * * @param context * @param attrs */ public SwipeRefreshLayout(Context context, IAttributeSet attrs) : base(context, attrs) { mRefreshListener = new CustomRefreshListener(this); mAnimateToCorrectPosition = new CustommAnimateToCorrectPosition(this); mAnimateToStartPosition = new CustommAnimateToStartPosition(this); mTouchSlop = ViewConfiguration.Get(context).ScaledTouchSlop; mMediumAnimationDuration = Resources.GetInteger( AndroidResource.Integer.ConfigMediumAnimTime); SetWillNotDraw(false); mDecelerateInterpolator = new DecelerateInterpolator(DECELERATE_INTERPOLATION_FACTOR); TypedArray a = context.ObtainStyledAttributes(attrs, LAYOUT_ATTRS); Enabled = (a.GetBoolean(0, true)); a.Recycle(); DisplayMetrics metrics = Resources.DisplayMetrics; 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); }
/** * Constructor that is called when inflating SwipeRefreshLayout from XML. * * @param context * @param attrs */ public SwipeRefreshLayout(Context context, IAttributeSet attrs = null) : base(context, attrs) { _refreshListener = new CustomRefreshListener(this); _animateToCorrectPosition = new CustommAnimateToCorrectPosition(this); _animateToStartPosition = new CustommAnimateToStartPosition(this); _touchSlop = ViewConfiguration.Get(context).ScaledTouchSlop; _mediumAnimationDuration = Resources.GetInteger( AndroidResource.Integer.ConfigMediumAnimTime); SetWillNotDraw(false); _decelerateInterpolator = new DecelerateInterpolator(DecelerateInterpolationFactor); var a = context.ObtainStyledAttributes(attrs, LayoutAttrs); Enabled = (a.GetBoolean(0, true)); a.Recycle(); var metrics = Resources.DisplayMetrics; _circleWidth = (int)(CircleDiameter * metrics.Density); _circleHeight = (int)(CircleDiameter * metrics.Density); CreateProgressView(); #pragma warning disable 618 ViewCompat.SetChildrenDrawingOrderEnabled(this, true); #pragma warning restore 618 // the absolute offset has to take into account that the circle starts at an offset _spinnerFinalOffset = DefaultCircleTarget * metrics.Density; _totalDragDistance = _spinnerFinalOffset; RequestDisallowInterceptTouchEvent(true); }