From a83520f7c7a6d5ff3be975dc2b9eb7df0cd29f71 Mon Sep 17 00:00:00 2001 From: Jerome Laban Date: Mon, 22 Aug 2022 10:36:34 -0400 Subject: [PATCH] chore: Adjust for android deprecated members --- src/Uno.UI/UI/Xaml/ApplicationActivity.Android.cs | 4 ++++ src/Uno.UI/UI/Xaml/UIElement.Android.cs | 7 +++---- .../Providers/Midi/MidiDeviceClassProviderBase.Android.cs | 2 ++ .../Devices/Haptics/SimpleHapticsController.Android.cs | 1 + .../Web/WebAuthenticationBrokerRedirectActivity.Android.cs | 2 ++ 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/Uno.UI/UI/Xaml/ApplicationActivity.Android.cs b/src/Uno.UI/UI/Xaml/ApplicationActivity.Android.cs index cb6b1ba5a7..d68f59cfda 100644 --- a/src/Uno.UI/UI/Xaml/ApplicationActivity.Android.cs +++ b/src/Uno.UI/UI/Xaml/ApplicationActivity.Android.cs @@ -282,6 +282,8 @@ namespace Windows.UI.Xaml Windows.UI.Xaml.Application.Current.OnSystemThemeChanged(); } +#pragma warning disable CS0618 // deprecated members +#pragma warning disable CS0672 // deprecated members public override void OnBackPressed() { var handled = Windows.UI.Core.SystemNavigationManager.GetForCurrentView().RequestBack(); @@ -290,6 +292,8 @@ namespace Windows.UI.Xaml base.OnBackPressed(); } } +#pragma warning restore CS0618 // deprecated members +#pragma warning restore CS0672 // deprecated members protected override void OnNewIntent(Intent intent) { diff --git a/src/Uno.UI/UI/Xaml/UIElement.Android.cs b/src/Uno.UI/UI/Xaml/UIElement.Android.cs index 2f9228b7e2..c294389a94 100644 --- a/src/Uno.UI/UI/Xaml/UIElement.Android.cs +++ b/src/Uno.UI/UI/Xaml/UIElement.Android.cs @@ -417,6 +417,8 @@ namespace Windows.UI.Xaml return jObject; } +#pragma warning disable CS0618 // deprecated members + var type = dpValue.GetType(); if (type == typeof(bool)) { @@ -424,9 +426,7 @@ namespace Windows.UI.Xaml } else if (type == typeof(sbyte)) { -#pragma warning disable CS0618 // Byte.Byte(sbyte) is obsolete in API 31 return new Java.Lang.Byte((sbyte)dpValue); -#pragma warning restore CS0618 // Byte.Byte(sbyte) is obsolete in API 31 } else if (type == typeof(char)) { @@ -434,9 +434,7 @@ namespace Windows.UI.Xaml } else if (type == typeof(short)) { -#pragma warning disable CS0618 // Short.Short(short) is obsolete in API 31 return new Java.Lang.Short((short)dpValue); -#pragma warning restore CS0618 // Short.Short(short) is obsolete in API 31 } else if (type == typeof(int)) { @@ -461,6 +459,7 @@ namespace Windows.UI.Xaml // If all else fails, just return the string representation of the DP's value return new Java.Lang.String(dpValue.ToString()); +#pragma warning restore CS0618 // deprecated members } #if DEBUG diff --git a/src/Uno.UWP/Devices/Enumeration/Internal/Providers/Midi/MidiDeviceClassProviderBase.Android.cs b/src/Uno.UWP/Devices/Enumeration/Internal/Providers/Midi/MidiDeviceClassProviderBase.Android.cs index 0e043e5db4..0acfc42f5c 100644 --- a/src/Uno.UWP/Devices/Enumeration/Internal/Providers/Midi/MidiDeviceClassProviderBase.Android.cs +++ b/src/Uno.UWP/Devices/Enumeration/Internal/Providers/Midi/MidiDeviceClassProviderBase.Android.cs @@ -1,4 +1,6 @@ #if __ANDROID__ +#pragma warning disable CS0618 // obsolete members + using System; using System.Collections.Generic; using System.Linq; diff --git a/src/Uno.UWP/Devices/Haptics/SimpleHapticsController.Android.cs b/src/Uno.UWP/Devices/Haptics/SimpleHapticsController.Android.cs index b447ea9d98..31f9627927 100644 --- a/src/Uno.UWP/Devices/Haptics/SimpleHapticsController.Android.cs +++ b/src/Uno.UWP/Devices/Haptics/SimpleHapticsController.Android.cs @@ -1,4 +1,5 @@ #nullable enable +#pragma warning disable CS0618 // obsolete members using System; using System.Collections.Generic; diff --git a/src/Uno.UWP/Security/Authentication/Web/WebAuthenticationBrokerRedirectActivity.Android.cs b/src/Uno.UWP/Security/Authentication/Web/WebAuthenticationBrokerRedirectActivity.Android.cs index 85fb8f7b9b..a90a1cd17f 100644 --- a/src/Uno.UWP/Security/Authentication/Web/WebAuthenticationBrokerRedirectActivity.Android.cs +++ b/src/Uno.UWP/Security/Authentication/Web/WebAuthenticationBrokerRedirectActivity.Android.cs @@ -1,4 +1,6 @@ #nullable enable +#pragma warning disable CS0618 // obsolete members + using Android.App; using Android.Content.PM; using Android.Content;