mirror of
https://github.com/bitwarden/android.git
synced 2025-01-08 17:27:39 +03:00
26 lines
954 B
C#
26 lines
954 B
C#
|
using Xamarin.Forms;
|
|||
|
|
|||
|
namespace Bit.App.Utilities
|
|||
|
{
|
|||
|
public static class ProgressBarExtensions
|
|||
|
{
|
|||
|
public static BindableProperty AnimatedProgressProperty =
|
|||
|
BindableProperty.CreateAttached("AnimatedProgress",
|
|||
|
typeof(double),
|
|||
|
typeof(ProgressBar),
|
|||
|
0.0d,
|
|||
|
BindingMode.OneWay,
|
|||
|
propertyChanged: (b, o, n) => ProgressBarProgressChanged((ProgressBar)b, (double)n));
|
|||
|
|
|||
|
public static double GetAnimatedProgress(BindableObject target) => (double)target.GetValue(AnimatedProgressProperty);
|
|||
|
public static void SetAnimatedProgress(BindableObject target, double value) => target.SetValue(AnimatedProgressProperty, value);
|
|||
|
|
|||
|
private static void ProgressBarProgressChanged(ProgressBar progressBar, double progress)
|
|||
|
{
|
|||
|
ViewExtensions.CancelAnimations(progressBar);
|
|||
|
progressBar.ProgressTo(progress, 500, Easing.SinIn);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|