Skip to content

Commit

Permalink
Android renderers + maui sample ok!
Browse files Browse the repository at this point in the history
  • Loading branch information
roubachof committed Oct 7, 2022
1 parent 2a5d8e6 commit 7e1eb5f
Show file tree
Hide file tree
Showing 60 changed files with 397 additions and 221 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Docs/** filter=lfs diff=lfs merge=lfs -text
Binary file modified Docs/DragAndDropEnabled.mp4
Binary file not shown.
3 changes: 3 additions & 0 deletions Docs/MAUI/footer_android.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions Docs/MAUI/grid_android.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions Docs/MAUI/header_android.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions Docs/MAUI/horizontal_android.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions Docs/MAUI/main_android.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions Docs/MAUI/vertical_android.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Docs/demo.mp4
Binary file not shown.
Binary file modified Docs/drag_enabled_animation.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Docs/drag_grid.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Docs/drag_vertical.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Docs/footer_android.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Docs/github_banner.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Docs/github_banner.pdn
Binary file not shown.
Binary file modified Docs/github_banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Docs/group_ios.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Docs/header_android.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Docs/header_demo.mp4
Binary file not shown.
Binary file modified Docs/header_demo_320.mp4
Binary file not shown.
Binary file modified Docs/hlv_carousel_iphone.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Docs/hlv_drag_android.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Docs/hlv_drag_iphone.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Docs/hlv_grid_android.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Docs/hlv_grid_iphone.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Docs/hlv_horizontal_android.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Docs/hlv_horizontal_android_col2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Docs/hlv_horizontal_iphone.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Docs/hlv_vertical_android.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Docs/hlv_vertical_iphone.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Docs/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Docs/logo_big.png
Binary file modified Docs/logo_maui.png
Binary file modified Docs/logo_maui_big.png
Binary file modified Docs/reveal.gif
Binary file modified Docs/scv_grid_android.png
Binary file modified Docs/scv_horizontal_ios.jpg
Binary file modified Docs/video.mp4
Binary file not shown.
6 changes: 5 additions & 1 deletion Maui/MauiSample/MauiProgram.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

using Sharpnado.CollectionView;
using Sharpnado.Tabs;
using SkiaSharp.Views.Maui.Controls.Hosting;

namespace MauiSample;

Expand All @@ -15,13 +16,16 @@ public static MauiApp CreateMauiApp()
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.UseSkiaSharp()
.UseSharpnadoTabs(loggerEnable: false)
.UseSharpnadoCollectionView(loggerEnable: false)
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
fonts.AddFont("ka1.ttf", "KarmaticFont");
fonts.AddFont("Road_Rage.otf", "RoadRage");
fonts.AddFont("ka1.ttf", "KarmaticFont");
});

return builder.Build();
Expand Down
2 changes: 2 additions & 0 deletions Maui/MauiSample/MauiSample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@

<!-- Images -->
<MauiImage Include="Resources\Images\*" />
<MauiImage Update="Resources\Images\cocktail.png" BaseSize="80,80" TintColor="#FF0266" />
<MauiImage Update="Resources\Images\island.png" BaseSize="80,80" TintColor="#FF0266" />
<MauiImage Update="Resources\Images\dotnet_bot.svg" BaseSize="168,208" />

<!-- Custom Fonts -->
Expand Down
6 changes: 3 additions & 3 deletions Maui/MauiSample/Platforms/Android/Resources/values/colors.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#512BD4</color>
<color name="colorPrimaryDark">#2B0B98</color>
<color name="colorAccent">#2B0B98</color>
<color name="colorPrimary">#FF0266</color>
<color name="colorPrimaryDark">#323232</color>
<color name="colorAccent">#FF0266</color>
</resources>
4 changes: 3 additions & 1 deletion Maui/MauiSample/Presentation/Converters/IsNullConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace MauiSample.Presentation.Converters
{
public class IsNullConverter : IValueConverter
public class IsNullConverter : IValueConverter, IMarkupExtension
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
Expand All @@ -13,5 +13,7 @@ public object ConvertBack(object value, Type targetType, object parameter, Cultu
{
throw new NotImplementedException();
}

public object ProvideValue(IServiceProvider serviceProvider) => this;
}
}
24 changes: 24 additions & 0 deletions Maui/MauiSample/Presentation/Converters/NotConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System.Globalization;

namespace MauiSample.Presentation.Converters
{
public class NotConverter : IValueConverter, IMarkupExtension
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is bool boolValue)
{
return !boolValue;
}

return false;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}

public object ProvideValue(IServiceProvider serviceProvider) => this;
}
}
12 changes: 7 additions & 5 deletions Maui/MauiSample/Presentation/ViewModels/ChoosePageViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
namespace MauiSample.Presentation.ViewModels
using System.Collections.ObjectModel;

namespace MauiSample.Presentation.ViewModels
{
public class ChoosePageViewModel
{
public ChoosePageViewModel()
{
}

public LogoLetterVmo[] Logo { get; } =
{
public ObservableCollection<LogoLetterVmo> Logo { get; } = new()
{
new LogoLetterVmo("S", Color.FromHex("#FF0266"), "ShadowAccentBottom"),
new LogoLetterVmo("H", Colors.White, "ShadowNeumorphismBottom"),
new LogoLetterVmo("V", Colors.White, "ShadowNeumorphismBottom"),
new LogoLetterVmo("L", Colors.White, "ShadowNeumorphismBottom"),
new LogoLetterVmo("G", Colors.White, "ShadowNeumorphismBottom"),
new LogoLetterVmo("", Colors.White, "ShadowNeumorphismBottom"),
new LogoLetterVmo("", Color.FromHex("#FF0266"), "ShadowNeumorphismBottom", 32, "island.png"),
new LogoLetterVmo("V", Colors.White, "ShadowNeumorphismBottom"),
new LogoLetterVmo("", Colors.White, "ShadowNeumorphismBottom"),
new LogoLetterVmo("", Color.FromHex("#FF0266"), "ShadowNeumorphismBottom", 32, "cocktail.png"),
new LogoLetterVmo("V", Colors.White, "ShadowNeumorphismBottom"),
};
}
Expand Down
15 changes: 14 additions & 1 deletion Maui/MauiSample/Presentation/ViewModels/LogoLetterVmo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,30 @@
{
public class LogoLetterVmo
{
public LogoLetterVmo(string text, Color color, string shadowResourceName)
public LogoLetterVmo(
string text,
Color color,
string shadowResourceName,
double fontSize = 90,
string imageSource = null)
{
Text = text;
TextColor = color;
ShadowResourceName = shadowResourceName;
FontSize = fontSize;
ImageSource = imageSource;
}

public string Text { get; }

public Color TextColor { get; }

public string ShadowResourceName { get; }

public double FontSize { get; }

public string ImageSource { get; }

public bool HasImage => ImageSource != null;
}
}
122 changes: 74 additions & 48 deletions Maui/MauiSample/Presentation/Views/ChoosePage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@
FontSize="30"
Text="CollectionView"
TextColor="White" />

<Label
Grid.Row="0"
Grid.RowSpan="2"
Margin="205,12,0,0"
FontFamily="RoadRage"
FontSize="30"
Rotation="-10"
Text="MAUI"
TextColor="{StaticResource Accent}" />
</Grid>
</StackLayout>

Expand All @@ -50,35 +60,51 @@
HeightRequest="360"
ItemHeight="110"
ItemsSource="{Binding Logo, Mode=OneTime}"
VerticalOptions="Fill">
VerticalOptions="Fill"
ZIndex="100">
<sho:GridView.ItemTemplate>
<DataTemplate x:DataType="viewModels:LogoLetterVmo">
<sho:DraggableViewCell x:Name="DraggableViewCell">
<ContentView>
<Border Shadow="{StaticResource ShadowNeumorphismTop}" StrokeShape="RoundRectangle 10">
<Border
Margin="8"
Padding="0"
Shadow="{Binding ShadowResourceName, Converter={converters:StringToResource}}"
StrokeShape="RoundRectangle 10">
<Border.Triggers>
<DataTrigger
Binding="{Binding Source={x:Reference DraggableViewCell}, Path=IsDragAndDropping}"
TargetType="Border"
Value="True">
<Setter Property="BackgroundColor" Value="{StaticResource DarkSurface}" />
</DataTrigger>
</Border.Triggers>
<Border.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
<GradientStop Offset="0.1" Color="#3a3a3a" />
<GradientStop Offset="0.9" Color="#2b2b2b" />
</LinearGradientBrush>
</Border.Background>
<Border
Margin="8"
Padding="0"
Shadow="{Binding ShadowResourceName, Converter={converters:StringToResource}}"
StrokeShape="RoundRectangle 10"
StrokeThickness="0">
<Border.Triggers>
<DataTrigger
Binding="{Binding Source={x:Reference DraggableViewCell}, Path=IsDragAndDropping}"
TargetType="Border"
Value="True">
<Setter Property="BackgroundColor" Value="{StaticResource DarkSurface}" />
</DataTrigger>
</Border.Triggers>
<Border.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
<GradientStop Offset="0.1" Color="#3a3a3a" />
<GradientStop Offset="0.9" Color="#2b2b2b" />
</LinearGradientBrush>
</Border.Background>
<Grid>
<Image
HorizontalOptions="Center"
IsVisible="{Binding HasImage}"
Source="{Binding ImageSource}"
VerticalOptions="Center">
<Image.Shadow>
<Shadow
Brush="{StaticResource Primary}"
Opacity="1"
Radius="15" />
</Image.Shadow>
</Image>
<Label
FontAttributes="Bold"
FontSize="90"
FontSize="{Binding FontSize}"
HorizontalOptions="Center"
HorizontalTextAlignment="Center"
IsVisible="{Binding ImageSource, Converter={converters:IsNullConverter}}"
Style="{StaticResource TextHeadline}"
Text="{Binding Text}"
TextColor="{Binding TextColor}"
Expand All @@ -91,40 +117,40 @@
</OnPlatform>
</Label.Margin>
</Label>
</Border>
</Grid>
</Border>
</ContentView>
</sho:DraggableViewCell>
</DataTemplate>
</sho:GridView.ItemTemplate>
</sho:GridView>

<StackLayout Margin="0,30" Spacing="20">
<Border Shadow="{StaticResource ShadowNeumorphismTop}" StrokeShape="RoundRectangle 10">
<Button
x:Name="LayoutButton"
BackgroundColor="{StaticResource DarkSurface}"
Clicked="LayoutButton_OnClicked"
CornerRadius="10"
HorizontalOptions="Center"
Shadow="{StaticResource ShadowNeumorphismBottom}"
Text="Layout Examples"
TextColor="White"
WidthRequest="260" />
</Border>
<StackLayout
Margin="0,30"
Spacing="20"
ZIndex="10">
<Button
x:Name="LayoutButton"
BackgroundColor="{StaticResource DarkSurface}"
Clicked="LayoutButton_OnClicked"
CornerRadius="10"
HorizontalOptions="Center"
Shadow="{StaticResource ShadowNeumorphismBottom}"
Text="Layout Examples"
TextColor="White"
WidthRequest="260" />

<Button
x:Name="HeaderButton"
BackgroundColor="{StaticResource DarkSurface}"
Clicked="HeaderButton_OnClicked"
CornerRadius="10"
HorizontalOptions="Center"
Shadow="{StaticResource ShadowNeumorphismBottom}"
Text="Header and Grouping Example"
TextColor="White"
WidthRequest="260" />

<Border Shadow="{StaticResource ShadowNeumorphismTop}" StrokeShape="RoundRectangle 10">
<Button
x:Name="HeaderButton"
BackgroundColor="{StaticResource DarkSurface}"
Clicked="HeaderButton_OnClicked"
CornerRadius="10"
HorizontalOptions="Center"
Shadow="{StaticResource ShadowNeumorphismBottom}"
Text="Header and Grouping Example"
TextColor="White"
WidthRequest="260" />
</Border>
</StackLayout>

</StackLayout>
Expand Down
Loading

0 comments on commit 7e1eb5f

Please sign in to comment.