2019-05-13 22:24:38 +03:00
|
|
|
|
using Android.Content;
|
|
|
|
|
using Android.Graphics.Drawables;
|
|
|
|
|
using Android.Support.V4.Content.Res;
|
|
|
|
|
using Bit.App.Controls;
|
|
|
|
|
using Bit.Droid.Renderers;
|
|
|
|
|
using Xamarin.Forms;
|
|
|
|
|
using Xamarin.Forms.Platform.Android;
|
|
|
|
|
|
|
|
|
|
[assembly: ExportRenderer(typeof(ExtendedSlider), typeof(ExtendedSliderRenderer))]
|
|
|
|
|
namespace Bit.Droid.Renderers
|
|
|
|
|
{
|
|
|
|
|
public class ExtendedSliderRenderer : SliderRenderer
|
|
|
|
|
{
|
|
|
|
|
public ExtendedSliderRenderer(Context context)
|
|
|
|
|
: base(context)
|
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
protected override void OnElementChanged(ElementChangedEventArgs<Slider> e)
|
|
|
|
|
{
|
|
|
|
|
base.OnElementChanged(e);
|
|
|
|
|
if(Control != null && Element is ExtendedSlider view)
|
|
|
|
|
{
|
|
|
|
|
var t = ResourcesCompat.GetDrawable(Resources, Resource.Drawable.slider_thumb, null);
|
|
|
|
|
if(t is GradientDrawable thumb)
|
|
|
|
|
{
|
|
|
|
|
thumb.SetColor(view.ThumbColor.ToAndroid());
|
2019-05-31 18:03:32 +03:00
|
|
|
|
thumb.SetStroke(3, view.ThumbBorderColor.ToAndroid());
|
2019-05-13 22:24:38 +03:00
|
|
|
|
Control.SetThumb(thumb);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|