fixed formatting errors
This commit is contained in:
@@ -20,8 +20,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{
|
||||
.github\workflows\codeql-analysis.yml = .github\workflows\codeql-analysis.yml
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MopupsEx", "MopupsEx\MopupsEx.csproj", "{1705A6B2-05BE-4950-8F7A-0F8AEA9E7B70}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -38,10 +36,6 @@ Global
|
||||
{6EBF1CDC-C4DD-4722-8EBC-3CAE51C3545B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{6EBF1CDC-C4DD-4722-8EBC-3CAE51C3545B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{6EBF1CDC-C4DD-4722-8EBC-3CAE51C3545B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{1705A6B2-05BE-4950-8F7A-0F8AEA9E7B70}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1705A6B2-05BE-4950-8F7A-0F8AEA9E7B70}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1705A6B2-05BE-4950-8F7A-0F8AEA9E7B70}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1705A6B2-05BE-4950-8F7A-0F8AEA9E7B70}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -6,8 +6,6 @@ using Mopups.Pages;
|
||||
|
||||
namespace Mopups.Animations.Base;
|
||||
|
||||
|
||||
|
||||
public class EasingTypeConverter : TypeConverter
|
||||
{
|
||||
public override object? ConvertFrom(ITypeDescriptorContext? context, CultureInfo? culture, object value)
|
||||
@@ -18,15 +16,18 @@ public class EasingTypeConverter : TypeConverter
|
||||
{
|
||||
if (fi.IsStatic)
|
||||
return fi.Name == value.ToString();
|
||||
|
||||
return false;
|
||||
});
|
||||
if (fieldInfo != null)
|
||||
{
|
||||
var fieldValue = fieldInfo.GetValue(null);
|
||||
|
||||
if (fieldValue != null)
|
||||
return (Easing)fieldValue;
|
||||
}
|
||||
}
|
||||
|
||||
throw new InvalidOperationException($"Cannot convert \"{value}\" into {typeof(Easing)}");
|
||||
}
|
||||
}
|
||||
@@ -85,7 +86,6 @@ public abstract class BaseAnimation : IPopupAnimation
|
||||
return (int)(content.Width + page.Width) / 2;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Cannot use Page.IsVisible as this will remove the ability to use GetTopOffset/GetLeftOffset
|
||||
/// </summary>
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
|
||||
|
||||
using Mopups.Animations.Base;
|
||||
using Mopups.Pages;
|
||||
using Mopups.Pages;
|
||||
|
||||
namespace Mopups.Animations.Base;
|
||||
|
||||
@@ -16,7 +13,6 @@ public abstract class FadeBackgroundAnimation : BaseAnimation
|
||||
_backgroundColor = page.BackgroundColor;
|
||||
|
||||
page.BackgroundColor = GetColor(0);
|
||||
|
||||
}
|
||||
|
||||
public override void Disposing(View content, PopupPage page)
|
||||
@@ -40,6 +36,7 @@ public abstract class FadeBackgroundAnimation : BaseAnimation
|
||||
|
||||
return taskSource.Task;
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
|
||||
@@ -129,6 +129,7 @@ public class ScaleAnimation : FadeAnimation
|
||||
taskList.Add(content.TranslateTo(leftOffset, _defaultTranslationY, DurationOut, EasingOut));
|
||||
}
|
||||
}
|
||||
|
||||
await Task.WhenAll(taskList);
|
||||
}
|
||||
|
||||
@@ -146,6 +147,7 @@ public class ScaleAnimation : FadeAnimation
|
||||
{
|
||||
task.SetResult(true);
|
||||
});
|
||||
|
||||
return task.Task;
|
||||
}
|
||||
|
||||
@@ -153,8 +155,10 @@ public class ScaleAnimation : FadeAnimation
|
||||
{
|
||||
_defaultScale = content.Scale;
|
||||
_defaultOpacity = content.Opacity;
|
||||
|
||||
if (double.IsNaN(_defaultOpacity))
|
||||
_defaultOpacity = 1;
|
||||
|
||||
_defaultTranslationX = content.TranslationX;
|
||||
_defaultTranslationY = content.TranslationY;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Mopups.Pages;
|
||||
using Mopups.Pages;
|
||||
|
||||
namespace Mopups.Events;
|
||||
|
||||
public class PopupNavigationEventArgs : EventArgs
|
||||
{
|
||||
public PopupPage Page { get; }
|
||||
|
||||
@@ -8,7 +8,6 @@ namespace Mopups.Hosting;
|
||||
/// </summary>
|
||||
public static class AppHostBuilderExtensions
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Automatically sets up lifecycle events and Maui Handlers
|
||||
/// </summary>
|
||||
@@ -22,7 +21,6 @@ public static class AppHostBuilderExtensions
|
||||
#if ANDROID
|
||||
lifecycle.AddAndroid(d =>
|
||||
{
|
||||
|
||||
d.OnBackPressed(activity => Droid.Implementation.AndroidMopups.SendBackPressed());
|
||||
});
|
||||
#endif
|
||||
|
||||
@@ -17,79 +17,76 @@ public partial class PopupPage : ContentPage
|
||||
|
||||
internal Task? DisappearingTransactionTask { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
public static readonly BindableProperty IsAnimationEnabledProperty = BindableProperty.Create(nameof(IsAnimationEnabled), typeof(bool), typeof(PopupPage), true);
|
||||
|
||||
public bool IsAnimationEnabled
|
||||
{
|
||||
get { return (bool)GetValue(IsAnimationEnabledProperty); }
|
||||
set { SetValue(IsAnimationEnabledProperty, value); }
|
||||
get => (bool)GetValue(IsAnimationEnabledProperty);
|
||||
set => SetValue(IsAnimationEnabledProperty, value);
|
||||
}
|
||||
|
||||
public static readonly BindableProperty HasSystemPaddingProperty = BindableProperty.Create(nameof(HasSystemPadding), typeof(bool), typeof(PopupPage), true);
|
||||
|
||||
public bool HasSystemPadding
|
||||
{
|
||||
get { return (bool)GetValue(HasSystemPaddingProperty); }
|
||||
set { SetValue(HasSystemPaddingProperty, value); }
|
||||
get => (bool)GetValue(HasSystemPaddingProperty);
|
||||
set => SetValue(HasSystemPaddingProperty, value);
|
||||
}
|
||||
|
||||
public static readonly BindableProperty AnimationProperty = BindableProperty.Create(nameof(Animation), typeof(IPopupAnimation), typeof(PopupPage), new ScaleAnimation());
|
||||
|
||||
public IPopupAnimation Animation
|
||||
{
|
||||
get { return (IPopupAnimation)GetValue(AnimationProperty); }
|
||||
set { SetValue(AnimationProperty, value); }
|
||||
get => (IPopupAnimation)GetValue(AnimationProperty);
|
||||
set => SetValue(AnimationProperty, value);
|
||||
}
|
||||
|
||||
public static readonly BindableProperty SystemPaddingProperty = BindableProperty.Create(nameof(SystemPadding), typeof(Thickness), typeof(PopupPage), default(Thickness), BindingMode.OneWayToSource);
|
||||
|
||||
public Thickness SystemPadding
|
||||
{
|
||||
get { return (Thickness)GetValue(SystemPaddingProperty); }
|
||||
internal set { SetValue(SystemPaddingProperty, value); }
|
||||
get => (Thickness)GetValue(SystemPaddingProperty);
|
||||
internal set => SetValue(SystemPaddingProperty, value);
|
||||
}
|
||||
|
||||
public static readonly BindableProperty SystemPaddingSidesProperty = BindableProperty.Create(nameof(SystemPaddingSides), typeof(PaddingSide), typeof(PopupPage), PaddingSide.All);
|
||||
|
||||
public PaddingSide SystemPaddingSides
|
||||
{
|
||||
get { return (PaddingSide)GetValue(SystemPaddingSidesProperty); }
|
||||
set { SetValue(SystemPaddingSidesProperty, value); }
|
||||
get => (PaddingSide)GetValue(SystemPaddingSidesProperty);
|
||||
set => SetValue(SystemPaddingSidesProperty, value);
|
||||
}
|
||||
|
||||
public static readonly BindableProperty CloseWhenBackgroundIsClickedProperty = BindableProperty.Create(nameof(CloseWhenBackgroundIsClicked), typeof(bool), typeof(PopupPage), true);
|
||||
|
||||
public bool CloseWhenBackgroundIsClicked
|
||||
{
|
||||
get { return (bool)GetValue(CloseWhenBackgroundIsClickedProperty); }
|
||||
set { SetValue(CloseWhenBackgroundIsClickedProperty, value); }
|
||||
get => (bool)GetValue(CloseWhenBackgroundIsClickedProperty);
|
||||
set => SetValue(CloseWhenBackgroundIsClickedProperty, value);
|
||||
}
|
||||
|
||||
public static readonly BindableProperty BackgroundInputTransparentProperty = BindableProperty.Create(nameof(BackgroundInputTransparent), typeof(bool), typeof(PopupPage), false);
|
||||
|
||||
public bool BackgroundInputTransparent
|
||||
{
|
||||
get { return (bool)GetValue(BackgroundInputTransparentProperty); }
|
||||
set { SetValue(BackgroundInputTransparentProperty, value); }
|
||||
get => (bool)GetValue(BackgroundInputTransparentProperty);
|
||||
set => SetValue(BackgroundInputTransparentProperty, value);
|
||||
}
|
||||
|
||||
public static readonly BindableProperty HasKeyboardOffsetProperty = BindableProperty.Create(nameof(HasKeyboardOffset), typeof(bool), typeof(PopupPage), true);
|
||||
|
||||
public bool HasKeyboardOffset
|
||||
{
|
||||
get { return (bool)GetValue(HasKeyboardOffsetProperty); }
|
||||
set { SetValue(HasKeyboardOffsetProperty, value); }
|
||||
get => (bool)GetValue(HasKeyboardOffsetProperty);
|
||||
set => SetValue(HasKeyboardOffsetProperty, value);
|
||||
}
|
||||
|
||||
public static readonly BindableProperty KeyboardOffsetProperty = BindableProperty.Create(nameof(KeyboardOffset), typeof(double), typeof(PopupPage), 0d, BindingMode.OneWayToSource);
|
||||
|
||||
public double KeyboardOffset
|
||||
{
|
||||
get { return (double)GetValue(KeyboardOffsetProperty); }
|
||||
private set { SetValue(KeyboardOffsetProperty, value); }
|
||||
get => (double)GetValue(KeyboardOffsetProperty);
|
||||
private set => SetValue(KeyboardOffsetProperty, value);
|
||||
}
|
||||
|
||||
public static readonly BindableProperty BackgroundClickedCommandProperty = BindableProperty.Create(nameof(BackgroundClickedCommand), typeof(ICommand), typeof(PopupPage));
|
||||
@@ -118,7 +115,6 @@ public partial class PopupPage : ContentPage
|
||||
|
||||
public PopupPage()
|
||||
{
|
||||
|
||||
BackgroundColor = Colors.Transparent;//Color.FromArgb("#80000000");
|
||||
}
|
||||
|
||||
@@ -180,6 +176,7 @@ public partial class PopupPage : ContentPage
|
||||
{
|
||||
height -= KeyboardOffset;
|
||||
}
|
||||
|
||||
base.LayoutChildren(x, y, width, height);
|
||||
}
|
||||
|
||||
@@ -224,7 +221,6 @@ public partial class PopupPage : ContentPage
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Override Animation Methods
|
||||
|
||||
protected virtual void OnAppearingAnimationBegin()
|
||||
@@ -273,6 +269,7 @@ public partial class PopupPage : ContentPage
|
||||
internal void SendBackgroundClick()
|
||||
{
|
||||
BackgroundClicked?.Invoke(this, EventArgs.Empty);
|
||||
|
||||
if (BackgroundClickedCommand?.CanExecute(BackgroundClickedCommandParameter) == true)
|
||||
{
|
||||
BackgroundClickedCommand.Execute(BackgroundClickedCommandParameter);
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
using Android.Content;
|
||||
using Android.OS;
|
||||
using Android.Views;
|
||||
using Microsoft.Maui.Handlers;
|
||||
using Microsoft.Maui.Handlers;
|
||||
using Microsoft.Maui.Platform;
|
||||
using Mopups.Droid.Gestures;
|
||||
using Mopups.Platforms.Android.Renderers;
|
||||
|
||||
using System.Drawing;
|
||||
|
||||
namespace Mopups.Pages;
|
||||
|
||||
public class PopupPageHandler : PageHandler
|
||||
@@ -16,13 +10,11 @@ public class PopupPageHandler : PageHandler
|
||||
|
||||
public PopupPageHandler()
|
||||
{
|
||||
|
||||
this.SetMauiContext(MauiApplication.Current.Application.Windows[0].Handler.MauiContext);
|
||||
}
|
||||
|
||||
protected override void ConnectHandler(ContentViewGroup platformView)
|
||||
{
|
||||
|
||||
(platformView as PopupPageRenderer).PopupHandler = this;
|
||||
base.ConnectHandler(platformView);
|
||||
}
|
||||
@@ -36,7 +28,6 @@ public class PopupPageHandler : PageHandler
|
||||
protected override void DisconnectHandler(ContentViewGroup platformView)
|
||||
{
|
||||
base.DisconnectHandler(platformView);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ using Android.Content;
|
||||
using Android.Graphics;
|
||||
using Android.Views;
|
||||
|
||||
|
||||
using Microsoft.Maui.Platform;
|
||||
|
||||
using AndroidGraphics = Android.Graphics; //Weird conflict with Microsoft namespace?
|
||||
@@ -20,6 +19,7 @@ using Android.OS;
|
||||
using Rect = Microsoft.Maui.Graphics.Rect;
|
||||
|
||||
namespace Mopups.Platforms.Android.Renderers;
|
||||
|
||||
public class PopupPageRenderer : ContentViewGroup
|
||||
{
|
||||
public PopupPageHandler PopupHandler;
|
||||
@@ -29,6 +29,7 @@ public class PopupPageRenderer : ContentViewGroup
|
||||
private DateTime _downTime;
|
||||
private Microsoft.Maui.Graphics.Point _downPosition;
|
||||
private bool _disposed;
|
||||
|
||||
public PopupPageRenderer(Context context) : base(context)
|
||||
{
|
||||
_gestureDetectorListener = new MopupGestureDetectorListener();
|
||||
@@ -61,7 +62,6 @@ public class PopupPageRenderer : ContentViewGroup
|
||||
Thickness systemPadding;
|
||||
var keyboardOffset = 0d;
|
||||
|
||||
|
||||
var visibleRect = new AndroidGraphics.Rect();
|
||||
|
||||
decoreView?.GetWindowVisibleDisplayFrame(visibleRect);
|
||||
@@ -130,10 +130,8 @@ public class PopupPageRenderer : ContentViewGroup
|
||||
{
|
||||
throw;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected override void OnAttachedToWindow()
|
||||
{
|
||||
var activity = Platform.CurrentActivity;
|
||||
@@ -152,6 +150,7 @@ public class PopupPageRenderer : ContentViewGroup
|
||||
Context.HideKeyboard(decoreView);
|
||||
return false;
|
||||
});
|
||||
|
||||
base.OnDetachedFromWindow();
|
||||
}
|
||||
|
||||
@@ -175,7 +174,9 @@ public class PopupPageRenderer : ContentViewGroup
|
||||
{
|
||||
return base.DispatchTouchEvent(e);
|
||||
}
|
||||
|
||||
base.DispatchTouchEvent(e);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -196,15 +197,17 @@ public class PopupPageRenderer : ContentViewGroup
|
||||
if ((ChildCount > 0 && !IsInRegion(e.RawX, e.RawY, PopupHandler?.PlatformView.GetChildAt(0)!)) || ChildCount == 0)
|
||||
{
|
||||
(PopupHandler?.VirtualView as PopupPage).SendBackgroundClick();
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return baseValue;
|
||||
}
|
||||
catch (Exception f)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
return base.OnTouchEvent(e);
|
||||
}
|
||||
|
||||
@@ -231,5 +234,4 @@ public class PopupPageRenderer : ContentViewGroup
|
||||
(PopupHandler.VirtualView as PopupPage).SendBackgroundClick();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -30,7 +30,9 @@ public class AndroidMopups : IPopupPlatform
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
backPressedHandler?.Invoke();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -43,6 +45,7 @@ public class AndroidMopups : IPopupPlatform
|
||||
page.Parent = MauiApplication.Current.Application.Windows[0].Content as Element;
|
||||
var AndroidNativeView = IPopupPlatform.GetOrCreateHandler<PopupPageHandler>(page).PlatformView as Android.Views.View;
|
||||
decoreView?.AddView(AndroidNativeView);
|
||||
|
||||
return PostAsync(AndroidNativeView);
|
||||
}
|
||||
catch (Exception)
|
||||
@@ -54,6 +57,7 @@ public class AndroidMopups : IPopupPlatform
|
||||
public Task RemoveAsync(PopupPage page)
|
||||
{
|
||||
var renderer = IPopupPlatform.GetOrCreateHandler<PopupPageHandler>(page);
|
||||
|
||||
if (renderer != null)
|
||||
{
|
||||
DecoreView?.RemoveView(renderer.PlatformView as Android.Views.View);
|
||||
@@ -72,6 +76,7 @@ public class AndroidMopups : IPopupPlatform
|
||||
{
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
|
||||
var tcs = new TaskCompletionSource<bool>();
|
||||
|
||||
nativeView.Post(() => tcs.SetResult(true));
|
||||
|
||||
@@ -1,24 +1,9 @@
|
||||
using CoreGraphics;
|
||||
|
||||
using Foundation;
|
||||
|
||||
using Microsoft.Maui.Handlers;
|
||||
|
||||
using Mopups.Pages;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using UIKit;
|
||||
using Microsoft.Maui.Handlers;
|
||||
|
||||
namespace Mopups.Platforms.iOS
|
||||
{
|
||||
public class PopupPageHandler : PageHandler
|
||||
{
|
||||
|
||||
public PopupPageHandler()
|
||||
{
|
||||
this.SetMauiContext(MauiUIApplicationDelegate.Current.Application.Windows[0].Handler.MauiContext); //Still a hack?
|
||||
|
||||
@@ -46,6 +46,7 @@ namespace Mopups.Platforms.iOS
|
||||
_handler = null;
|
||||
View?.RemoveGestureRecognizer(_tapGestureRecognizer);
|
||||
}
|
||||
|
||||
base.Dispose(disposing);
|
||||
_isDisposed = true;
|
||||
}
|
||||
@@ -56,6 +57,7 @@ namespace Mopups.Platforms.iOS
|
||||
var view = e.View;
|
||||
var location = e.LocationInView(view);
|
||||
var subview = view.HitTest(location, null);
|
||||
|
||||
if (Equals(subview, view))
|
||||
{
|
||||
((PopupPage)Handler.VirtualView).SendBackgroundClick();
|
||||
@@ -155,7 +157,6 @@ namespace Mopups.Platforms.iOS
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override void ViewDidLoad()
|
||||
{
|
||||
base.ViewDidLoad();
|
||||
@@ -187,7 +188,6 @@ namespace Mopups.Platforms.iOS
|
||||
|
||||
_willHideNotificationObserver = UIKeyboard.Notifications.ObserveWillHide(async (sender, args) =>
|
||||
{
|
||||
|
||||
KeyboardBounds = CGRect.Empty;
|
||||
|
||||
if (args.AnimationDuration > 0.01)
|
||||
@@ -217,7 +217,6 @@ namespace Mopups.Platforms.iOS
|
||||
UnregisterAllObservers();
|
||||
}
|
||||
|
||||
|
||||
private void UnregisterAllObservers()
|
||||
{
|
||||
|
||||
@@ -228,5 +227,4 @@ namespace Mopups.Platforms.iOS
|
||||
_willHideNotificationObserver = null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
using Mopups.Pages;
|
||||
|
||||
|
||||
using UIKit;
|
||||
|
||||
namespace Mopups.Platforms.iOS
|
||||
@@ -39,11 +38,11 @@ namespace Mopups.Platforms.iOS
|
||||
if (formsElement.BackgroundInputTransparent && renderer?.PlatformView == hitTestResult)
|
||||
{
|
||||
formsElement.SendBackgroundClick();
|
||||
|
||||
return null!;
|
||||
}
|
||||
|
||||
return hitTestResult;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ internal class iOSMopups : IPopupPlatform
|
||||
var handler = (PopupPageHandler)IPopupPlatform.GetOrCreateHandler<PopupPageHandler>(page);
|
||||
|
||||
PopupWindow window;
|
||||
|
||||
if (IsiOS13OrNewer)
|
||||
{
|
||||
var connectedScene = UIApplication.SharedApplication.ConnectedScenes.ToArray().FirstOrDefault(x => x.ActivationState == UISceneActivationState.ForegroundActive);
|
||||
@@ -48,8 +49,10 @@ internal class iOSMopups : IPopupPlatform
|
||||
|
||||
window.BackgroundColor = Colors.Transparent.ToUIColor();
|
||||
window.RootViewController = new PopupPageRenderer(handler);
|
||||
|
||||
if (window.RootViewController.View != null)
|
||||
window.RootViewController.View.BackgroundColor = Colors.Transparent.ToUIColor();
|
||||
|
||||
window.WindowLevel = UIWindowLevel.Normal;
|
||||
window.MakeKeyAndVisible();
|
||||
|
||||
@@ -75,19 +78,24 @@ internal class iOSMopups : IPopupPlatform
|
||||
{
|
||||
var window = viewController.View?.Window;
|
||||
page.Parent = null;
|
||||
|
||||
if (window != null)
|
||||
{
|
||||
var rvc = window.RootViewController;
|
||||
|
||||
if (rvc != null)
|
||||
{
|
||||
await rvc.DismissViewControllerAsync(false);
|
||||
DisposeModelAndChildrenHandlers(page);
|
||||
rvc.Dispose();
|
||||
}
|
||||
|
||||
window.RootViewController = null;
|
||||
window.Hidden = true;
|
||||
|
||||
if (IsiOS13OrNewer && _windows.Contains(window))
|
||||
_windows.Remove(window);
|
||||
|
||||
window.Dispose();
|
||||
window = null;
|
||||
}
|
||||
|
||||
@@ -20,10 +20,12 @@ public static class MopupService
|
||||
get
|
||||
{
|
||||
IPopupNavigation lazyEvalPopupNavigation = _customNavigation ?? implementation.Value;
|
||||
|
||||
if (lazyEvalPopupNavigation == null)
|
||||
{
|
||||
throw NotImplementedInReferenceAssembly();
|
||||
}
|
||||
|
||||
return lazyEvalPopupNavigation;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +48,7 @@ public partial class LoginPage : PopupPage
|
||||
VerticalOptions = LayoutOptions.Center,
|
||||
Content = GenerateFrameContainerContent()
|
||||
};
|
||||
|
||||
return FrameContainer;
|
||||
}
|
||||
|
||||
@@ -56,13 +57,12 @@ public partial class LoginPage : PopupPage
|
||||
[MemberNotNull(nameof(LoginButton))]
|
||||
private VerticalStackLayout GenerateFrameContainerContent()
|
||||
{
|
||||
|
||||
var frameContainerContent = new VerticalStackLayout
|
||||
{
|
||||
|
||||
Margin = new Thickness(1),
|
||||
Padding = new Thickness(1, 1),
|
||||
};
|
||||
|
||||
UsernameEntry = new Entry
|
||||
{
|
||||
HorizontalOptions = LayoutOptions.Center,
|
||||
@@ -89,6 +89,7 @@ public partial class LoginPage : PopupPage
|
||||
frameContainerContent.Add(UsernameEntry);
|
||||
frameContainerContent.Add(PasswordEntry);
|
||||
frameContainerContent.Add(LoginButton);
|
||||
|
||||
return frameContainerContent;
|
||||
}
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@ public partial class MainPage : ContentPage
|
||||
})
|
||||
};
|
||||
mainStackLayout.Add(newButton);
|
||||
|
||||
return mainStackLayout;
|
||||
|
||||
Picker PopupAnimationPicker()
|
||||
@@ -60,9 +61,10 @@ public partial class MainPage : ContentPage
|
||||
{
|
||||
Items = { "FadeAnimation", "MoveAnimation", "ScaleAnimation" }
|
||||
};
|
||||
animationPicker.SelectedIndexChanged += OnAnimationPickerSelectedIndexChanged;
|
||||
return animationPicker;
|
||||
|
||||
animationPicker.SelectedIndexChanged += OnAnimationPickerSelectedIndexChanged;
|
||||
|
||||
return animationPicker;
|
||||
}
|
||||
|
||||
Picker EasingAnimationPicker()
|
||||
@@ -71,7 +73,9 @@ public partial class MainPage : ContentPage
|
||||
{
|
||||
Items = { "Linear", "BounceIn", "BounceOut", "CubicIn", "CubicOut", "SinIn", "SinInOut", "SinOut", "SpringIn", "SpringOut" }
|
||||
};
|
||||
|
||||
animationPicker.SelectedIndexChanged += OnEasingPickerSelectedIndexChanged;
|
||||
|
||||
return animationPicker;
|
||||
|
||||
}
|
||||
@@ -84,6 +88,7 @@ public partial class MainPage : ContentPage
|
||||
FlowDirection = FlowDirection.LeftToRight,
|
||||
|
||||
};
|
||||
|
||||
animationSlider.ValueChanged += OnSliderValueChanged;
|
||||
|
||||
return animationSlider;
|
||||
@@ -97,6 +102,7 @@ public partial class MainPage : ContentPage
|
||||
int selectedIndex = picker.SelectedIndex;
|
||||
AnimationType = selectedIndex;
|
||||
}
|
||||
|
||||
void OnAnimationPickerSelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
var picker = (Picker)sender;
|
||||
@@ -109,8 +115,6 @@ public partial class MainPage : ContentPage
|
||||
AnimationLength = args.NewValue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static Button GeneratePopupButton(string buttonText, AsyncCommand buttonCommand)
|
||||
{
|
||||
return new Button
|
||||
@@ -130,6 +134,7 @@ public partial class MainPage : ContentPage
|
||||
{
|
||||
var page = new TPopupPage();
|
||||
var easing = Easing.Linear;
|
||||
|
||||
switch (AnimationEasing)
|
||||
{
|
||||
case 0:
|
||||
|
||||
@@ -17,6 +17,5 @@ public partial class MainPage : ContentPage
|
||||
|
||||
protected override void OnAppearing()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,13 +14,13 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SampleMaui.CSharpMarkup;
|
||||
|
||||
public class TestPage : ContentPage
|
||||
{
|
||||
public double AnimationLength { get; set; }
|
||||
public int AnimationType { get; set; }
|
||||
public int AnimationEasing { get; set; }
|
||||
|
||||
|
||||
public TestPage()
|
||||
{
|
||||
BuildContent();
|
||||
@@ -30,6 +30,7 @@ public class TestPage : ContentPage
|
||||
MopupService.Instance.Popping += (sender, e) => Debug.WriteLine($"[Popup] Popping: {e.GetType().Name}");
|
||||
MopupService.Instance.Popped += (sender, e) => Debug.WriteLine($"[Popup] Popped: {e.GetType().Name}");
|
||||
}
|
||||
|
||||
protected void BuildContent()
|
||||
{
|
||||
BackgroundColor = Color.FromRgb(255, 255, 255);
|
||||
@@ -65,7 +66,9 @@ public class TestPage : ContentPage
|
||||
await Navigation.PushAsync(new TestPage());
|
||||
})
|
||||
};
|
||||
|
||||
mainStackLayout.Add(newButton);
|
||||
|
||||
return mainStackLayout;
|
||||
|
||||
Picker PopupAnimationPicker()
|
||||
@@ -74,9 +77,10 @@ public class TestPage : ContentPage
|
||||
{
|
||||
Items = { "FadeAnimation", "MoveAnimation", "ScaleAnimation" }
|
||||
};
|
||||
animationPicker.SelectedIndexChanged += OnAnimationPickerSelectedIndexChanged;
|
||||
return animationPicker;
|
||||
|
||||
animationPicker.SelectedIndexChanged += OnAnimationPickerSelectedIndexChanged;
|
||||
|
||||
return animationPicker;
|
||||
}
|
||||
|
||||
Picker EasingAnimationPicker()
|
||||
@@ -85,9 +89,10 @@ public class TestPage : ContentPage
|
||||
{
|
||||
Items = { "Linear", "BounceIn", "BounceOut", "CubicIn", "CubicOut", "SinIn", "SinInOut", "SinOut", "SpringIn", "SpringOut" }
|
||||
};
|
||||
animationPicker.SelectedIndexChanged += OnEasingPickerSelectedIndexChanged;
|
||||
return animationPicker;
|
||||
|
||||
animationPicker.SelectedIndexChanged += OnEasingPickerSelectedIndexChanged;
|
||||
|
||||
return animationPicker;
|
||||
}
|
||||
Slider PopupAnimationLengthSlider()
|
||||
{
|
||||
@@ -102,7 +107,6 @@ public class TestPage : ContentPage
|
||||
|
||||
return animationSlider;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void OnEasingPickerSelectedIndexChanged(object sender, EventArgs e)
|
||||
@@ -111,6 +115,7 @@ public class TestPage : ContentPage
|
||||
int selectedIndex = picker.SelectedIndex;
|
||||
AnimationType = selectedIndex;
|
||||
}
|
||||
|
||||
void OnAnimationPickerSelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
var picker = (Picker)sender;
|
||||
@@ -123,8 +128,6 @@ public class TestPage : ContentPage
|
||||
AnimationLength = args.NewValue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static Button GeneratePopupButton(string buttonText, AsyncCommand buttonCommand)
|
||||
{
|
||||
return new Button
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
using SampleMaui;
|
||||
|
||||
|
||||
[Register("AppDelegate")]
|
||||
public class AppDelegate : MauiUIApplicationDelegate
|
||||
{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Mopups.Pages;
|
||||
|
||||
namespace SampleMopups.XAML;
|
||||
|
||||
public partial class AswinPage : PopupPage
|
||||
{
|
||||
public AswinPage()
|
||||
@@ -10,7 +11,6 @@ public partial class AswinPage : PopupPage
|
||||
|
||||
private void PopupPage_BackgroundClicked(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private async void blahButton_Clicked(object sender, EventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user