Commit dc2db644 authored by Mattia's avatar Mattia

update

parent 6bd56c4e
......@@ -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
......
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
......
......@@ -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;
......
using System;
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 @@
<Label Text="This is an example text." Margin="50" x:Name="TextToRead"></Label>
<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>
</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>
</StackLayout>
<Button Text="Read the example text" Clicked="Button_Clicked"></Button>
......
......@@ -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;
}
}
}
......@@ -3,7 +3,7 @@
<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>
<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 pane" Clicked="Button_Clicked1" x:Name="button2"></Button>
</StackLayout>
......
......@@ -85,7 +85,7 @@ namespace SampleApp.Views
{
Heading.SetHeading(label1);
Pane.SetPane(label2, "test");
Pane.SetPane(label2, "PaneTitle");
}
}
......
<?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">
<StackLayout x:Name="background" HorizontalOptions="Center" VerticalOptions="Center">
<StackLayout x:Name="background" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
</StackLayout>
</ContentPage>
......@@ -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);
}
}
}
......@@ -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<IAssignFocus>();
screenReaderEnabled = DependencyService.Resolve<IScreenReaderEnabled>();
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;
}
}
}
......@@ -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)
};
......
......@@ -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);
}
}
......
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