fix changed apis (#5426)
authorShane Neuville <shane94@hotmail.com>
Sat, 2 Mar 2019 03:15:08 +0000 (20:15 -0700)
committerSamantha Houts <samhouts@users.noreply.github.com>
Sat, 2 Mar 2019 03:15:08 +0000 (19:15 -0800)
* fix changed apis

* increment language version

* bring some back

* update font

* VisualElement fixes

fixes #4644
fixes #5170

Xamarin.Forms.Core/HandlerAttribute.cs
Xamarin.Forms.Core/VisualElement.cs
Xamarin.Forms.Material.Android/MaterialEntryRenderer.cs
Xamarin.Forms.Material.iOS/MaterialEntryRenderer.cs
Xamarin.Forms.Platform.Android/Renderers/EntryRenderer.cs
Xamarin.Forms.Platform.Android/Renderers/PickerEditText.cs
Xamarin.Forms.Platform.iOS/Extensions/Extensions.cs
Xamarin.Forms.Platform.iOS/Extensions/ToolbarItemExtensions.cs
Xamarin.Forms.Platform.iOS/Renderers/EntryRenderer.cs

index a34f009..591ebaa 100644 (file)
@@ -5,7 +5,11 @@ namespace Xamarin.Forms
        [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
        public abstract class HandlerAttribute : Attribute
        {
-               protected HandlerAttribute(Type handler, Type target, Type[] supportedVisuals = null)
+               protected HandlerAttribute(Type handler, Type target) : this(handler, target, null)
+               {
+               }
+
+               protected HandlerAttribute(Type handler, Type target, Type[] supportedVisuals)
                {
                        SupportedVisuals = supportedVisuals ?? new[] { typeof(VisualMarker.DefaultVisual) };
                        TargetType = target;
index cc9a739..cb7826c 100644 (file)
@@ -8,6 +8,11 @@ namespace Xamarin.Forms
 {
        public partial class VisualElement : NavigableElement, IAnimatable, IVisualElementController, IResourcesProvider, IStyleElement, IFlowDirectionController, IPropertyPropagationController, IVisualController
        {
+
+               public new static readonly BindableProperty NavigationProperty = NavigableElement.NavigationProperty;
+
+               public new static readonly BindableProperty StyleProperty = NavigableElement.StyleProperty;
+
                public static readonly BindableProperty InputTransparentProperty = BindableProperty.Create("InputTransparent", typeof(bool), typeof(VisualElement), default(bool));
 
                public static readonly BindableProperty IsEnabledProperty = BindableProperty.Create("IsEnabled", typeof(bool),
index ef305ba..b7afe87 100644 (file)
@@ -36,7 +36,7 @@ namespace Xamarin.Forms.Material.Android
                        UpdateBackgroundColor();
                }
 
-               protected override void UpdateTextColor() => ApplyTheme();
+               protected override void UpdateColor() => ApplyTheme();
 
                protected override void UpdateBackgroundColor()
                {
@@ -46,17 +46,24 @@ namespace Xamarin.Forms.Material.Android
                        _textInputLayout.BoxBackgroundColor = MaterialColors.CreateEntryFilledInputBackgroundColor(Element.BackgroundColor, Element.TextColor);
                }
 
-               protected internal override void UpdatePlaceHolderText() => _textInputLayout.SetHint(Element.Placeholder, Element);
+               protected override void UpdatePlaceHolderText() => _textInputLayout.SetHint(Element.Placeholder, Element);
                protected override EditText EditText => _textInputEditText;
                protected override void UpdatePlaceholderColor() => ApplyTheme();
-               void ApplyTheme() => _textInputLayout?.ApplyTheme(Element.TextColor, Element.PlaceholderColor);
+               void ApplyTheme(Color textColor) => _textInputLayout?.ApplyTheme(textColor, Element.PlaceholderColor);
+               void ApplyTheme() => ApplyTheme(Element.TextColor);
 
-               protected internal override void UpdateFont()
+               protected override void UpdateTextColor(Color color)
+               {
+                       ApplyTheme(color);
+               }
+
+               protected override void UpdateFont()
                {
                        base.UpdateFont();
                        _textInputLayout.Typeface = Element.ToTypeface();
                        _textInputEditText.SetTextSize(ComplexUnitType.Sp, (float)Element.FontSize);
                }
+
        }
 }
 #endif
\ No newline at end of file
index 367701c..ee35dce 100644 (file)
@@ -8,11 +8,11 @@ namespace Xamarin.Forms.Material.iOS
        {
                protected override MaterialTextField CreateNativeControl() => new MaterialTextField(this, Element);
                protected override void SetBackgroundColor(Color color) => ApplyTheme();
-               protected internal override void UpdateColor() => Control?.UpdateTextColor(this);
+               protected override void UpdateColor() => Control?.UpdateTextColor(this);
                protected virtual void ApplyTheme() => Control?.ApplyTheme(this);
-               protected internal override void UpdatePlaceholder() => Control?.UpdatePlaceholder(this);
+               protected override void UpdatePlaceholder() => Control?.UpdatePlaceholder(this);
 
-               protected internal override void UpdateFont()
+               protected override void UpdateFont()
                {
                        base.UpdateFont();
                        Control?.ApplyTypographyScheme(Element);
index c64da8e..75acb2e 100644 (file)
@@ -49,10 +49,15 @@ namespace Xamarin.Forms.Platform.Android
                        _hintColorSwitcher.UpdateTextColor(EditText, Element.PlaceholderColor, EditText.SetHintTextColor);
                }
 
-               protected override void UpdateTextColor()
+               protected override void UpdateColor()
+               {
+                       UpdateTextColor(Element.TextColor);
+               }
+
+               protected override void UpdateTextColor(Color color)
                {
                        _textColorSwitcher = _textColorSwitcher ?? new TextColorSwitcher(EditText.TextColors, Element.UseLegacyColorManagement());
-                       _textColorSwitcher.UpdateTextColor(EditText, Element.TextColor);
+                       _textColorSwitcher.UpdateTextColor(EditText, color);
                }
        }
 
@@ -155,7 +160,7 @@ namespace Xamarin.Forms.Platform.Android
                        EditText.Text = Element.Text;
                        UpdateInputType();
 
-                       UpdateTextColor();
+                       UpdateColor();
                        UpdateAlignment();
                        UpdateFont();
                        UpdatePlaceholderColor();
@@ -190,7 +195,7 @@ namespace Xamarin.Forms.Platform.Android
                }
 
 
-               internal protected virtual void UpdatePlaceHolderText() => EditText.Hint = Element.Placeholder;
+               protected virtual void UpdatePlaceHolderText() => EditText.Hint = Element.Placeholder;
 
                protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
                {
@@ -211,7 +216,7 @@ namespace Xamarin.Forms.Platform.Android
                                }
                        }
                        else if (e.PropertyName == Entry.TextColorProperty.PropertyName)
-                               UpdateTextColor();
+                               UpdateColor();
                        else if (e.PropertyName == InputView.KeyboardProperty.PropertyName)
                                UpdateInputType();
                        else if (e.PropertyName == InputView.IsSpellCheckEnabledProperty.PropertyName)
@@ -268,9 +273,10 @@ namespace Xamarin.Forms.Platform.Android
                        EditText.UpdateHorizontalAlignment(Element.HorizontalTextAlignment, Context.HasRtlSupport());
                }
 
-               abstract protected void UpdateTextColor();
+               protected abstract void UpdateColor();
+               protected abstract void UpdateTextColor(Color color);
 
-               protected internal virtual void UpdateFont()
+               protected virtual void UpdateFont()
                {
                        EditText.Typeface = Element.ToTypeface();
                        EditText.SetTextSize(ComplexUnitType.Sp, (float)Element.FontSize);
index 5ac6558..c7a7a1a 100644 (file)
@@ -16,6 +16,11 @@ namespace Xamarin.Forms.Platform.Android
                        PickerManager.Init(this);
                }
 
+               public PickerEditText(Context context, IPickerRenderer pickerRenderer) : this(context)
+               {
+
+               }
+
                public override bool OnTouchEvent(MotionEvent e)
                {
                        PickerManager.OnTouchEvent(this, e);
index 807ab8e..828f206 100644 (file)
@@ -5,6 +5,12 @@ namespace Xamarin.Forms.Platform.iOS
 {
        public static class Extensions
        {
+               public static void ApplyKeyboard(this IUITextInput textInput, Keyboard keyboard)
+               {
+                       if(textInput is IUITextInputTraits traits)
+                               ApplyKeyboard(traits, keyboard);
+               }
+
                public static void ApplyKeyboard(this IUITextInputTraits textInput, Keyboard keyboard)
                {
                        textInput.AutocapitalizationType = UITextAutocapitalizationType.None;
index c581c26..98006be 100644 (file)
@@ -9,6 +9,11 @@ namespace Xamarin.Forms.Platform.iOS
 {
        public static class ToolbarItemExtensions
        {
+               public static UIKit.UIBarButtonItem ToUIBarButtonItem(this Xamarin.Forms.ToolbarItem item, bool forceName)
+               {
+                       return ToUIBarButtonItem(item, false, false);
+               }
+
                public static UIBarButtonItem ToUIBarButtonItem(this ToolbarItem item, bool forceName = false, bool forcePrimary = false)
                {
                        if (item.Order == ToolbarItemOrder.Secondary && !forcePrimary)
index 8b6780a..118e59a 100644 (file)
@@ -239,7 +239,7 @@ namespace Xamarin.Forms.Platform.iOS
                        Control.TextAlignment = Element.HorizontalTextAlignment.ToNativeTextAlignment(((IVisualElementController)Element).EffectiveFlowDirection);
                }
 
-               protected internal virtual void UpdateColor()
+               protected virtual void UpdateColor()
                {
                        var textColor = Element.TextColor;
 
@@ -258,7 +258,7 @@ namespace Xamarin.Forms.Platform.iOS
                        Control.AdjustsFontSizeToFitWidth = Element.OnThisPlatform().AdjustsFontSizeToFitWidth();
                }
 
-               protected internal virtual void UpdateFont()
+               protected virtual void UpdateFont()
                {
                        if (initialSize == CGSize.Empty)
                        {
@@ -306,7 +306,7 @@ namespace Xamarin.Forms.Platform.iOS
                                Control.SecureTextEntry = Element.IsPassword;
                }
 
-               protected internal virtual void UpdatePlaceholder()
+               protected virtual void UpdatePlaceholder()
                {
                        var formatted = (FormattedString)Element.Placeholder;