public void OnAnimationEnd(Animation animation) { if (swipeRefreshLayout.mRefreshing) { // Make sure the progress view is fully visible swipeRefreshLayout.mProgress.SetAlpha(MAX_ALPHA); swipeRefreshLayout.mProgress.Start(); if (swipeRefreshLayout.mNotify) { if (swipeRefreshLayout.mListener != null) { swipeRefreshLayout.mListener.onRefresh(); } } } else { swipeRefreshLayout.mProgress.Stop(); swipeRefreshLayout.mCircleView.Visibility = ViewStates.Gone; swipeRefreshLayout.setColorViewAlpha(MAX_ALPHA); // Return the circle to its start position if (swipeRefreshLayout.mScale) { swipeRefreshLayout.setAnimationProgress(0 /* animation complete and view is hidden */); } else { swipeRefreshLayout.setTargetOffsetTopAndBottom(swipeRefreshLayout.mOriginalOffsetTop - swipeRefreshLayout.mCurrentTargetOffsetTop, true /* requires update */); } } swipeRefreshLayout.mCurrentTargetOffsetTop = swipeRefreshLayout.mCircleView.Top; }
protected override void ApplyTransformation(float interpolatedTime, Transformation t) { int targetTop = 0; int endTarget = 0; if (!swipeRefreshLayout.mUsingCustomStart) { endTarget = (int)(swipeRefreshLayout.mSpinnerFinalOffset - System.Math.Abs(swipeRefreshLayout.mOriginalOffsetTop)); } else { endTarget = (int)swipeRefreshLayout.mSpinnerFinalOffset; } targetTop = (swipeRefreshLayout.mFrom + (int)((endTarget - swipeRefreshLayout.mFrom) * interpolatedTime)); int offset = targetTop - swipeRefreshLayout.mCircleView.Top; swipeRefreshLayout.setTargetOffsetTopAndBottom(offset, false /* requires update */); swipeRefreshLayout.mProgress.setArrowScale(1 - interpolatedTime); }