Commit dc2db644 authored by Mattia's avatar Mattia

update

parent 6bd56c4e
...@@ -3,12 +3,12 @@ using Android.Content; ...@@ -3,12 +3,12 @@ using Android.Content;
using Android.Service.Autofill; using Android.Service.Autofill;
using Android.Views.Accessibility; using Android.Views.Accessibility;
using CustomViewAccessibility.Droid; using CustomViewAccessibility.Droid;
using SampleApp.DependencyServices; using SampleApp.CustomRenderers;
using SampleApp.Views; using SampleApp.Views;
using Xamarin.Forms; using Xamarin.Forms;
using Xamarin.Forms.Platform.Android; using Xamarin.Forms.Platform.Android;
[assembly: ExportRenderer(typeof(IFocusEvents), typeof(AndroidFocusEvents))] [assembly: ExportRenderer(typeof(CustomImage), typeof(AndroidFocusEvents))]
namespace CustomViewAccessibility.Droid namespace CustomViewAccessibility.Droid
{ {
public class AndroidFocusEvents : ImageRenderer public class AndroidFocusEvents : ImageRenderer
......
using System; using System;
using SampleApp.DependencyServices; using SampleApp.CustomRenderers;
using Xamarin.Forms; using Xamarin.Forms;
using SampleApp.iOS; using SampleApp.iOS;
using Xamarin.Forms.Platform.iOS; using Xamarin.Forms.Platform.iOS;
using SampleApp.Views; using SampleApp.Views;
[assembly: ExportRenderer(typeof(IFocusEvents), typeof(iOSFocusEvents))] [assembly: ExportRenderer(typeof(CustomImage), typeof(iOSFocusEvents))]
namespace SampleApp.iOS namespace SampleApp.iOS
{ {
public class iOSFocusEvents : ImageRenderer public class iOSFocusEvents : ImageRenderer
......
...@@ -21,11 +21,6 @@ namespace SampleApp.iOS ...@@ -21,11 +21,6 @@ namespace SampleApp.iOS
SetNativeControl(new MyView()); SetNativeControl(new MyView());
} }
} }
} }
public class MyView : UITextView public class MyView : UITextView
...@@ -34,22 +29,19 @@ namespace SampleApp.iOS ...@@ -34,22 +29,19 @@ namespace SampleApp.iOS
public MyView() : base() 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."; base.Text = "Perform a magic tap (tap with two fingers) to change the background color.";
Console.WriteLine("My View created");
base.AccessibilityPerformMagicTap(); base.AccessibilityPerformMagicTap();
base.Editable = false; base.Editable = false;
base.Font = base.Font.WithSize(30);
Functionality23.customEditor.BackgroundColor = Color.White;
Functionality23.customEditor.TextColor = Color.Black;
} }
public override bool AccessibilityPerformMagicTap() public override bool AccessibilityPerformMagicTap()
{ {
Console.WriteLine("MAGIC TAP");
//random color //random color
Color randomColor = Color.FromRgb(rnd.Next(256), rnd.Next(256), rnd.Next(256)); Color randomColor = Color.FromRgb(rnd.Next(256), rnd.Next(256), rnd.Next(256));
Functionality23.customEditor.Text = "MAGIC TAP"; Functionality23.customEditor.Text = "MAGIC TAP";
Functionality23.customEditor.BackgroundColor = randomColor; Functionality23.customEditor.BackgroundColor = randomColor;
Functionality23.customEditor.TextColor = Color.White; Functionality23.customEditor.TextColor = Color.White;
......
using System; using System;
using Xamarin.Forms; using Xamarin.Forms;
namespace SampleApp.DependencyServices namespace SampleApp.CustomRenderers
{ {
public class IFocusEvents : Image public class CustomImage : Image
{ {
public IFocusEvents() public CustomImage()
{ {
} }
......
...@@ -5,11 +5,11 @@ ...@@ -5,11 +5,11 @@
<Label Text="This is an example text." Margin="50" x:Name="TextToRead"></Label> <Label Text="This is an example text." Margin="50" x:Name="TextToRead"></Label>
<StackLayout> <StackLayout>
<Label Text="Chenge the volume"></Label> <Label Text="Change the volume"></Label>
<Slider Minimum="0.0" Maximum="1.0" ValueChanged="Slider_Volume_ValueChanged" Value="0.5"></Slider> <Slider Minimum="0.0" Maximum="1.0" ValueChanged="Slider_Volume_ValueChanged" Value="0.5"></Slider>
</StackLayout> </StackLayout>
<StackLayout> <StackLayout>
<Label Text="Chenge the pitch"></Label> <Label Text="Change the pitch"></Label>
<Slider Minimum="0.1" Maximum="2.0" ValueChanged="Slider_Pitch_ValueChanged" Value="1.0"></Slider> <Slider Minimum="0.1" Maximum="2.0" ValueChanged="Slider_Pitch_ValueChanged" Value="1.0"></Slider>
</StackLayout> </StackLayout>
<Button Text="Read the example text" Clicked="Button_Clicked"></Button> <Button Text="Read the example text" Clicked="Button_Clicked"></Button>
......
...@@ -32,7 +32,6 @@ namespace SampleApp.Views ...@@ -32,7 +32,6 @@ namespace SampleApp.Views
{ {
if (topDown) if (topDown)
{ {
label2.Text = "3"; label2.Text = "3";
label2.TabIndex = 3; label2.TabIndex = 3;
label3.Text = "2"; label3.Text = "2";
...@@ -50,7 +49,6 @@ namespace SampleApp.Views ...@@ -50,7 +49,6 @@ namespace SampleApp.Views
FocusOrderLabel.Text = "Focus order is: TOP-DOWN"; FocusOrderLabel.Text = "Focus order is: TOP-DOWN";
} }
topDown = !topDown; topDown = !topDown;
} }
} }
} }
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<StackLayout VerticalOptions="Center" HorizontalOptions="Center"> <StackLayout VerticalOptions="Center" HorizontalOptions="Center">
<Label Text="" x:Name="labelAv" HorizontalTextAlignment="Center"></Label> <Label Text="" x:Name="labelAv" HorizontalTextAlignment="Center"></Label>
<Label Text="Click on show header button to check witch view is header" x:Name="label1" HorizontalTextAlignment="Center"></Label> <Label Text="Click on show header button to check witch view is header" x:Name="label1" HorizontalTextAlignment="Center"></Label>
<Label Text="Click on show pane button to check witch view is pane" x:Name="label2" HorizontalTextAlignment="Center"></Label> <Label Text="Click on show pane button to check witch view has a pane title" x:Name="label2" HorizontalTextAlignment="Center"></Label>
<Button Text="Show header" Clicked="Button_Clicked" x:Name="button1"></Button> <Button Text="Show header" Clicked="Button_Clicked" x:Name="button1"></Button>
<Button Text="Show pane" Clicked="Button_Clicked1" x:Name="button2"></Button> <Button Text="Show pane" Clicked="Button_Clicked1" x:Name="button2"></Button>
</StackLayout> </StackLayout>
......
...@@ -85,7 +85,7 @@ namespace SampleApp.Views ...@@ -85,7 +85,7 @@ namespace SampleApp.Views
{ {
Heading.SetHeading(label1); Heading.SetHeading(label1);
Pane.SetPane(label2, "test"); Pane.SetPane(label2, "PaneTitle");
} }
} }
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="SampleApp.Views.Functionality23"> <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="SampleApp.Views.Functionality23">
<StackLayout x:Name="background" HorizontalOptions="Center" VerticalOptions="Center"> <StackLayout x:Name="background" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
</StackLayout> </StackLayout>
</ContentPage> </ContentPage>
...@@ -8,7 +8,7 @@ namespace SampleApp.Views ...@@ -8,7 +8,7 @@ namespace SampleApp.Views
{ {
public partial class Functionality23 : ContentPage 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() public Functionality23()
{ {
InitializeComponent(); InitializeComponent();
...@@ -19,7 +19,6 @@ namespace SampleApp.Views ...@@ -19,7 +19,6 @@ namespace SampleApp.Views
AutomationProperties.SetIsInAccessibleTree(customEditor, true); AutomationProperties.SetIsInAccessibleTree(customEditor, true);
background.Children.Add(customEditor); background.Children.Add(customEditor);
} }
} }
} }
...@@ -9,29 +9,35 @@ namespace SampleApp.Views ...@@ -9,29 +9,35 @@ namespace SampleApp.Views
public partial class Functionality3 : ContentPage public partial class Functionality3 : ContentPage
{ {
IAssignFocus assignFocus; IAssignFocus assignFocus;
IScreenReaderEnabled screenReaderEnabled;
Boolean focus = true; Boolean focus = true;
public Functionality3() public Functionality3()
{ {
InitializeComponent(); InitializeComponent();
assignFocus = DependencyService.Get<IAssignFocus>(); assignFocus = DependencyService.Get<IAssignFocus>();
screenReaderEnabled = DependencyService.Resolve<IScreenReaderEnabled>();
AutomationProperties.SetIsInAccessibleTree(label, true); AutomationProperties.SetIsInAccessibleTree(label, true);
} }
void Button_Clicked(System.Object sender, System.EventArgs e) void Button_Clicked(System.Object sender, System.EventArgs e)
{ {
if (focus) if (screenReaderEnabled.IsScreenReaderEnabled())
{ {
assignFocus.AssignFocus(label); if (focus)
label.Text = "I Have Focus"; {
button.Text = "Reset"; 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;
} }
} }
} }
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Reflection; using System.Reflection;
using SampleApp.DependencyServices; using SampleApp.CustomRenderers;
using Xamarin.Forms; using Xamarin.Forms;
...@@ -19,7 +19,7 @@ namespace SampleApp.Views ...@@ -19,7 +19,7 @@ namespace SampleApp.Views
InitializeComponent(); InitializeComponent();
// immagine campanello // immagine campanello
IFocusEvents BellImage = new IFocusEvents CustomImage BellImage = new CustomImage
{ {
Source = ImageSource.FromResource("SampleApp.images.bell.png", typeof(Functionality4).GetTypeInfo().Assembly) Source = ImageSource.FromResource("SampleApp.images.bell.png", typeof(Functionality4).GetTypeInfo().Assembly)
}; };
......
...@@ -18,16 +18,11 @@ namespace SampleApp.Views ...@@ -18,16 +18,11 @@ namespace SampleApp.Views
void EntryName_TextChanged(object sender, TextChangedEventArgs e) void EntryName_TextChanged(object sender, TextChangedEventArgs e)
{ {
AutomationProperties.SetName(forkImage, e.NewTextValue);
var newText = e.NewTextValue;
AutomationProperties.SetName(forkImage, e.NewTextValue);
} }
void EntryHelpText_TextChanged(object sender, TextChangedEventArgs e) void EntryHelpText_TextChanged(object sender, TextChangedEventArgs e)
{ {
var newText = e.NewTextValue;
AutomationProperties.SetHelpText(forkImage, e.NewTextValue); AutomationProperties.SetHelpText(forkImage, e.NewTextValue);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment