diff --git a/SampleApp/SampleApp.Android/AndroidFocusEvents.cs b/SampleApp/SampleApp.Android/AndroidFocusEvents.cs index 190d40cccc8c5aa9a0a8809f2d5ca93e69f769d1..e416be620bcb261a739c3dda80802c52b22477b0 100644 --- a/SampleApp/SampleApp.Android/AndroidFocusEvents.cs +++ b/SampleApp/SampleApp.Android/AndroidFocusEvents.cs @@ -3,12 +3,12 @@ using Android.Content; using Android.Service.Autofill; using Android.Views.Accessibility; using CustomViewAccessibility.Droid; -using SampleApp.DependencyServices; +using SampleApp.CustomRenderers; using SampleApp.Views; using Xamarin.Forms; using Xamarin.Forms.Platform.Android; -[assembly: ExportRenderer(typeof(IFocusEvents), typeof(AndroidFocusEvents))] +[assembly: ExportRenderer(typeof(CustomImage), typeof(AndroidFocusEvents))] namespace CustomViewAccessibility.Droid { public class AndroidFocusEvents : ImageRenderer diff --git a/SampleApp/SampleApp.iOS/iOSFocusEvents.cs b/SampleApp/SampleApp.iOS/iOSFocusEvents.cs index ab28680ed5ad6db01a3bf1610d3e3ba239ca9e28..15902c3e9b3253768ae6018e20eadab6a14a85eb 100644 --- a/SampleApp/SampleApp.iOS/iOSFocusEvents.cs +++ b/SampleApp/SampleApp.iOS/iOSFocusEvents.cs @@ -1,11 +1,11 @@ using System; -using SampleApp.DependencyServices; +using SampleApp.CustomRenderers; using Xamarin.Forms; using SampleApp.iOS; using Xamarin.Forms.Platform.iOS; using SampleApp.Views; -[assembly: ExportRenderer(typeof(IFocusEvents), typeof(iOSFocusEvents))] +[assembly: ExportRenderer(typeof(CustomImage), typeof(iOSFocusEvents))] namespace SampleApp.iOS { public class iOSFocusEvents : ImageRenderer diff --git a/SampleApp/SampleApp.iOS/iOSMagicTap.cs b/SampleApp/SampleApp.iOS/iOSMagicTap.cs index b1e7f220dc60ef391a08a5c61b1fdf12f2ef4a42..e9b4cda8273eb3163a933e4f8b39df80a901b9eb 100644 --- a/SampleApp/SampleApp.iOS/iOSMagicTap.cs +++ b/SampleApp/SampleApp.iOS/iOSMagicTap.cs @@ -21,11 +21,6 @@ namespace SampleApp.iOS SetNativeControl(new MyView()); } } - - - - - } public class MyView : UITextView @@ -34,22 +29,19 @@ namespace SampleApp.iOS public MyView() : base() { - base.Text = "Select this label with the accessibility focus and perform a magic tap (tap with two fingers) to change the background color."; - Console.WriteLine("My View created"); + base.Text = "Perform a magic tap (tap with two fingers) to change the background color."; base.AccessibilityPerformMagicTap(); base.Editable = false; + base.Font = base.Font.WithSize(30); + Functionality23.customEditor.BackgroundColor = Color.White; + Functionality23.customEditor.TextColor = Color.Black; } - - public override bool AccessibilityPerformMagicTap() { - Console.WriteLine("MAGIC TAP"); - //random color Color randomColor = Color.FromRgb(rnd.Next(256), rnd.Next(256), rnd.Next(256)); - Functionality23.customEditor.Text = "MAGIC TAP"; Functionality23.customEditor.BackgroundColor = randomColor; Functionality23.customEditor.TextColor = Color.White; diff --git a/SampleApp/SampleApp/CustomRenderers/CustomImage.cs b/SampleApp/SampleApp/CustomRenderers/CustomImage.cs new file mode 100644 index 0000000000000000000000000000000000000000..cc03312229b2f867713ace244ba1eea6740c33bb --- /dev/null +++ b/SampleApp/SampleApp/CustomRenderers/CustomImage.cs @@ -0,0 +1,13 @@ +using System; +using Xamarin.Forms; + +namespace SampleApp.CustomRenderers +{ + public class CustomImage : Image + { + public CustomImage() + { + } + + } +} diff --git a/SampleApp/SampleApp/DependencyServices/IFocusEvents.cs b/SampleApp/SampleApp/DependencyServices/IFocusEvents.cs deleted file mode 100644 index dc1d20390f1f21655a7787dee9ffda678af35b6a..0000000000000000000000000000000000000000 --- a/SampleApp/SampleApp/DependencyServices/IFocusEvents.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using Xamarin.Forms; - -namespace SampleApp.DependencyServices -{ - public class IFocusEvents : Image - { - public IFocusEvents() - { - } - - } -} diff --git a/SampleApp/SampleApp/Views/Functionality17.xaml b/SampleApp/SampleApp/Views/Functionality17.xaml index 232c1167f21c5abc734867513cadd343eb6257a9..72a5b280ca59877a0c7d79af019fc699b373e72c 100644 --- a/SampleApp/SampleApp/Views/Functionality17.xaml +++ b/SampleApp/SampleApp/Views/Functionality17.xaml @@ -5,11 +5,11 @@ - + - + diff --git a/SampleApp/SampleApp/Views/Functionality2.xaml.cs b/SampleApp/SampleApp/Views/Functionality2.xaml.cs index d18afc6b97f3be194f1dffc5dad618c0d2388dc0..d7aefbb849971a79731a9afb6699e994dee79026 100644 --- a/SampleApp/SampleApp/Views/Functionality2.xaml.cs +++ b/SampleApp/SampleApp/Views/Functionality2.xaml.cs @@ -32,7 +32,6 @@ namespace SampleApp.Views { if (topDown) { - label2.Text = "3"; label2.TabIndex = 3; label3.Text = "2"; @@ -50,7 +49,6 @@ namespace SampleApp.Views FocusOrderLabel.Text = "Focus order is: TOP-DOWN"; } topDown = !topDown; - } } } diff --git a/SampleApp/SampleApp/Views/Functionality22.xaml b/SampleApp/SampleApp/Views/Functionality22.xaml index 7dfde7a54d2c4630186ab5ca4c23f07b23e1ff8f..cd3089eae6bffce689841844a9e4c188c12dd712 100644 --- a/SampleApp/SampleApp/Views/Functionality22.xaml +++ b/SampleApp/SampleApp/Views/Functionality22.xaml @@ -3,7 +3,7 @@ - + diff --git a/SampleApp/SampleApp/Views/Functionality22.xaml.cs b/SampleApp/SampleApp/Views/Functionality22.xaml.cs index 4011a3745ad4040cb0b794b104a1184076149cc8..54f88a8fb62416deeb3029072bbc4a85da6f2903 100644 --- a/SampleApp/SampleApp/Views/Functionality22.xaml.cs +++ b/SampleApp/SampleApp/Views/Functionality22.xaml.cs @@ -85,7 +85,7 @@ namespace SampleApp.Views { Heading.SetHeading(label1); - Pane.SetPane(label2, "test"); + Pane.SetPane(label2, "PaneTitle"); } } diff --git a/SampleApp/SampleApp/Views/Functionality23.xaml b/SampleApp/SampleApp/Views/Functionality23.xaml index 91f384b258f4d467ac09d761eee2a7517c53382e..fcbecb25c418aeb9ea9b692ddafc5b8482795df7 100644 --- a/SampleApp/SampleApp/Views/Functionality23.xaml +++ b/SampleApp/SampleApp/Views/Functionality23.xaml @@ -1,5 +1,5 @@  - + diff --git a/SampleApp/SampleApp/Views/Functionality23.xaml.cs b/SampleApp/SampleApp/Views/Functionality23.xaml.cs index acde902d8491bbfe230125ec6c446c38c217d6d5..5745277c3c4b791d8bf5292fc341eb26221f9412 100644 --- a/SampleApp/SampleApp/Views/Functionality23.xaml.cs +++ b/SampleApp/SampleApp/Views/Functionality23.xaml.cs @@ -8,7 +8,7 @@ namespace SampleApp.Views { public partial class Functionality23 : ContentPage { - public static CustomView customEditor = new CustomView { Text = "", IsReadOnly=true}; + public static CustomView customEditor = new CustomView { Text = "", HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand}; public Functionality23() { InitializeComponent(); @@ -19,7 +19,6 @@ namespace SampleApp.Views AutomationProperties.SetIsInAccessibleTree(customEditor, true); background.Children.Add(customEditor); - } } } diff --git a/SampleApp/SampleApp/Views/Functionality3.xaml.cs b/SampleApp/SampleApp/Views/Functionality3.xaml.cs index 4b5d5a9c89383ed95adbdd80d29b2ea392d67d7d..3356bfd44d5b3e0636033b711d824b63d57bc6e1 100644 --- a/SampleApp/SampleApp/Views/Functionality3.xaml.cs +++ b/SampleApp/SampleApp/Views/Functionality3.xaml.cs @@ -9,29 +9,35 @@ namespace SampleApp.Views public partial class Functionality3 : ContentPage { IAssignFocus assignFocus; + IScreenReaderEnabled screenReaderEnabled; Boolean focus = true; public Functionality3() { InitializeComponent(); assignFocus = DependencyService.Get(); + screenReaderEnabled = DependencyService.Resolve(); AutomationProperties.SetIsInAccessibleTree(label, true); } void Button_Clicked(System.Object sender, System.EventArgs e) { - if (focus) + if (screenReaderEnabled.IsScreenReaderEnabled()) { - assignFocus.AssignFocus(label); - label.Text = "I Have Focus"; - button.Text = "Reset"; + if (focus) + { + assignFocus.AssignFocus(label); + label.Text = "I Have Focus"; + button.Text = "Reset"; + } + else + { + assignFocus.AssignFocus(button); + label.Text = "I Don't Have Focus"; + button.Text = "Assign focus to the label above"; + } + focus = !focus; } - else - { - assignFocus.AssignFocus(button); - label.Text = "I Don't Have Focus"; - button.Text = "Assign focus to the label above"; - } - focus = !focus; + } } } diff --git a/SampleApp/SampleApp/Views/Functionality4.xaml.cs b/SampleApp/SampleApp/Views/Functionality4.xaml.cs index 1253f345efa63b3cc1c178b3df654fafeab4440d..048cf19084fd52c7fac9e51f22f565eb7a5c7159 100644 --- a/SampleApp/SampleApp/Views/Functionality4.xaml.cs +++ b/SampleApp/SampleApp/Views/Functionality4.xaml.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.ComponentModel; using System.Reflection; -using SampleApp.DependencyServices; +using SampleApp.CustomRenderers; using Xamarin.Forms; @@ -19,7 +19,7 @@ namespace SampleApp.Views InitializeComponent(); // immagine campanello - IFocusEvents BellImage = new IFocusEvents + CustomImage BellImage = new CustomImage { Source = ImageSource.FromResource("SampleApp.images.bell.png", typeof(Functionality4).GetTypeInfo().Assembly) }; diff --git a/SampleApp/SampleApp/Views/Functionality6.xaml.cs b/SampleApp/SampleApp/Views/Functionality6.xaml.cs index 4c2cf20ffc58ed7eab0179b30e8c90bce881e004..f78cf0ed1c6b495979c66f6ceb060a84fee0651c 100644 --- a/SampleApp/SampleApp/Views/Functionality6.xaml.cs +++ b/SampleApp/SampleApp/Views/Functionality6.xaml.cs @@ -18,16 +18,11 @@ namespace SampleApp.Views void EntryName_TextChanged(object sender, TextChangedEventArgs e) { - - var newText = e.NewTextValue; - AutomationProperties.SetName(forkImage, e.NewTextValue); - + AutomationProperties.SetName(forkImage, e.NewTextValue); } + void EntryHelpText_TextChanged(object sender, TextChangedEventArgs e) { - - var newText = e.NewTextValue; - AutomationProperties.SetHelpText(forkImage, e.NewTextValue); } }