Skip to content

Commit

Permalink
Fix Essentials sample (#108)
Browse files Browse the repository at this point in the history
* Fix Essentials sample for Tizen

* Remove UseSkiaSharp flag

* Remove MaterialComponents

* Fix Tizen flag

* Remove CustomRenderer
  • Loading branch information
sung-su authored and rookiejava committed Jan 17, 2022
1 parent 3df4cea commit 453033c
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 39 deletions.
3 changes: 2 additions & 1 deletion src/Essentials/samples/Samples/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ public App()
VersionTracking.Track();

MainPage = new NavigationPage(new HomePage());

#if !TIZEN
SetUpAppActions();
#endif
}

async void SetUpAppActions()
Expand Down
7 changes: 6 additions & 1 deletion src/Essentials/samples/Samples/Essentials.Sample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
<PackageReference Include="Microsoft.WindowsAppSDK" />
</ItemGroup>

<ItemGroup Condition="'$(UseMaui)' != 'true' and $(TargetFramework.Contains('-tizen'))">
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" ExcludeAssets="runtime" />
<PackageReference Include="Tizen.NET" Version="8.0.0.15631" />
</ItemGroup>

<ItemGroup Condition=" '$(UseMaui)' != 'true' ">
<ProjectReference Include="..\..\..\Essentials\src\Essentials-net6.csproj" />
<ProjectReference Include="..\..\..\Core\src\Core-net6.csproj" />
Expand All @@ -43,4 +48,4 @@
<RuntimeIdentifier Condition="$(TargetFramework.Contains('-maccatalyst'))">maccatalyst-x64</RuntimeIdentifier>
</PropertyGroup>

</Project>
</Project>

This file was deleted.

15 changes: 3 additions & 12 deletions src/Essentials/samples/Samples/Platforms/Tizen/Program.cs
Original file line number Diff line number Diff line change
@@ -1,24 +1,15 @@
using Microsoft.Maui;
using Microsoft.Maui.Controls;
using Tizen.NET.MaterialComponents;
using Xamarin.Forms.Platform.Tizen;

namespace Samples.Tizen
{
class Program : MauiApplication<Startup>
class Program : MauiApplication
{
protected override void OnCreate()
{
base.OnCreate();

MaterialComponents.Init(DirectoryInfo.Resource);
Microsoft.Maui.Essentials.Platform.Init(CoreUIAppContext.GetInstance(this).MainWindow);
}
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();

static void Main(string[] args)
{
var app = new Program();
app.Run(args);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.microsoft.maui.essentials" version="1.0.0" api-version="4" xmlns="http://tizen.org/ns/packages">
<profile name="common" />
<ui-application appid="com.microsoft.maui.essentials" exec="Essentials.Samples.Tizen.dll" multiple="false" nodisplay="false" taskmanage="true" type="dotnet" splash-screen-display="true" launch_mode="single">
<ui-application appid="com.microsoft.maui.essentials" exec="Microsoft.Maui.Essentials.Sample.dll" multiple="false" nodisplay="false" taskmanage="true" type="dotnet" splash-screen-display="true" launch_mode="single">
<label>Essentials</label>
<icon>Samples.Tizen.png</icon>
<metadata key="http://tizen.org/metadata/prefer_dotnet_aot" value="true" />
Expand Down
18 changes: 16 additions & 2 deletions src/Essentials/samples/Samples/Startup.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using Microsoft.Maui;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Maui;
using Microsoft.Maui.Controls.Compatibility;
using Microsoft.Maui.Controls.Hosting;
using Microsoft.Maui.Hosting;
using Microsoft.Maui.LifecycleEvents;
Expand All @@ -15,8 +17,20 @@ public static MauiApp CreateMauiApp()
Microsoft.Maui.Essentials.Platform.MapServiceToken =
"RJHqIE53Onrqons5CNOx~FrDr3XhjDTyEXEjng-CRoA~Aj69MhNManYUKxo6QcwZ0wmXBtyva0zwuHB04rFYAPf7qqGJ5cHb03RCDw1jIW8l";
#endif

appBuilder
.ConfigureServices(services =>
{
#if TIZEN
services.AddTransient((_) =>
{
var option = new InitializationOptions
{
DisplayResolutionUnit = DisplayResolutionUnit.DP(true),
};
return option;
});
#endif
})
.ConfigureLifecycleEvents(lifecycle =>
{
#if __IOS__
Expand Down
2 changes: 1 addition & 1 deletion src/Essentials/samples/Samples/View/HomePage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@

</CollectionView>

</views:BasePage>
</views:BasePage>
2 changes: 1 addition & 1 deletion src/Essentials/samples/Samples/View/PermissionsPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</views:BasePage.BindingContext>

<StackLayout>
<ListView HasUnevenRows="True" ItemsSource="{Binding PermissionItems}">
<ListView HasUnevenRows="{OnPlatform Default=True, Tizen=False}" ItemsSource="{Binding PermissionItems}">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
Expand Down

0 comments on commit 453033c

Please sign in to comment.