2016-05-12 07:09:06 +03:00
|
|
|
|
using System;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using Bit.Android.Controls;
|
|
|
|
|
using Bit.App.Controls;
|
|
|
|
|
using Xamarin.Forms;
|
|
|
|
|
using Xamarin.Forms.Platform.Android;
|
|
|
|
|
|
|
|
|
|
[assembly: ExportRenderer(typeof(ExtendedPicker), typeof(ExtendedPickerRenderer))]
|
|
|
|
|
namespace Bit.Android.Controls
|
|
|
|
|
{
|
|
|
|
|
public class ExtendedPickerRenderer : PickerRenderer
|
|
|
|
|
{
|
|
|
|
|
protected override void OnElementChanged(ElementChangedEventArgs<Picker> e)
|
|
|
|
|
{
|
|
|
|
|
base.OnElementChanged(e);
|
|
|
|
|
|
|
|
|
|
var view = (ExtendedPicker)Element;
|
|
|
|
|
|
2016-08-19 03:20:18 +03:00
|
|
|
|
Control.TextSize = (float)Device.GetNamedSize(NamedSize.Small, typeof(Picker));
|
2016-05-12 07:09:06 +03:00
|
|
|
|
SetBorder(view);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
var view = (ExtendedPicker)Element;
|
|
|
|
|
|
|
|
|
|
if(e.PropertyName == ExtendedPicker.HasBorderProperty.PropertyName)
|
|
|
|
|
{
|
|
|
|
|
SetBorder(view);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
base.OnElementPropertyChanged(sender, e);
|
|
|
|
|
if(e.PropertyName == VisualElement.BackgroundColorProperty.PropertyName)
|
|
|
|
|
{
|
|
|
|
|
Control.SetBackgroundColor(view.BackgroundColor.ToAndroid());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void SetBorder(ExtendedPicker view)
|
|
|
|
|
{
|
|
|
|
|
if(!view.HasBorder)
|
|
|
|
|
{
|
|
|
|
|
Control.SetBackgroundColor(global::Android.Graphics.Color.Transparent);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|