public ActionImageRenderer(Context context) { Context = context; AnimatorUpdateListener = new AnonymousAnimatorUpdateListener(amor => { this.ComputeRender((float)amor.AnimatedValue); Callback.InvalidateDrawable(null); }); TypedValue tv = new TypedValue(); if (context.Theme.ResolveAttribute(Android.Resource.Attribute.ActionBarSize, tv, true)) { ActionBarHeight = TypedValue.ComplexToDimensionPixelSize(tv.Data, context.Resources.DisplayMetrics); } var dm = context.Resources.DisplayMetrics; float density = dm.Density; Width = dm.WidthPixels; Height = dm.HeightPixels - StatusBarHeight - ActionBarHeight; Duration = ANIMATION_DURATION; RenderAnimator = ValueAnimator.OfFloat(0.0f, 1.0f); RenderAnimator.RepeatCount = Animation.Infinite; RenderAnimator.RepeatMode = ValueAnimatorRepeatMode.Restart; RenderAnimator.SetDuration(Duration); RenderAnimator.SetInterpolator(new LinearInterpolator()); RenderAnimator.AddUpdateListener(AnimatorUpdateListener); }
public LoadingRenderer(Context context) { AnimatorUpdateListener = new AnonymousAnimatorUpdateListener(amor => { this.ComputeRender((float)amor.AnimatedValue); Callback.InvalidateDrawable(null); }); InitParams(context); SetupAnimators(); }