From 82038f8ed960cca5667e52e84c1baf49b4c73613 Mon Sep 17 00:00:00 2001 From: James Montemagno Date: Tue, 13 Apr 2021 13:21:47 -0700 Subject: [PATCH] Fixed #1355 delay processing change so OS updates --- Xamarin.Essentials/DeviceDisplay/DeviceDisplay.android.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Xamarin.Essentials/DeviceDisplay/DeviceDisplay.android.cs b/Xamarin.Essentials/DeviceDisplay/DeviceDisplay.android.cs index e733b7db2..c81f13665 100644 --- a/Xamarin.Essentials/DeviceDisplay/DeviceDisplay.android.cs +++ b/Xamarin.Essentials/DeviceDisplay/DeviceDisplay.android.cs @@ -1,4 +1,5 @@ using System; +using System.Threading.Tasks; using Android.Content; using Android.Content.Res; using Android.Provider; @@ -105,6 +106,10 @@ class Listener : OrientationEventListener internal Listener(Context context, Action handler) : base(context) => onChanged = handler; - public override void OnOrientationChanged(int orientation) => onChanged(); + public override async void OnOrientationChanged(int orientation) + { + await Task.Delay(500); + onChanged(); + } } }