diff --git a/Rg.Plugins.Popup/Pages/PopupPage.cs b/Rg.Plugins.Popup/Pages/PopupPage.cs
index 08fffbde..46e6606d 100644
--- a/Rg.Plugins.Popup/Pages/PopupPage.cs
+++ b/Rg.Plugins.Popup/Pages/PopupPage.cs
@@ -1,10 +1,12 @@
using System;
using System.Threading.Tasks;
using System.Windows.Input;
+
using Rg.Plugins.Popup.Animations;
using Rg.Plugins.Popup.Enums;
using Rg.Plugins.Popup.Interfaces.Animations;
using Rg.Plugins.Popup.Services;
+
using Xamarin.Forms;
namespace Rg.Plugins.Popup.Pages
@@ -119,12 +121,12 @@ public double KeyboardOffset
get { return (double)GetValue(KeyboardOffsetProperty); }
private set { SetValue(KeyboardOffsetProperty, value); }
}
-
+
public static readonly BindableProperty BackgroundClickedCommandProperty = BindableProperty.Create(nameof(BackgroundClickedCommand), typeof(ICommand), typeof(PopupPage));
public ICommand BackgroundClickedCommand
{
- get => (ICommand) GetValue(BackgroundClickedCommandProperty);
+ get => (ICommand)GetValue(BackgroundClickedCommandProperty);
set => SetValue(BackgroundClickedCommandProperty, value);
}
@@ -136,6 +138,14 @@ public object BackgroundClickedCommandParameter
set => SetValue(BackgroundClickedCommandParameterProperty, value);
}
+ public static readonly BindableProperty AndroidTalkbackAccessibilityWorkaroundProperty = BindableProperty.Create(nameof(AndroidTalkbackAccessibilityWorkaround), typeof(bool), typeof(PopupPage), false);
+
+ public bool AndroidTalkbackAccessibilityWorkaround
+ {
+ get => (bool)GetValue(AndroidTalkbackAccessibilityWorkaroundProperty);
+ set => SetValue(AndroidTalkbackAccessibilityWorkaroundProperty, value);
+ }
+
#endregion
#region Main Methods
@@ -155,14 +165,14 @@ protected override void OnPropertyChanged(string? propertyName = null)
case nameof(HasKeyboardOffset):
case nameof(SystemPaddingSides):
case nameof(SystemPadding):
- ForceLayout();
- break;
+ ForceLayout();
+ break;
case nameof(IsAnimating):
- IsAnimationEnabled = IsAnimating;
- break;
+ IsAnimationEnabled = IsAnimating;
+ break;
case nameof(IsAnimationEnabled):
- IsAnimating = IsAnimationEnabled;
- break;
+ IsAnimating = IsAnimationEnabled;
+ break;
}
}
diff --git a/Rg.Plugins.Popup/Platforms/Android/Impl/PopupPlatformDroid.cs b/Rg.Plugins.Popup/Platforms/Android/Impl/PopupPlatformDroid.cs
index 075411a0..5ac15c55 100644
--- a/Rg.Plugins.Popup/Platforms/Android/Impl/PopupPlatformDroid.cs
+++ b/Rg.Plugins.Popup/Platforms/Android/Impl/PopupPlatformDroid.cs
@@ -1,10 +1,14 @@
using System;
+using System.Text;
using System.Threading.Tasks;
using Android.App;
+using Android.Content;
using Android.OS;
using Android.Provider;
using Android.Runtime;
+using Android.Views;
+using Android.Views.Accessibility;
using Android.Widget;
using Rg.Plugins.Popup.Contracts;
@@ -40,10 +44,14 @@ public Task AddAsync(PopupPage page)
{
var decoreView = DecoreView;
+ if (page.AndroidTalkbackAccessibilityWorkaround)
+ {
+ RecursivelyChangeAccessibilityOfViewChildren(XApplication.Current.MainPage.GetOrCreateRenderer().View, ImportantForAccessibility.No);
+ }
+
page.Parent = XApplication.Current.MainPage;
var renderer = page.GetOrCreateRenderer();
-
decoreView?.AddView(renderer.View);
return PostAsync(renderer.View);
@@ -57,6 +65,12 @@ public Task RemoveAsync(PopupPage page)
var renderer = page.GetOrCreateRenderer();
if (renderer != null)
{
+ if (page.AndroidTalkbackAccessibilityWorkaround)
+ {
+ RecursivelyChangeAccessibilityOfViewChildren(XApplication.Current.MainPage.GetOrCreateRenderer().View, ImportantForAccessibility.Auto);
+ }
+
+ page.Parent = XApplication.Current.MainPage;
var element = renderer.Element;
DecoreView?.RemoveView(renderer.View);
@@ -115,6 +129,19 @@ private static Task PostAsync(Android.Views.View nativeView)
return tcs.Task;
}
+ private void RecursivelyChangeAccessibilityOfViewChildren(Android.Views.View view, ImportantForAccessibility important)
+ {
+ if (view is ViewGroup vGroup)
+ {
+ for (int i = 0; i < vGroup.ChildCount; i++)
+ {
+ Android.Views.View vChild = vGroup.GetChildAt(i);
+ vChild.ImportantForAccessibility = important;
+ vChild.ClearFocus();
+ RecursivelyChangeAccessibilityOfViewChildren(vChild, important);
+ }
+ }
+ }
#endregion
}
}
diff --git a/Rg.Plugins.Popup/Platforms/Mac/Extensions/PlatformExtension.cs b/Rg.Plugins.Popup/Platforms/Mac/Extensions/PlatformExtension.cs
index fa478f38..844288b7 100644
--- a/Rg.Plugins.Popup/Platforms/Mac/Extensions/PlatformExtension.cs
+++ b/Rg.Plugins.Popup/Platforms/Mac/Extensions/PlatformExtension.cs
@@ -1,8 +1,12 @@
using System.Linq;
+
using AppKit;
+
using Rg.Plugins.Popup.MacOS.Renderers;
+
using Xamarin.Forms;
using Xamarin.Forms.Platform.MacOS;
+
using XFPlatform = Xamarin.Forms.Platform.MacOS.Platform;
namespace Rg.Plugins.Popup.MacOS.Extensions
@@ -54,6 +58,8 @@ public static void UpdateSize(this PopupPageRenderer renderer)
var superviewFrame = renderer.View.Superview.Frame;
var applactionFrame = NSScreen.MainScreen.Frame;
+
+
var systemPadding = new Thickness
{
Left = applactionFrame.Left,
diff --git a/Samples/Demo.Droid/MainActivity.cs b/Samples/Demo.Droid/MainActivity.cs
index a5071311..d5b86904 100644
--- a/Samples/Demo.Droid/MainActivity.cs
+++ b/Samples/Demo.Droid/MainActivity.cs
@@ -1,6 +1,7 @@
using Android.App;
using Android.Content.PM;
using Android.OS;
+
using Debug = System.Diagnostics.Debug;
namespace Demo.Droid
@@ -12,7 +13,7 @@ protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
- Rg.Plugins.Popup.Popup.Init(this, bundle);
+ Rg.Plugins.Popup.Popup.Init(this);
global::Xamarin.Forms.Forms.Init(this, bundle);
LoadApplication(new App());
}
diff --git a/Samples/Demo/Pages/FirstPopupPage.xaml b/Samples/Demo/Pages/FirstPopupPage.xaml
index d63b72df..68780c76 100644
--- a/Samples/Demo/Pages/FirstPopupPage.xaml
+++ b/Samples/Demo/Pages/FirstPopupPage.xaml
@@ -1,41 +1,54 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
\ No newline at end of file
diff --git a/Samples/Demo/Pages/ListViewPage.xaml b/Samples/Demo/Pages/ListViewPage.xaml
index 9e9688e2..8269518c 100644
--- a/Samples/Demo/Pages/ListViewPage.xaml
+++ b/Samples/Demo/Pages/ListViewPage.xaml
@@ -1,18 +1,25 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
\ No newline at end of file
diff --git a/Samples/Demo/Pages/LoginPopupPage.xaml b/Samples/Demo/Pages/LoginPopupPage.xaml
index b1de1160..8e513a28 100644
--- a/Samples/Demo/Pages/LoginPopupPage.xaml
+++ b/Samples/Demo/Pages/LoginPopupPage.xaml
@@ -1,95 +1,97 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file