Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
MobileScreenReadersApi
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
public_accessibility_software
MobileScreenReadersApi
Commits
d40e6438
Commit
d40e6438
authored
Sep 30, 2020
by
Mattia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update fun5
parent
25a970e3
Changes
10
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
364 additions
and
387 deletions
+364
-387
AndroidHasFocus.cs
SampleApp/SampleApp.Android/AndroidHasFocus.cs
+9
-48
Resource.designer.cs
SampleApp/SampleApp.Android/Resources/Resource.designer.cs
+291
-265
SampleApp.Android.csproj
SampleApp/SampleApp.Android/SampleApp.Android.csproj
+1
-1
SampleApp.iOS.csproj
SampleApp/SampleApp.iOS/SampleApp.iOS.csproj
+1
-1
iOSFocusEvents.cs
SampleApp/SampleApp.iOS/iOSFocusEvents.cs
+0
-1
iOSHasFocus.cs
SampleApp/SampleApp.iOS/iOSHasFocus.cs
+8
-56
IIsFocused.cs
SampleApp/SampleApp/DependencyServices/IIsFocused.cs
+10
-0
SampleApp.csproj
SampleApp/SampleApp/SampleApp.csproj
+1
-1
Functionality5.xaml
SampleApp/SampleApp/Views/Functionality5.xaml
+4
-2
Functionality5.xaml.cs
SampleApp/SampleApp/Views/Functionality5.xaml.cs
+39
-12
No files found.
SampleApp/SampleApp.Android/AndroidHasFocus.cs
View file @
d40e6438
using
System
;
using
System.Threading.Tasks
;
using
Android.Content
;
using
Android.Views.Accessibility
;
using
SampleApp.CustomRenderers
;
using
SampleApp.Droid
;
using
Android.Views
;
using
fun5.Droid
;
using
SampleApp.DependencyServices
;
using
Xamarin.Forms
;
using
Xamarin.Forms.Platform.Android
;
[assembly:
ExportRenderer(typeof(CustomLabel), typeof(AndroidHasFocus
))]
namespace
SampleApp
.Droid
[assembly:
Dependency(typeof(focusAndroid
))]
namespace
fun5
.Droid
{
public
class
AndroidHasFocus
:
LabelRenderer
public
class
focusAndroid
:
IIsFocused
{
Context
context
;
public
AndroidHasFocus
(
Context
context
)
:
base
(
context
)
{
this
.
context
=
context
;
}
protected
override
void
OnElementChanged
(
ElementChangedEventArgs
<
Label
>
e
)
{
base
.
OnElementChanged
(
e
);
if
(
Control
!=
null
)
public
bool
isFocused
(
Xamarin
.
Forms
.
View
v
)
{
Task
.
Delay
(
3000
).
ContinueWith
((
arg
)
=>
{
Device
.
BeginInvokeOnMainThread
(()
=>
{
if
(
Control
.
IsAccessibilityFocused
)
{
Control
.
Text
=
"Focus"
;
Console
.
WriteLine
(
"focus"
);
}
else
{
Control
.
Text
=
"Not in focus"
;
Console
.
WriteLine
(
"Not in focus"
);
return
v
.
GetRenderer
().
View
.
IsAccessibilityFocused
;
}
});
});
}
}
}
}
\ No newline at end of file
SampleApp/SampleApp.Android/Resources/Resource.designer.cs
View file @
d40e6438
This diff is collapsed.
Click to expand it.
SampleApp/SampleApp.Android/SampleApp.Android.csproj
View file @
d40e6438
...
...
@@ -53,7 +53,7 @@
<Reference
Include=
"System.Numerics.Vectors"
/>
</ItemGroup>
<ItemGroup>
<PackageReference
Include=
"Xamarin.Forms"
Version=
"4.
7.0.968
"
/>
<PackageReference
Include=
"Xamarin.Forms"
Version=
"4.
8.0.1451
"
/>
<PackageReference
Include=
"Xamarin.Essentials"
Version=
"1.5.3.2"
/>
</ItemGroup>
<ItemGroup>
...
...
SampleApp/SampleApp.iOS/SampleApp.iOS.csproj
View file @
d40e6438
...
...
@@ -128,7 +128,7 @@
<Reference
Include=
"System.Numerics.Vectors"
/>
</ItemGroup>
<ItemGroup>
<PackageReference
Include=
"Xamarin.Forms"
Version=
"4.
7.0.968
"
/>
<PackageReference
Include=
"Xamarin.Forms"
Version=
"4.
8.0.1451
"
/>
<PackageReference
Include=
"Xamarin.Essentials"
Version=
"1.5.3.2"
/>
</ItemGroup>
<Import
Project=
"$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets"
/>
...
...
SampleApp/SampleApp.iOS/iOSFocusEvents.cs
View file @
d40e6438
...
...
@@ -4,7 +4,6 @@ using Xamarin.Forms;
using
SampleApp.iOS
;
using
Xamarin.Forms.Platform.iOS
;
using
SampleApp.Views
;
using
SampleApp.Models
;
[assembly: ExportRenderer(typeof(IFocusEvents), typeof(iOSFocusEvents))]
namespace
SampleApp.iOS
...
...
SampleApp/SampleApp.iOS/iOSHasFocus.cs
View file @
d40e6438
using
System
;
using
System.Runtime.Remoting.Contexts
;
using
System.Threading
;
using
System.Threading.Tasks
;
using
System.Timers
;
using
SampleApp.CustomRenderers
;
using
SampleApp.iOS
;
using
UIKit
;
using
Xamarin.Forms
;
using
Xamarin.Forms.Platform.iOS
;
using
fun5.iOS
;
using
System.Threading.Tasks
;
using
SampleApp.DependencyServices
;
[assembly:
ExportRenderer(typeof(CustomLabel),typeof(iOSHas
Focus))]
namespace
SampleApp
.iOS
[assembly:
Dependency(typeof(iOS
Focus))]
namespace
fun5
.iOS
{
public
class
iOSHasFocus
:
LabelRenderer
{
protected
override
void
OnElementChanged
(
ElementChangedEventArgs
<
Label
>
e
)
{
base
.
OnElementChanged
(
e
);
if
(
Control
!=
null
)
{
SetNativeControl
(
new
AccessibleLabel
());
}
}
}
public
class
AccessibleLabel
:
UILabel
public
class
iOSFocus
:
IIsFocused
{
public
AccessibleLabel
()
:
base
()
{
Console
.
WriteLine
(
"ACCESSIBLE LABEL CREATED"
);
if
(
AccessibilityElementIsFocused
()
)
public
bool
isFocused
(
View
v
)
{
this
.
Text
=
"focus"
;
Console
.
WriteLine
(
"accessibilityelementisfocused"
);
return
v
.
GetRenderer
().
NativeView
.
AccessibilityElementIsFocused
();
}
else
{
this
.
Text
=
"NOTinfocus"
;
Console
.
WriteLine
(
"accessibilityelementisNOTinfocus"
);
}
}
public
override
bool
AccessibilityElementIsFocused
()
{
if
(
base
.
AccessibilityElementIsFocused
())
{
return
true
;
}
else
{
return
false
;
}
}
}
}
SampleApp/SampleApp/DependencyServices/IIsFocused.cs
0 → 100644
View file @
d40e6438
using
System
;
using
Xamarin.Forms
;
namespace
SampleApp.DependencyServices
{
public
interface
IIsFocused
{
bool
isFocused
(
View
v
);
}
}
SampleApp/SampleApp/SampleApp.csproj
View file @
d40e6438
...
...
@@ -11,7 +11,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="4.
7.0.968
" />
<PackageReference Include="Xamarin.Forms" Version="4.
8.0.1451
" />
<PackageReference Include="Xamarin.Essentials" Version="1.5.3.2" />
</ItemGroup>
<ItemGroup>
...
...
SampleApp/SampleApp/Views/Functionality5.xaml
View file @
d40e6438
<?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.Functionality5"
>
<StackLayout
x:Name=
"background"
></StackLayout>
<ContentPage
xmlns=
"http://xamarin.com/schemas/2014/forms"
xmlns:x=
"http://schemas.microsoft.com/winfx/2009/xaml"
x:Class=
"SampleApp.Views.Functionality5"
xmlns:local=
"clr-namespace:SampleApp;assembly=SampleApp"
>
<StackLayout
x:Name=
"background"
>
<Image
Source=
"{local:ImageResource SampleApp.images.bell.png}"
x:Name=
"bellImage"
></Image>
</StackLayout>
</ContentPage>
SampleApp/SampleApp/Views/Functionality5.xaml.cs
View file @
d40e6438
using
System
;
using
System.
Collections.Generic
;
using
SampleApp.
CustomRenderer
s
;
using
System.
Reflection
;
using
SampleApp.
DependencyService
s
;
using
Xamarin.Forms
;
namespace
SampleApp.Views
...
...
@@ -8,25 +8,52 @@ namespace SampleApp.Views
public
partial
class
Functionality5
:
ContentPage
{
//label
Label
label
=
new
Label
{
Text
=
"Does the Bell's Image Have the Focus?"
,
HorizontalOptions
=
LayoutOptions
.
CenterAndExpand
};
Label
labelYN
=
new
Label
{
Text
=
"YES/ NO"
,
HorizontalOptions
=
LayoutOptions
.
CenterAndExpand
};
Label
infoLabel
=
new
Label
{
Text
=
"i: This view updates every 2 seconds"
,
HorizontalOptions
=
LayoutOptions
.
CenterAndExpand
,
Margin
=
new
Thickness
(
0
,
200
)
};
IIsFocused
dependency
;
public
Functionality5
()
{
InitializeComponent
();
dependency
=
DependencyService
.
Get
<
IIsFocused
>();
CustomLabel
label
=
new
CustomLabel
{
Text
=
"Focus?"
,
HorizontalOptions
=
LayoutOptions
.
Center
,
VerticalOptions
=
LayoutOptions
.
Center
};
background
.
Children
.
Add
(
label
);
AutomationProperties
.
SetIsInAccessibleTree
(
label
,
true
);
background
.
Children
.
Add
(
labelYN
);
background
.
Children
.
Add
(
infoLabel
);
AutomationProperties
.
SetIsInAccessibleTree
(
label
,
true
);
AutomationProperties
.
SetIsInAccessibleTree
(
labelYN
,
true
);
AutomationProperties
.
SetIsInAccessibleTree
(
bellImage
,
true
);
AutomationProperties
.
SetHelpText
(
bellImage
,
"Bell Image"
);
// timer che si ripete ogni 2 secondi
Device
.
StartTimer
(
TimeSpan
.
FromMilliseconds
(
2000.0
),
()
=>
{
Console
.
WriteLine
(
"TIMER FIRED"
);
Device
.
BeginInvokeOnMainThread
(()
=>
{
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
;
// runs again, or false to stop
});
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment