mirror of
https://github.com/bitwarden/android.git
synced 2024-11-01 15:45:42 +03:00
34 lines
1.1 KiB
C#
34 lines
1.1 KiB
C#
|
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());
|
|||
|
thumb.SetStroke(1, view.ThumbBorderColor.ToAndroid());
|
|||
|
Control.SetThumb(thumb);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|