Commit 6bd56c4e authored by Mattia's avatar Mattia

debug

parent d40e6438
<Properties StartupConfiguration="{1EE7473C-9A98-44EF-8124-C4D1E0E468F8}|Default">
<MonoDevelop.Ide.Workbench>
<Properties StartupConfiguration="{0E082BA3-B87F-40B4-9700-878BE1A55954}|Default">
<MonoDevelop.Ide.Workbench ActiveDocument="SampleApp/ViewModels/ListPageViewModel.cs">
<Files>
<File FileName="SampleApp/Views/MainPage.xaml.cs" Line="66" Column="23" />
<File FileName="SampleApp/ViewModels/ListPageViewModel.cs" Line="24" Column="91" />
</Files>
<Pads>
<Pad Id="ProjectPad">
<State name="__root__">
<Node name="SampleApp" expanded="True">
<Node name="SampleApp" expanded="True">
<Node name="Views" expanded="True">
<Node name="Functionality2.xaml" expanded="True">
<Node name="Functionality2.xaml.cs" selected="True" />
</Node>
<Node name="Functionality4.xaml" expanded="True" />
<Node name="MainPage.xaml" expanded="True" />
</Node>
<Node name="images" expanded="True" />
</Node>
<Node name="SampleApp.iOS" expanded="True" />
</Node>
</State>
</Pad>
</Pads>
</MonoDevelop.Ide.Workbench>
<MonoDevelop.Ide.ItemProperties.SampleApp.Android AndroidDesignerPreferredTheme="Theme.AppCompat.Light.NoActionBar" PreferredExecutionTarget="Android.pixel_2_q_10_0_-_api_29" />
<MonoDevelop.Ide.ItemProperties.SampleApp.iOS automaticSigning="False" PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneSimulatorTarget.702581F9-973B-4F9F-A1E7-5A202CF499AB" />
<MonoDevelop.Ide.ItemProperties.SampleApp.Android AndroidDesignerPreferredTheme="Theme.AppCompat.Light.NoActionBar" PreferredExecutionTarget="Android.Pixel_3_API_29" />
<MonoDevelop.Ide.ItemProperties.SampleApp.iOS automaticSigning="False" PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget.d0d4bfac7e5fd6f1456633ef7d45122e2fa38791" />
<MonoDevelop.Ide.DebuggingService.PinnedWatches />
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|iPhone" />
<MonoDevelop.Ide.DebuggingService.Breakpoints>
<BreakpointStore />
</MonoDevelop.Ide.DebuggingService.Breakpoints>
......
......@@ -4,6 +4,7 @@ using Android.Service.Autofill;
using Android.Views.Accessibility;
using CustomViewAccessibility.Droid;
using SampleApp.DependencyServices;
using SampleApp.Views;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;
......@@ -51,12 +52,13 @@ namespace CustomViewAccessibility.Droid
base.OnInitializeAccessibilityEvent(e);
if (e.EventType == EventTypes.ViewAccessibilityFocused)
{
Functionality4.myLabel.Text = "Bell Image Has Focus";
Console.WriteLine("ACCESSIBILITY I am in focus");
}
else if (e.EventType == EventTypes.ViewAccessibilityFocusCleared)
{
Functionality4.myLabel.Text = "Bell Image does not have focus";
Console.WriteLine("ACCESSIBILITY I am in NOT in focus");
}
}
......
using System;
using SampleApp.DependencyServices;
using SampleApp.Droid;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;
[assembly: Dependency(typeof(AndroidHeaderPane))]
namespace SampleApp.Droid
{
public class AndroidHeaderPane : IAccessibilityHeading, IAccessibilityPane
{
public AndroidHeaderPane()
{
}
public void SetHeading(View v)
{
v.GetRenderer().View.AccessibilityHeading = true;
}
//check if the passed view (vc) is a header
public bool CheckHeading(View vc)
{
if (vc.GetRenderer().View.AccessibilityHeading == true)
{
return true;
}
return false;
}
public void SetPane(View v, string t)
{
v.GetRenderer().View.AccessibilityPaneTitle = t;
}
public bool CheckPane(View vc)
{
if (vc.GetRenderer().View.AccessibilityPaneTitle == null)
{
return false;
}
return true;
}
}
}
using System;
using SampleApp.DependencyServices;
using SampleApp.Droid;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;
[assembly: Dependency(typeof(AndroidReadText))]
namespace SampleApp.Droid
{
public class AndroidReadText : IReadText
{
public AndroidReadText()
{
}
public void ReadText(Label t)
{
t.GetRenderer().View.AnnounceForAccessibility(t.Text);
}
}
}
......@@ -64,6 +64,8 @@
<Compile Include="AndroidFocusEvents.cs" />
<Compile Include="AndroidHasFocus.cs" />
<Compile Include="AndroidScreenReaderEnabled.cs" />
<Compile Include="AndroidReadText.cs" />
<Compile Include="AndroidHeaderPane.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\AboutResources.txt" />
......
......@@ -73,6 +73,8 @@
<Compile Include="iOSFocusEvents.cs" />
<Compile Include="iOSHasFocus.cs" />
<Compile Include="iOSScreenReaderEnabled.cs" />
<Compile Include="iOSReadText.cs" />
<Compile Include="iOSMagicTap.cs" />
</ItemGroup>
<ItemGroup>
<InterfaceDefinition Include="Resources\LaunchScreen.storyboard" />
......
......@@ -12,6 +12,7 @@ namespace SampleApp.iOS
{
public void AssignFocus(View v)
{
UIAccessibility.PostNotification(notification: UIAccessibilityPostNotification.ScreenChanged, argument: v.GetRenderer().NativeView);
}
......
......@@ -56,5 +56,6 @@ namespace SampleApp.iOS
}
}
using System;
using SampleApp.CustomRenderers;
using Xamarin.Forms;
using SampleApp.iOS;
using Xamarin.Forms.Platform.iOS;
using SampleApp.Views;
using UIKit;
[assembly: ExportRenderer(typeof(CustomView), typeof(iOSMagicTap))]
namespace SampleApp.iOS
{
public class iOSMagicTap : EditorRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<Editor> e)
{
base.OnElementChanged(e);
if (Control != null)
{
SetNativeControl(new MyView());
}
}
}
public class MyView : UITextView
{
private Random rnd = new Random();
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.AccessibilityPerformMagicTap();
base.Editable = false;
}
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;
return true;
}
}
}
\ No newline at end of file
using System;
using System.Threading.Tasks;
using SampleApp.DependencyServices;
using SampleApp.iOS;
using UIKit;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;
[assembly: Dependency(typeof(iOSReadText))]
namespace SampleApp.iOS
{
public class iOSReadText : IReadText
{
public iOSReadText()
{
}
public void ReadText(Label t)
{
Device.StartTimer(TimeSpan.FromMilliseconds(100.0), () =>
{
Foundation.NSString ss = new Foundation.NSString(t.Text);
UIAccessibility.PostNotification(UIAccessibilityPostNotification.Announcement, ss);
return false; // runs again, or false to stop
});
}
}
}
using System;
using Xamarin.Forms;
namespace SampleApp.CustomRenderers
{
public class CustomView : Editor
{
}
}
using System;
using Xamarin.Forms;
namespace SampleApp.DependencyServices
{
public interface IAccessibilityHeading
{
void SetHeading(View v);
bool CheckHeading(View vc);
}
}
using System;
using Xamarin.Forms;
namespace SampleApp.DependencyServices
{
public interface IAccessibilityPane
{
void SetPane(View v, string t);
bool CheckPane(View vc);
}
}
using System;
using Xamarin.Forms;
namespace SampleApp.DependencyServices
{
public interface IReadText
{
void ReadText(Label t);
}
}
......@@ -79,7 +79,7 @@ namespace SampleApp.ViewModels
{
Name = "11",
Description = "Read a text with the screen-reader TTS",
Availability = "Not available on XAMARIN",
Availability = "Indirect Implementation",
});
explicitTTS.Add(new APIFunctionality
{
......@@ -143,13 +143,15 @@ namespace SampleApp.ViewModels
{
Name = "22",
Description = "Support navigation by specifying which views are headers or panes",
Availability = "Not available on XAMARIN",
Availability = "Not available on iOS",
});
miscellanous.Add(new APIFunctionality
{
Name = "23",
Description = "Define how to respond to user actions that are only available when the screen reader is active",
Availability = "Not available on XAMARIN",
Availability = "Not available on Android",
});
miscellanous.Add(new APIFunctionality
{
......
<?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.Functionality11">
<ContentPage.Content>
<Label Text="Not available on XAMARIN"></Label>
<StackLayout HorizontalOptions="Center" VerticalOptions="Center">
<Label x:Name="label" Text="The text to speech will be read by the screen reader." HorizontalTextAlignment="Center"></Label>
<Button Clicked="Button_Clicked" Text="Read the text above" x:Name="button"></Button>
</StackLayout>
</ContentPage.Content>
</ContentPage>
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using SampleApp.DependencyServices;
using Xamarin.Forms;
namespace SampleApp.Views
{
public partial class Functionality11 : ContentPage
{
IReadText readText;
public Functionality11()
{
InitializeComponent();
readText = DependencyService.Get<IReadText>();
AutomationProperties.SetIsInAccessibleTree(label, true);
AutomationProperties.SetIsInAccessibleTree(button, true);
}
void Button_Clicked(System.Object sender, System.EventArgs e)
{
readText.ReadText(label);
}
}
}
......@@ -17,7 +17,7 @@
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Label x:Name="FocusOrderLabel" Grid.Row="0"></Label>
<Label x:Name="FocusOrderLabel" Grid.Row="0" Grid.ColumnSpan="4"></Label>
<Label x:Name="label1" Text="1" Grid.Row="1" Grid.Column="0" BackgroundColor="AliceBlue" VerticalTextAlignment="Center" HorizontalTextAlignment="Center"></Label>
<Label x:Name="label2" Text="2" Grid.Row="2" Grid.Column="2" BackgroundColor="AntiqueWhite" VerticalTextAlignment="Center" HorizontalTextAlignment="Center"></Label>
<Label x:Name="label3" Text="3" Grid.Row="3" Grid.Column="1" BackgroundColor="LightYellow" VerticalTextAlignment="Center" HorizontalTextAlignment="Center"></Label>
......
<?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.Functionality22">
<ContentPage.Content>
<Label Text="Not available on XAMARIN"></Label>
</ContentPage.Content>
<StackLayout VerticalOptions="Center" HorizontalOptions="Center">
<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 pane button to check witch view is pane" x:Name="label2" HorizontalTextAlignment="Center"></Label>
<Button Text="Show header" Clicked="Button_Clicked" x:Name="button1"></Button>
<Button Text="Show pane" Clicked="Button_Clicked1" x:Name="button2"></Button>
</StackLayout>
</ContentPage>
using System;
using System.Collections.Generic;
using SampleApp.DependencyServices;
using Xamarin.Forms;
namespace SampleApp.Views
{
public partial class Functionality22 : ContentPage
{
IAccessibilityHeading Heading;
IAccessibilityPane Pane;
public Functionality22()
{
InitializeComponent();
Heading = DependencyService.Get<IAccessibilityHeading>();
Pane = DependencyService.Get<IAccessibilityPane>();
if (Device.RuntimePlatform == Device.iOS)
{
labelAv.Text = "NOT AVAILABLE ON iOS";
}
AutomationProperties.SetIsInAccessibleTree(label1,true);
AutomationProperties.SetIsInAccessibleTree(label2,true);
AutomationProperties.SetIsInAccessibleTree(button1,true);
AutomationProperties.SetIsInAccessibleTree(button2, true);
}
//SHOW HEADER BUTTON CLICKED
void Button_Clicked(System.Object sender, System.EventArgs e)
{
if (Device.RuntimePlatform == Device.Android)
{
if (Heading.CheckHeading(label1))
{
string labelValue = label1.Text;
label1.Text = "HEADER";
//reset label value after 3 seconds
Device.StartTimer(TimeSpan.FromMilliseconds(3000.0), () =>
{
label1.Text = labelValue;
return false; // runs again, or false to stop
});
}
}
}
//SHOW PANE BUTTON CLICKED
void Button_Clicked1(System.Object sender, System.EventArgs e)
{
if (Device.RuntimePlatform == Device.Android)
{
if (Pane.CheckPane(label2))
{
string labelValue = label2.Text;
label2.Text = "PANE";
//reset label value after 3 seconds
Device.StartTimer(TimeSpan.FromMilliseconds(3000.0), () =>
{
label2.Text = labelValue;
return false; // runs again, or false to stop
});
}
}
}
protected override void OnAppearing()
{
base.OnAppearing();
//only Android has this function
if (Device.RuntimePlatform == Device.Android)
{
Heading.SetHeading(label1);
Pane.SetPane(label2, "test");
}
}
}
}
<?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.Content>
<Label Text="Not available on XAMARIN"></Label>
</ContentPage.Content>
<StackLayout x:Name="background" HorizontalOptions="Center" VerticalOptions="Center">
</StackLayout>
</ContentPage>
using System;
using System.Collections.Generic;
using SampleApp.CustomRenderers;
using Xamarin.Forms;
......@@ -7,9 +8,18 @@ namespace SampleApp.Views
{
public partial class Functionality23 : ContentPage
{
public static CustomView customEditor = new CustomView { Text = "", IsReadOnly=true};
public Functionality23()
{
InitializeComponent();
if (Device.RuntimePlatform == Device.Android)
{
customEditor.Text = "NOT AVAILABLE ON Android";
}
AutomationProperties.SetIsInAccessibleTree(customEditor, true);
background.Children.Add(customEditor);
}
}
}
......@@ -16,6 +16,8 @@ namespace SampleApp.Views
IIsFocused dependency;
bool onView = true;
public Functionality5()
{
InitializeComponent();
......@@ -27,33 +29,51 @@ namespace SampleApp.Views
background.Children.Add(labelYN);
background.Children.Add(infoLabel);
AutomationProperties.SetIsInAccessibleTree(label, true);
AutomationProperties.SetIsInAccessibleTree(labelYN, true);
AutomationProperties.SetIsInAccessibleTree(infoLabel, true);
AutomationProperties.SetIsInAccessibleTree(bellImage, true);
AutomationProperties.SetHelpText(bellImage, "Bell Image");
// timer che si ripete ogni 2 secondi
Device.StartTimer(TimeSpan.FromMilliseconds(2000.0), () =>
Device.StartTimer(TimeSpan.FromSeconds(2.0), () =>
{
Console.WriteLine("TIMER FIRED");
Device.BeginInvokeOnMainThread(() =>
if (onView)
{
if (dependency.isFocused(bellImage))
{
Console.WriteLine("is focused");
labelYN.TextColor = Color.Green;
labelYN.Text = "YES";
}
else
Console.WriteLine("TIMER FIRED");
Device.BeginInvokeOnMainThread(() =>
{
Console.WriteLine("is NOT focused");
labelYN.TextColor = Color.Red;
labelYN.Text = "NO";
}
});
return true; // runs again, or false to stop
if (dependency.isFocused(bellImage))
{
Console.WriteLine("is focused");
labelYN.TextColor = Color.Green;
labelYN.Text = "YES";
}
else
{
Console.WriteLine("is NOT focused");
labelYN.TextColor = Color.Red;
labelYN.Text = "NO";
}
});
return true; // timer runs again
}
return false; //timer stops
});
}
//stop the timer when view changes
protected override void OnDisappearing()
{
base.OnDisappearing();
onView = false;
}
}
}
<?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.Functionality7">
<ContentPage.Content>
<Label Text="PROVA 7"></Label>
</ContentPage.Content>
</ContentPage>
......@@ -10,6 +10,7 @@ namespace SampleApp.Views
public Functionality7()
{
InitializeComponent();
}
}
}
......@@ -51,34 +51,41 @@ namespace SampleApp
await Navigation.PushAsync(new Functionality6());
break;
case "7":
await Navigation.PushAsync(new Functionality7());
// TO IMPLEMENT
//await Navigation.PushAsync(new Functionality7());
break;
case "8":
await Navigation.PushAsync(new Functionality8());
break;
case "9":
await Navigation.PushAsync(new Functionality9());
// TO IMPLEMENT
//await Navigation.PushAsync(new Functionality9());
break;
case "10":
await Navigation.PushAsync(new Functionality10());
// TO IMPLEMENT
//await Navigation.PushAsync(new Functionality10());
break;
case "11":
await Navigation.PushAsync(new Functionality11());
break;
case "12":
await Navigation.PushAsync(new Functionality12());
// TO IMPLEMENT
//await Navigation.PushAsync(new Functionality12());
break;
case "13":
await Navigation.PushAsync(new Functionality13());
// TO IMPLEMENT
//await Navigation.PushAsync(new Functionality13());
break;
case "14":
await Navigation.PushAsync(new Functionality14());
break;
case "15":
await Navigation.PushAsync(new Functionality15());
// TO IMPLEMENT
//await Navigation.PushAsync(new Functionality15());
break;
case "16":
await Navigation.PushAsync(new Functionality16());
// TO IMPLEMENT
//await Navigation.PushAsync(new Functionality16());
break;
case "17":
await Navigation.PushAsync(new Functionality17());
......@@ -87,10 +94,12 @@ namespace SampleApp
await Navigation.PushAsync(new Functionality18());
break;
case "19":
await Navigation.PushAsync(new Functionality19());
// TO IMPLEMENT
//await Navigation.PushAsync(new Functionality19());
break;
case "20":
await Navigation.PushAsync(new Functionality20());
// TO IMPLEMENT
//await Navigation.PushAsync(new Functionality20());
break;
case "21":
await Navigation.PushAsync(new Functionality21());
......@@ -102,7 +111,8 @@ namespace SampleApp
await Navigation.PushAsync(new Functionality23());
break;
case "24":
await Navigation.PushAsync(new Functionality24());
// TO IMPLEMENT
//await Navigation.PushAsync(new Functionality24());
break;
}
......
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