-
-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2a365ff
commit 6184339
Showing
14 changed files
with
241 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
src/Microsoft.Maui.FabCompat/NavigationView/INavigationViewEx.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
namespace Microsoft.Maui; | ||
|
||
public interface INavigationViewEx : IView | ||
{ | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
src/Microsoft.Maui.FabCompat/NavigationView/INavigationViewExHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#if __IOS__ || MACCATALYST | ||
using PlatformView = UIKit.UIView; | ||
#elif ANDROID | ||
using PlatformView = Android.Views.View; | ||
#elif WINDOWS | ||
using PlatformView = Microsoft.UI.Xaml.Controls.Frame; | ||
#elif TIZEN | ||
using PlatformView = Microsoft.Maui.Platform.StackNavigationManager; | ||
#elif (NETSTANDARD || !PLATFORM) || (NET6_0_OR_GREATER && !IOS && !ANDROID && !TIZEN) | ||
using PlatformView = System.Object; | ||
#endif | ||
|
||
namespace Microsoft.Maui.Handlers; | ||
|
||
public interface INavigationViewExHandler : IViewHandler | ||
{ | ||
new INavigationViewEx VirtualView { get; } | ||
new PlatformView PlatformView { get; } | ||
|
||
void Push(IView view, bool animated); | ||
void Pop(bool animated); | ||
void InsertAt(int index, IView view); | ||
void RemoveAt(int index); | ||
} |
11 changes: 0 additions & 11 deletions
11
src/Microsoft.Maui.FabCompat/NavigationView/INavigationViewHandler.cs
This file was deleted.
Oops, something went wrong.
34 changes: 34 additions & 0 deletions
34
src/Microsoft.Maui.FabCompat/NavigationView/NavigationViewExHandler.Android.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using System; | ||
using Android.Runtime; | ||
using Android.Views; | ||
using AndroidX.Fragment.App; | ||
|
||
namespace Microsoft.Maui.Handlers; | ||
|
||
public partial class NavigationViewExHandler : ViewHandler<INavigationViewEx, View> | ||
{ | ||
protected override View CreatePlatformView() | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public void Push(IView view, bool animated) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public void Pop(bool animated) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public void InsertAt(int index, IView view) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public void RemoveAt(int index) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/Microsoft.Maui.FabCompat/NavigationView/NavigationViewExHandler.Standard.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
namespace Microsoft.Maui.Handlers; | ||
|
||
public partial class NavigationViewExHandler : ViewHandler<INavigationViewEx, object> | ||
{ | ||
protected override object CreatePlatformView() => throw new NotImplementedException(); | ||
|
||
public void Push(IView view, bool animated) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public void Pop(bool animated) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public void InsertAt(int index, IView view) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public void RemoveAt(int index) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} |
81 changes: 81 additions & 0 deletions
81
src/Microsoft.Maui.FabCompat/NavigationView/NavigationViewExHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
#if __IOS__ || MACCATALYST | ||
using PlatformView = UIKit.UIView; | ||
#elif ANDROID | ||
using PlatformView = Android.Views.View; | ||
#elif WINDOWS | ||
using PlatformView = Microsoft.UI.Xaml.Controls.Frame; | ||
#elif TIZEN | ||
using PlatformView = Microsoft.Maui.Platform.StackNavigationManager; | ||
#elif (NETSTANDARD || !PLATFORM) || (NET6_0_OR_GREATER && !IOS && !ANDROID && !TIZEN) | ||
using PlatformView = System.Object; | ||
#endif | ||
|
||
namespace Microsoft.Maui.Handlers; | ||
|
||
public record NavigationHandlerPushUpdate(IView View, bool Animated); | ||
public record NavigationHandlerPopUpdate(bool Animated); | ||
public record NavigationHandlerInsertUpdate(int Index, IView View); | ||
public record NavigationHandlerRemoveUpdate(int Index); | ||
|
||
public partial class NavigationViewExHandler: INavigationViewExHandler | ||
{ | ||
public static IPropertyMapper<INavigationViewEx, INavigationViewExHandler> Mapper = new PropertyMapper<INavigationViewEx, INavigationViewExHandler>(ViewHandler.ViewMapper) | ||
{ | ||
}; | ||
|
||
public static CommandMapper<INavigationViewEx, INavigationViewExHandler> CommandMapper = new(ViewHandler.ViewCommandMapper) | ||
{ | ||
[nameof(INavigationViewExHandler.Push)] = MapPush, | ||
[nameof(INavigationViewExHandler.Pop)] = MapPop, | ||
[nameof(INavigationViewExHandler.InsertAt)] = MapInsertAt, | ||
[nameof(INavigationViewExHandler.RemoveAt)] = MapRemoveAt | ||
}; | ||
|
||
public NavigationViewExHandler() : base(Mapper, CommandMapper) | ||
{ | ||
} | ||
|
||
public NavigationViewExHandler(IPropertyMapper? mapper = null) : base(mapper ?? Mapper, CommandMapper) | ||
{ | ||
} | ||
|
||
public NavigationViewExHandler(IPropertyMapper? mapper = null, CommandMapper? commandMapper = null) : base(mapper ?? Mapper, commandMapper ?? CommandMapper) | ||
{ | ||
} | ||
|
||
INavigationViewEx INavigationViewExHandler.VirtualView => VirtualView; | ||
|
||
PlatformView INavigationViewExHandler.PlatformView => PlatformView; | ||
|
||
private static void MapPush(INavigationViewExHandler handler, INavigationViewEx view, object? arg) | ||
{ | ||
if (arg is NavigationHandlerPushUpdate args) | ||
{ | ||
handler.Push(args.View, args.Animated); | ||
} | ||
} | ||
|
||
private static void MapPop(INavigationViewExHandler handler, INavigationViewEx view, object? arg) | ||
{ | ||
if (arg is NavigationHandlerPopUpdate args) | ||
{ | ||
handler.Pop(args.Animated); | ||
} | ||
} | ||
|
||
private static void MapInsertAt(INavigationViewExHandler handler, INavigationViewEx view, object? arg) | ||
{ | ||
if (arg is NavigationHandlerInsertUpdate args) | ||
{ | ||
handler.InsertAt(args.Index, args.View); | ||
} | ||
} | ||
|
||
private static void MapRemoveAt(INavigationViewExHandler handler, INavigationViewEx view, object? arg) | ||
{ | ||
if (arg is NavigationHandlerRemoveUpdate args) | ||
{ | ||
handler.RemoveAt(args.Index); | ||
} | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
src/Microsoft.Maui.FabCompat/NavigationView/NavigationViewExHandler.iOS.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
using Microsoft.Maui.Platform; | ||
|
||
namespace Microsoft.Maui.Handlers; | ||
|
||
public partial class NavigationViewExHandler : ViewHandler<INavigationViewEx, UIView> | ||
{ | ||
private UINavigationController? _navigationController; | ||
|
||
protected override UIView CreatePlatformView() | ||
{ | ||
_navigationController = new UINavigationController(); | ||
return _navigationController?.View; | ||
} | ||
|
||
public void Push(IView view, bool animated) | ||
{ | ||
_navigationController?.PushViewController(view.ToThemeEnabledUIViewController(this.MauiContext), animated); | ||
} | ||
|
||
public void Pop(bool animated) | ||
{ | ||
_navigationController?.PopViewController(animated); | ||
} | ||
|
||
public void InsertAt(int index, IView view) | ||
{ | ||
var temp = new List<UIViewController>(); | ||
|
||
for(var i = index; i < _navigationController?.ViewControllers.Length; i++) | ||
{ | ||
var popped = _navigationController?.PopViewController(false); | ||
temp.Add(popped); | ||
} | ||
|
||
_navigationController?.PushViewController(view.ToThemeEnabledUIViewController(this.MauiContext), false); | ||
|
||
foreach(var item in temp) | ||
{ | ||
_navigationController?.PushViewController(item, false); | ||
} | ||
} | ||
|
||
public void RemoveAt(int index) | ||
{ | ||
var temp = new List<UIViewController>(); | ||
|
||
for(var i = index + 1; i < _navigationController?.ViewControllers.Length; i++) | ||
{ | ||
var popped = _navigationController?.PopViewController(false); | ||
temp.Add(popped); | ||
} | ||
|
||
_navigationController?.PopViewController(false); | ||
|
||
foreach(var item in temp) | ||
{ | ||
_navigationController?.PushViewController(item, false); | ||
} | ||
} | ||
} |
29 changes: 0 additions & 29 deletions
29
src/Microsoft.Maui.FabCompat/NavigationView/NavigationViewHandler.cs
This file was deleted.
Oops, something went wrong.
21 changes: 0 additions & 21 deletions
21
src/Microsoft.Maui.FabCompat/NavigationView/NavigationViewHandler.iOS.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters