diff options
Diffstat (limited to 'Xamarin.Forms.Platform.Android/ViewRenderer.cs')
-rw-r--r-- | Xamarin.Forms.Platform.Android/ViewRenderer.cs | 99 |
1 files changed, 1 insertions, 98 deletions
diff --git a/Xamarin.Forms.Platform.Android/ViewRenderer.cs b/Xamarin.Forms.Platform.Android/ViewRenderer.cs index 31a9c282..c4bd3fa0 100644 --- a/Xamarin.Forms.Platform.Android/ViewRenderer.cs +++ b/Xamarin.Forms.Platform.Android/ViewRenderer.cs @@ -19,9 +19,6 @@ namespace Xamarin.Forms.Platform.Android } ViewGroup _container; - string _defaultContentDescription; - bool? _defaultFocusable; - string _defaultHint; bool _disposed; EventHandler<VisualElement.FocusRequestArgs> _focusChangeHandler; @@ -69,7 +66,7 @@ namespace Xamarin.Forms.Platform.Android { if (Control == null) return (base.GetDesiredSize(widthConstraint, heightConstraint)); - + AView view = _container == this ? (AView)Control : _container; view.Measure(widthConstraint, heightConstraint); @@ -127,8 +124,6 @@ namespace Xamarin.Forms.Platform.Android if (e.PropertyName == VisualElement.IsEnabledProperty.PropertyName) UpdateIsEnabled(); - else if (e.PropertyName == Accessibility.LabeledByProperty.PropertyName) - SetLabeledBy(); } protected override void OnLayout(bool changed, int l, int t, int r, int b) @@ -160,79 +155,6 @@ namespace Xamarin.Forms.Platform.Android } } - protected override void SetContentDescription() - { - if (Control == null) - { - base.SetContentDescription(); - return; - } - - if (Element == null) - return; - - if (SetHint()) - return; - - if (_defaultContentDescription == null) - _defaultContentDescription = Control.ContentDescription; - - var elemValue = string.Join(" ", (string)Element.GetValue(Accessibility.NameProperty), (string)Element.GetValue(Accessibility.HintProperty)); - - if (!string.IsNullOrWhiteSpace(elemValue)) - Control.ContentDescription = elemValue; - else - Control.ContentDescription = _defaultContentDescription; - } - - protected override void SetFocusable() - { - if (Control == null) - { - base.SetFocusable(); - return; - } - - if (Element == null) - return; - - if (!_defaultFocusable.HasValue) - _defaultFocusable = Control.Focusable; - - Control.Focusable = (bool)((bool?)Element.GetValue(Accessibility.IsInAccessibleTreeProperty) ?? _defaultFocusable); - } - - protected override bool SetHint() - { - if (Control == null) - { - return base.SetHint(); - } - - if (Element == null) - return false; - - var textView = Control as global::Android.Widget.TextView; - if (textView == null) - return false; - - // Let the specified Title/Placeholder take precedence, but don't set the ContentDescription (won't work anyway) - if (((Element as Picker)?.Title ?? (Element as Entry)?.Placeholder ?? (Element as EntryCell)?.Placeholder) != null) - return true; - - if (_defaultHint == null) - _defaultHint = textView.Hint; - - var elemValue = string.Join(". ", (string)Element.GetValue(Accessibility.NameProperty), (string)Element.GetValue(Accessibility.HintProperty)); - - if (!string.IsNullOrWhiteSpace(elemValue)) - textView.Hint = elemValue; - else - textView.Hint = _defaultHint; - - return true; - } - protected void SetNativeControl(TNativeView control) { SetNativeControl(control, this); @@ -297,25 +219,6 @@ namespace Xamarin.Forms.Platform.Android Control.OnFocusChangeListener = this; UpdateIsEnabled(); - SetLabeledBy(); - } - - void SetLabeledBy() - { - if (Element == null || Control == null) - return; - - var elemValue = (VisualElement)Element.GetValue(Accessibility.LabeledByProperty); - - if (elemValue != null) - { - var id = Control.Id; - if (id == -1) - id = Control.Id = FormsAppCompatActivity.GetUniqueId(); - - var renderer = elemValue?.GetRenderer(); - renderer?.SetLabelFor(id); - } } void UpdateIsEnabled() |