Skip to content

Commit 941eb55

Browse files
authored
Merge pull request #64 from RadekVyM/dev
Core 6.0.0 and SimpleShell 5.0.0
2 parents a243304 + e0a10ae commit 941eb55

File tree

235 files changed

+1177
-4426
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

235 files changed

+1177
-4426
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Here are some of my samples that were built using this library:
3030
<a href="https://github.com/RadekVyM/MarvelousMAUI"><em>Marvelous .NET MAUI</em></a>
3131
</p>
3232
<p align="center">
33-
<img src="https://raw.githubusercontent.com/RadekVyM/Gadgets-Store-App/main/samples/ios_gadgets_store_app.gif" width="239" />
33+
<img src="https://raw.githubusercontent.com/RadekVyM/Gadgets-Store-App/main/samples/android_gadgets_store_app.webp" width="234" />
3434
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
3535
<img src="https://raw.githubusercontent.com/RadekVyM/Bet-App/main/Images/ios_betapp.webp" width="236" />
3636
</p>
@@ -121,4 +121,4 @@ builder.UseSimpleShell();
121121
- A `SimpleShell`-based application may not have as good accessibility in some scenarios due to the lack of platform-specific navigation controls. .NET MAUI `Shell` should be accessible out of the box since it uses platform-specific controls.
122122
- Maybe I have implemented something wrong that has a negative impact on the performance, stability, accessibility, or something like that.
123123

124-
See [documentation](./docs/SimpleToolkit.SimpleShell) for more information.
124+
See [documentation](./docs/SimpleToolkit.SimpleShell) for more information.

docs/Samples.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# List of Samples Built Using SimpleToolkit
1+
# List of samples built using SimpleToolkit
22

