maui-linux/Xamarin.Forms.Platform.Andr.../ContextExtensions.cs

23 строки
454 B
C#

using Android.Content;
using AActivity = Android.App.Activity;
namespace Xamarin.Forms.Platform.Android.AppLinks
{
internal static class ContextExtensions
{
public static AActivity GetActivity(this Context context)
{
if (context == null)
return null;
if (context is AActivity activity)
return activity;
if (context is ContextWrapper contextWrapper)
return contextWrapper.BaseContext.GetActivity();
return null;
}
}
}