33
## [Marvelous .NET MAUI](https://github.com/RadekVyM/MarvelousMAUI)
44
**.NET MAUI clone** of the [Wonderous app](https://flutter.gskinner.com/wonderous/) - a visual showcase of **eight wonders of the world** made with [Flutter](https://github.com/flutter/flutter) by the team at [gskinner](https://gskinner.com/).
@@ -7,9 +7,9 @@ https://github.com/RadekVyM/MarvelousMAUI/assets/65116078/3a6b59a0-e48f-4af4-b16
77

88
## [Gadget Store App](https://github.com/RadekVyM/Gadgets-Store-App)
99

10-
**.NET MAUI** implementation of [Gadgets Store App](https://dribbble.com/shots/6983164-Gadgets-Store-App) design by [Sajon](https://dribbble.com/sajon007):
10+
**.NET MAUI** prototype of an e-shop app inspired by the [Gadgets Store App](https://dribbble.com/shots/6983164-Gadgets-Store-App) design by [Sajon](https://dribbble.com/sajon):
1111

12-
https://github.com/RadekVyM/Gadgets-Store-App/assets/65116078/332aa779-861b-44b2-be1f-6a53dc730fae
12+
https://github.com/user-attachments/assets/025ca22d-3ca0-4d67-95aa-8e3b6bc14ddf
1313

1414
# [Bet App](https://github.com/RadekVyM/Bet-App)
1515

@@ -31,18 +31,18 @@ https://github.com/RadekVyM/HamburgerMenuApp/assets/65116078/e4db39c0-8c6f-4ff7-
3131

3232
## [Navbar Animation #1](https://github.com/RadekVyM/Navbar-Animation-1)
3333

34-
**.NET MAUI** implementation of [Navbar Animation #1](https://dribbble.com/shots/9852644-Navbar-Animation-1) design by [Marie Bernard](https://dribbble.com/marie_brn):
34+
**.NET MAUI** tab bar inspired by the [Navbar Animation #1](https://dribbble.com/shots/9852644-Navbar-Animation-1) design by [Marie Bernard](https://dribbble.com/marie_brn):
3535

36-
https://github.com/RadekVyM/Navbar-Animation-1/assets/65116078/ea396db0-98b7-4412-9eaf-56203ffeb3ee
36+
https://github.com/user-attachments/assets/70a8f41f-7645-4841-b119-cace4dfee0aa
3737

3838
## [Navbar Animation #2](https://github.com/RadekVyM/Navbar-Animation-2)
3939

40-
**.NET MAUI** implementation of [Navbar Animation #2](https://dribbble.com/shots/14122275-Navbar-Animation-2) design by [Marie Bernard](https://dribbble.com/marie_brn):
40+
**.NET MAUI** tab bar inspired by the [Navbar Animation #2](https://dribbble.com/shots/14122275-Navbar-Animation-2) design by [Marie Bernard](https://dribbble.com/marie_brn):
4141

42-
https://github.com/RadekVyM/Navbar-Animation-2/assets/65116078/28e3f2b3-4e61-4471-b7c4-2d6d6d89794d
42+
https://github.com/user-attachments/assets/0e52fe5a-61c1-4815-a311-1b8fec02d6e0
4343

4444
## [Tab Bar Switches Interaction](https://github.com/RadekVyM/Tab-Bar-Switches-Interaction)
4545

46-
**.NET MAUI** implementation of [Tab Bar Switches Interaction](https://dribbble.com/shots/14028381-Tab-Bar-Switches-Interaction) design by [Ronas IT | UI/UX Team](https://dribbble.com/ronasit):
46+
**.NET MAUI** tab bar inspired by the [Tab Bar Switches Interaction](https://dribbble.com/shots/14028381-Tab-Bar-Switches-Interaction) design by [Ronas IT | UI/UX Team](https://dribbble.com/ronasit):
4747

48-
https://github.com/RadekVyM/Tab-Bar-Switches-Interaction/assets/65116078/047f33ff-80e2-4432-b142-05cffe6b59bc
48+
https://github.com/user-attachments/assets/3381a7d4-312a-4a92-a449-b5bfd0866fd7

docs/SimpleToolkit.SimpleShell/README.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -565,12 +565,6 @@ The yellow and green pages are grouped under one tab:
565565
</tr>
566566
</table>
567567

568-
## Disconnecting page handlers
569-
570-
`SimpleShell` automatically calls the `DisconnectHandler()` method on all [handlers](https://learn.microsoft.com/dotnet/maui/user-interface/handlers) of pages that are being removed from a navigation stack. For example, when you pop a page from a navigation stack, the `DisconnectHandler()` method is called on its handler.
571-
572-
This behavior can be disabled on a per-page basis with the `SimpleShell.ShouldAutoDisconnectPageHandler` attached property. Just set this property on the page to `false` if you do not want its handler to be automatically disconnected.
573-
574568
## Transitions
575569

576570
`SimpleShell` allows you to define custom transitions between pages during navigation:

src/Playground/Playground.Original/App.xaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<?xml version = "1.0" encoding = "UTF-8" ?>
2-
<Application xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
3-
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
4-
xmlns:local="clr-namespace:Playground.Original"
5-
x:Class="Playground.Original.App">
2+
<Application
3+
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
5+
xmlns:local="clr-namespace:Playground.Original"
6+
x:Class="Playground.Original.App">
67
<Application.Resources>
78
<ResourceDictionary>
89
<ResourceDictionary.MergedDictionaries>

src/Playground/Playground.Original/App.xaml.cs

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,32 @@
22

33
public enum AppShellType
44
{
5-
Normal, Playground
5+
Normal, Playground, Containers, NoTabs, ShellItems
66
}
77

88
public partial class App : Application
99
{
1010
public App()
1111
{
1212
InitializeComponent();
13-
14-
RefreshShell(MauiProgram.UsedAppShell);
1513
}
1614

1715
public void RefreshShell(AppShellType type)
1816
{
19-
MainPage = type switch
20-
{
21-
AppShellType.Normal => new NormalAppShell(),
22-
_ => new PlaygroundAppShell()
23-
};
17+
Shell.Current.Window.Page = GetShellPage(type);
18+
}
19+
20+
protected override Window CreateWindow(IActivationState? activationState)
21+
{
22+
return new Window(GetShellPage(MauiProgram.UsedAppShell));
2423
}
24+
25+
private static Page GetShellPage(AppShellType type) => type switch
26+
{
27+
AppShellType.Normal => new NormalAppShell(),
28+
AppShellType.Containers => new ContainersShell(),
29+
AppShellType.NoTabs => new NoTabsShell(),
30+
AppShellType.ShellItems => new ShellItemsShell(),
31+
_ => new PlaygroundAppShell()
32+
};
2533
}

src/Playground/Playground.Original/Behaviors/TestBehavior.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
public class TestBehavior : Behavior<View>
44
{
5-
View attachedBindable;
5+
private View? attachedBindable;
66

77
public void Test()
88
{

src/Playground/SimpleShell/Playground.Containers/AppShell.xaml renamed to src/Playground/Playground.Original/ContainersShell.xaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
<?xml version="1.0" encoding="UTF-8" ?>
1+
<?xml version="1.0" encoding="utf-8" ?>
22
<shell:SimpleShell
3-
x:Class="Playground.Containers.AppShell"
43
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
54
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
6-
xmlns:local="clr-namespace:Playground.Containers"
7-
xmlns:pages="clr-namespace:Playground.Core.Views.Pages;assembly=Playground.Core"
5+
x:Class="Playground.Original.ContainersShell"
6+
xmlns:local="clr-namespace:Playground.Original"
7+
xmlns:pages="clr-namespace:Playground.Original.Views.Pages"
88
xmlns:shell="clr-namespace:SimpleToolkit.SimpleShell;assembly=SimpleToolkit.SimpleShell"
99
x:Name="thisShell"
1010
Title="Playground.Containers"
@@ -51,7 +51,7 @@
5151
<HorizontalStackLayout
5252
x:Name="tabBar"
5353
Margin="20,5"
54-
BindableLayout.ItemsSource="{Binding ShellContents, Source={x:Reference thisShell}}"
54+
BindableLayout.ItemsSource="{Binding ShellContents, Source={x:Reference thisShell}, x:DataType={x:Type local:ContainersShell}}"
5555
HorizontalOptions="Center"
5656
MinimumHeightRequest="40"
5757
Spacing="10">
@@ -105,7 +105,7 @@
105105
FontAttributes="Bold"
106106
FontSize="18"
107107
HorizontalOptions="Center"
108-
Text="{Binding CurrentShellContent.Title, Source={x:Reference thisShell}}"
108+
Text="{Binding CurrentShellContent.Title, Source={x:Reference thisShell}, x:DataType={x:Type local:ContainersShell}}"
109109
VerticalOptions="Center" />
110110

111111
<shell:SimpleNavigationHost Grid.Row="5" />

src/Playground/SimpleShell/Playground.Containers/AppShell.xaml.cs renamed to src/Playground/Playground.Original/ContainersShell.xaml.cs

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
using Playground.Containers.Extensions;
2-
using Playground.Core.Views.Pages;
1+
using Playground.Original.Extensions;
2+
using Playground.Original.Views.Pages;
3+
using SimpleToolkit.Core;
34
using SimpleToolkit.SimpleShell;
45

56
#if ANDROID
@@ -10,26 +11,45 @@
1011
using PlatformContainer = Microsoft.UI.Xaml.Controls.Panel;
1112
#endif
1213

13-
namespace Playground.Containers;
14+
namespace Playground.Original;
1415

15-
public partial class AppShell : SimpleShell
16+
public partial class ContainersShell : SimpleShell
1617
{
1718
private int itemContainerIndex = 0;
1819
private int firstTabContainerIndex = 0;
1920
private int secondTabContainerIndex = 0;
2021

2122

22-
public AppShell()
23-
{
24-
Routing.RegisterRoute(nameof(FirstYellowDetailPage), typeof(FirstYellowDetailPage));
23+
public ContainersShell()
24+
{
25+
Routing.RegisterRoute(nameof(FirstYellowDetailPage), typeof(FirstYellowDetailPage));
2526
Routing.RegisterRoute(nameof(SecondYellowDetailPage), typeof(SecondYellowDetailPage));
2627
Routing.RegisterRoute(nameof(ThirdYellowDetailPage), typeof(ThirdYellowDetailPage));
2728
Routing.RegisterRoute(nameof(FourthYellowDetailPage), typeof(FourthYellowDetailPage));
2829
Routing.RegisterRoute(nameof(FirstGreenDetailPage), typeof(FirstGreenDetailPage));
2930

3031
InitializeComponent();
3132

33+
Loaded += AppShellLoaded;
34+
Unloaded += AppShellUnloaded;
35+
3236
Navigated += AppShellNavigated;
37+
}
38+
39+
40+
private void AppShellLoaded(object? sender, EventArgs e)
41+
{
42+
Window.SubscribeToSafeAreaChanges(OnSafeAreaChanged);
43+
}
44+
45+
private void AppShellUnloaded(object? sender, EventArgs e)
46+
{
47+
Window.UnsubscribeFromSafeAreaChanges(OnSafeAreaChanged);
48+
}
49+
50+
private void OnSafeAreaChanged(Thickness safeAreaPadding)
51+
{
52+
contentContainer.Padding = safeAreaPadding;
3353
}
3454

3555
private async void AppShellNavigated(object? sender, ShellNavigatedEventArgs e)
@@ -115,9 +135,8 @@ private string GetContainerStats(IView? container)
115135
private async void ShellItemButtonClicked(object sender, EventArgs e)
116136
{
117137
var button = sender as Button;
118-
var shellItem = button?.BindingContext as BaseShellItem;
119138

120-
if (shellItem is null)
139+
if (button?.BindingContext is not BaseShellItem shellItem)
121140
return;
122141

123142
// Navigate to a new tab if it is not the current tab
@@ -170,4 +189,4 @@ private void RefreshClicked(object sender, EventArgs e)
170189
{
171190
UpdateStats();
172191
}
173-
}
192+
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
using System.Globalization;
1+
using System.Globalization;
22

3-
namespace Playground.ShellItems.Converters;
3+
namespace Playground.Original.Converters;
44

55
public class EqualsConverter : IMultiValueConverter
66
{
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
using SimpleToolkit.SimpleShell;
1+
using SimpleToolkit.SimpleShell;
22

3-
namespace Playground.Containers.Extensions;
3+
namespace Playground.Original.Extensions;
44

55
public static class ViewExtensions
66
{

0 commit comments

Comments
 (0)