<group targetFramework="Xamarin.iOS10">
<dependency id="Xamarin.iOS.MaterialComponents" version="72.2.0.1"/>
</group>
+ <group targetFramework="tizen40">
+ <dependency id="Tizen.NET" version="4.0.0"/>
+ <dependency id="Tizen.NET.MaterialComponents" version="0.9.5-preview"/>
+ </group>
</dependencies>
</metadata>
<files>
<file src="..\Xamarin.Forms.Material.iOS\bin\$Configuration$\Xamarin.Forms.Material.dll" target="lib\Xamarin.iOS10" />
<file src="..\Xamarin.Forms.Material.iOS\bin\$Configuration$\Xamarin.Forms.Material.*pdb" target="lib\Xamarin.iOS10" />
<file src="..\Xamarin.Forms.Material.iOS\bin\$Configuration$\Xamarin.Forms.Material.*mdb" target="lib\Xamarin.iOS10" />
+
+ <!--Tizen-->
+ <file src="..\Xamarin.Forms.Material.Tizen\bin\$Configuration$\tizen40\Xamarin.Forms.Material.dll" target="lib\tizen40" />
+ <file src="..\Xamarin.Forms.Material.Tizen\bin\$Configuration$\tizen40\Xamarin.Forms.Material.*pdb" target="lib\tizen40" />
</files>
</package>
using Xamarin.Forms.Platform.Tizen;
using Xamarin.Forms.Controls;
using ElmSharp;
+using Tizen.Applications;
+using Tizen.NET.MaterialComponents;
namespace Xamarin.Forms.ControlGallery.Tizen
{
protected override void OnCreate()
{
base.OnCreate();
+ ThemeLoader.Initialize(DirectoryInfo.Resource);
NativeParent = MainWindow;
LoadApplication(new App());
}
var app = new MainApplication();
FormsMaps.Init("HERE", "write-your-API-key-here");
global::Xamarin.Forms.Platform.Tizen.Forms.Init(app);
+ FormsMaterial.Init();
app.Run(args);
}
}
<PackageReference Include="Tizen.NET" Version="4.0.0">
<ExcludeAssets>Runtime</ExcludeAssets>
</PackageReference>
- <PackageReference Include="Tizen.NET.Sdk" Version="1.0.0" />
+ <PackageReference Include="Tizen.NET.MaterialComponents" Version="0.9.5-preview" />
+ <PackageReference Include="Tizen.NET.Sdk" Version="1.0.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Xamarin.Forms.Core\Xamarin.Forms.Core.csproj" />
+ <ProjectReference Include="..\Xamarin.Forms.Material.Tizen\Xamarin.Forms.Material.Tizen.csproj" />
<ProjectReference Include="..\Xamarin.Forms.Platform\Xamarin.Forms.Platform.csproj" />
<ProjectReference Include="..\Xamarin.Forms.Xaml\Xamarin.Forms.Xaml.csproj" />
<ProjectReference Include="..\Xamarin.Forms.Platform.Tizen\Xamarin.Forms.Platform.Tizen.csproj" />
return;
_warnedAboutMaterial = true;
- if (Device.RuntimePlatform == Device.iOS || Device.RuntimePlatform == Device.Android)
+ if (Device.RuntimePlatform == Device.iOS || Device.RuntimePlatform == Device.Android || Device.RuntimePlatform == Device.Tizen)
Internals.Log.Warning("Visual", $"Material needs to be registered on {Device.RuntimePlatform} by calling FormsMaterial.Init() after the Xamarin.Forms.Forms.Init method call.");
else
Internals.Log.Warning("Visual", $"Material is currently not support on {Device.RuntimePlatform}.");
using ASeekBar = Android.Widget.AbsSeekBar;
using PlatformColor = Android.Graphics.Color;
using Xamarin.Forms.Platform.Android;
-#else
+#elif __IOS__
using MaterialComponents;
using Xamarin.Forms.Platform.iOS;
using PlatformColor = UIKit.UIColor;
+#elif __TIZEN__
+using System;
+using Tizen.NET.MaterialComponents;
+using Xamarin.Forms.Platform.Tizen;
+using PlatformColor = ElmSharp.Color;
#endif
#if __ANDROID__
namespace Xamarin.Forms.Material.Android
-#else
+#elif __IOS__
namespace Xamarin.Forms.Material.iOS
+#elif __TIZEN__
+namespace Xamarin.Forms.Material.Tizen
#endif
{
// Colors from material-components-android
OnSurfaceColor = OnSurfaceColor,
};
}
+#elif __TIZEN__
+ class FormsLightColors : MColors
+ {
+ public override PlatformColor PrimaryColor => MaterialColors.Light.PrimaryColor;
+ public override PlatformColor PrimaryColorVariant => MaterialColors.Light.PrimaryColorVariant;
+ public override PlatformColor OnPrimaryColor => MaterialColors.Light.OnPrimaryColor;
+ public override PlatformColor SecondaryColor => MaterialColors.Light.SecondaryColor;
+ public override PlatformColor OnSecondaryColor => MaterialColors.Light.OnSecondaryColor;
+
+ public override PlatformColor BackgroundColor => MaterialColors.Light.BackgroundColor;
+ public override PlatformColor ErrorColor => MaterialColors.Light.ErrorColor;
+ public override PlatformColor SurfaceColor => MaterialColors.Light.SurfaceColor;
+ public override PlatformColor OnBackgroundColor => MaterialColors.Light.OnBackgroundColor;
+ public override PlatformColor OnSurfaceColor => MaterialColors.Light.OnSurfaceColor;
+ };
+
+ public static MColors CreateColorScheme()
+ {
+ return new FormsLightColors();
+ }
#endif
}
OnSurfaceColor = OnSurfaceColor,
};
}
+#elif __TIZEN__
+ class FormsDarkColors : MColors
+ {
+ public override PlatformColor PrimaryColor => MaterialColors.Dark.PrimaryColor;
+ public override PlatformColor PrimaryColorVariant => MaterialColors.Dark.PrimaryColorVariant;
+ public override PlatformColor OnPrimaryColor => MaterialColors.Dark.OnPrimaryColor;
+ public override PlatformColor SecondaryColor => MaterialColors.Dark.SecondaryColor;
+ public override PlatformColor OnSecondaryColor => MaterialColors.Dark.OnSecondaryColor;
+
+ public override PlatformColor BackgroundColor => MaterialColors.Dark.BackgroundColor;
+ public override PlatformColor ErrorColor => MaterialColors.Dark.ErrorColor;
+ public override PlatformColor SurfaceColor => MaterialColors.Dark.SurfaceColor;
+ public override PlatformColor OnBackgroundColor => MaterialColors.Dark.OnBackgroundColor;
+ public override PlatformColor OnSurfaceColor => MaterialColors.Dark.OnSurfaceColor;
+ };
+
+ public static MColors CreateColorScheme()
+ {
+ return new FormsDarkColors();
+ }
#endif
}
{
#if __ANDROID__
return color.ToAndroid();
-#else
+#elif __IOS__
return color.ToUIColor();
+#elif __TIZEN__
+ return color.ToNative();
#endif
}
{
#if __ANDROID__
return color.WithAlpha(color.A / 255f * alpha);
-#else
+#elif __IOS__
return color.ColorWithAlpha(color.CGColor.Alpha / 255f * alpha);
+#elif __TIZEN__
+ return color.WithAlpha(color.A / 255f * alpha);
#endif
}
{
#if __ANDROID__
return color.WithAlpha(alpha);
-#else
+#elif __IOS__
return color.ColorWithAlpha(alpha);
+#elif __TIZEN__
+ return color.WithAlpha(alpha);
#endif
}
{
#if __ANDROID__
return PlatformColor.Rgb(red, green, blue);
-#else
+#elif __IOS__
return PlatformColor.FromRGB(red, green, blue);
-
+#elif __TIZEN__
+ return PlatformColor.FromRgb(red, green, blue);
#endif
}
}
--- /dev/null
+using System;
+using Tizen.NET.MaterialComponents;
+using Xamarin.Forms.Material.Tizen;
+
+namespace Xamarin.Forms
+{
+ public static class FormsMaterial
+ {
+ public static void Init()
+ {
+ // my only purpose is to exist so when called
+ // this dll doesn't get removed
+
+ VisualMarker.RegisterMaterial();
+ MColors.Current = MaterialColors.Light.CreateColorScheme();
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using Xamarin.Forms;
+using Xamarin.Forms.Platform.Tizen;
+using Xamarin.Forms.Material.Tizen;
+using Xamarin.Forms.Material.Tizen.Native;
+using Tizen.NET.MaterialComponents;
+using TForms = Xamarin.Forms.Platform.Tizen.Forms;
+
+[assembly: ExportRenderer(typeof(Frame), typeof(MaterialFrameRenderer), new[] { typeof(VisualMarker.MaterialVisual) })]
+namespace Xamarin.Forms.Material.Tizen
+{
+ public class MaterialFrameRenderer : ViewRenderer<Frame, MCard>
+ {
+ public MaterialFrameRenderer()
+ {
+ RegisterPropertyHandler(Frame.BorderColorProperty, UpdateBorderColor);
+ RegisterPropertyHandler(Frame.HasShadowProperty, UpdateShadowVisibility);
+ }
+
+ protected override void OnElementChanged(ElementChangedEventArgs<Frame> e)
+ {
+ if (Control == null)
+ {
+ SetNativeControl(new MCanvas(TForms.NativeParent));
+ }
+ base.OnElementChanged(e);
+ }
+
+ void UpdateBorderColor()
+ {
+ Control.BorderColor = Element.BorderColor.ToNative();
+ }
+
+ void UpdateShadowVisibility()
+ {
+ Control.HasShadow = Element.HasShadow;
+ }
+ }
+}
--- /dev/null
+using Xamarin.Forms;
+using Xamarin.Forms.Platform.Tizen;
+using Xamarin.Forms.Material.Tizen;
+using Tizen.NET.MaterialComponents;
+using TForms = Xamarin.Forms.Platform.Tizen.Forms;
+
+[assembly: ExportRenderer(typeof(ProgressBar), typeof(MaterialProgressBarRenderer), new[] { typeof(VisualMarker.MaterialVisual) })]
+namespace Xamarin.Forms.Material.Tizen
+{
+ public class MaterialProgressBarRenderer : ProgressBarRenderer
+ {
+ protected override void OnElementChanged(ElementChangedEventArgs<ProgressBar> e)
+ {
+ if (Control == null)
+ {
+ SetNativeControl(new MProgressIndicator(TForms.NativeParent));
+ }
+ base.OnElementChanged(e);
+ }
+ }
+}
--- /dev/null
+using Xamarin.Forms;
+using Xamarin.Forms.Platform.Tizen;
+using Xamarin.Forms.Material.Tizen;
+using Tizen.NET.MaterialComponents;
+using TForms = Xamarin.Forms.Platform.Tizen.Forms;
+
+[assembly: ExportRenderer(typeof(Slider), typeof(MaterialSliderRenderer), new[] { typeof(VisualMarker.MaterialVisual) })]
+namespace Xamarin.Forms.Material.Tizen
+{
+ public class MaterialSliderRenderer : SliderRenderer
+ {
+ protected override void OnElementChanged(ElementChangedEventArgs<Slider> e)
+ {
+ if (Control == null)
+ {
+ SetNativeControl(new MSlider(TForms.NativeParent));
+ }
+ base.OnElementChanged(e);
+ }
+ }
+}
--- /dev/null
+using System.Collections.Generic;
+using System.Collections.Specialized;
+using Xamarin.Forms.Platform.Tizen.Native;
+using ElmSharp;
+using Tizen.NET.MaterialComponents;
+
+namespace Xamarin.Forms.Material.Tizen.Native
+{
+ public class MCanvas : MCard, IContainable<EvasObject>
+ {
+ readonly ObservableCollection<EvasObject> _children = new ObservableCollection<EvasObject>();
+
+ public MCanvas(EvasObject parent) : base(parent)
+ {
+ _children.CollectionChanged += (o, e) =>
+ {
+ if (e.Action == NotifyCollectionChangedAction.Add)
+ {
+ foreach (var v in e.NewItems)
+ {
+ var view = v as EvasObject;
+ if (null != view)
+ {
+ OnAdd(view);
+ }
+ }
+ }
+ else if (e.Action == NotifyCollectionChangedAction.Remove)
+ {
+ foreach (var v in e.OldItems)
+ {
+ var view = v as EvasObject;
+ if (null != view)
+ {
+ OnRemove(view);
+ }
+ }
+ }
+ else if (e.Action == NotifyCollectionChangedAction.Reset)
+ {
+ OnRemoveAll();
+ }
+ };
+ }
+
+ public new IList<EvasObject> Children
+ {
+ get
+ {
+ return _children;
+ }
+ }
+
+ protected override void OnUnrealize()
+ {
+ foreach (var child in _children)
+ {
+ child.Unrealize();
+ }
+
+ base.OnUnrealize();
+ }
+
+ void OnAdd(EvasObject view)
+ {
+ PackEnd(view);
+ }
+
+ void OnRemove(EvasObject view)
+ {
+ UnPack(view);
+ }
+
+ void OnRemoveAll()
+ {
+ UnPackAll();
+ }
+ }
+}
--- /dev/null
+<Project Sdk="Microsoft.NET.Sdk">
+
+ <PropertyGroup>
+ <TargetFramework>tizen40</TargetFramework>
+ <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
+ <RootNamespace>Xamarin.Forms.Material.Tizen</RootNamespace>
+ <AssemblyName>Xamarin.Forms.Material</AssemblyName>
+ <OutputType>Library</OutputType>
+ <PackageId>Xamarin.Forms.Material.Tizen</PackageId>
+ <DefineConstants>__TIZEN__</DefineConstants>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <Compile Include="..\Xamarin.Forms.Material.Android\MaterialColors.cs">
+ <Link>MaterialColors.cs</Link>
+ </Compile>
+ </ItemGroup>
+
+ <ItemGroup>
+ <PackageReference Include="Tizen.NET" Version="4.0.0" />
+ <PackageReference Include="Tizen.NET.MaterialComponents" Version="0.9.5-preview" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <ProjectReference Include="..\Xamarin.Forms.Core\Xamarin.Forms.Core.csproj" />
+ <ProjectReference Include="..\Xamarin.Forms.Platform.Tizen\Xamarin.Forms.Platform.Tizen.csproj" />
+ </ItemGroup>
+</Project>
\ No newline at end of file
using System;
using System.Collections.Generic;
+using System.Runtime.CompilerServices;
using System.Linq;
using System.Threading.Tasks;
using System.ComponentModel;
using EButton = ElmSharp.Button;
using EColor = ElmSharp.Color;
+[assembly: InternalsVisibleTo("Xamarin.Forms.Material")]
+
namespace Xamarin.Forms.Platform.Tizen
{
public static class Platform
UpdatePulsingStatus();
}
- void UpdateProgressColor(bool initialize)
+ protected virtual void UpdateProgressColor(bool initialize)
{
if (initialize && Element.ProgressColor.IsDefault)
return;
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Xamarin.Forms.Material.Android", "Xamarin.Forms.Material.Android\Xamarin.Forms.Material.Android.csproj", "{E1586CE6-8EAC-4388-A15A-1AABF108B5F8}"
EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Xamarin.Forms.Material.Tizen", "Xamarin.Forms.Material.Tizen\Xamarin.Forms.Material.Tizen.csproj", "{84B8819E-9123-43CE-A788-8CB05ABA32DA}"
+EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
Xamarin.Forms.Controls.Issues\Xamarin.Forms.Controls.Issues.Shared\Xamarin.Forms.Controls.Issues.Shared.projitems*{0a39a74b-6f7a-4d41-84f2-b0ccdce899df}*SharedItemsImports = 4
{E1586CE6-8EAC-4388-A15A-1AABF108B5F8}.Release|x64.Build.0 = Release|Any CPU
{E1586CE6-8EAC-4388-A15A-1AABF108B5F8}.Release|x86.ActiveCfg = Release|Any CPU
{E1586CE6-8EAC-4388-A15A-1AABF108B5F8}.Release|x86.Build.0 = Release|Any CPU
+ {84B8819E-9123-43CE-A788-8CB05ABA32DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {84B8819E-9123-43CE-A788-8CB05ABA32DA}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {84B8819E-9123-43CE-A788-8CB05ABA32DA}.Debug|ARM.ActiveCfg = Debug|Any CPU
+ {84B8819E-9123-43CE-A788-8CB05ABA32DA}.Debug|ARM.Build.0 = Debug|Any CPU
+ {84B8819E-9123-43CE-A788-8CB05ABA32DA}.Debug|iPhone.ActiveCfg = Debug|Any CPU
+ {84B8819E-9123-43CE-A788-8CB05ABA32DA}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
+ {84B8819E-9123-43CE-A788-8CB05ABA32DA}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {84B8819E-9123-43CE-A788-8CB05ABA32DA}.Debug|x64.Build.0 = Debug|Any CPU
+ {84B8819E-9123-43CE-A788-8CB05ABA32DA}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {84B8819E-9123-43CE-A788-8CB05ABA32DA}.Debug|x86.Build.0 = Debug|Any CPU
+ {84B8819E-9123-43CE-A788-8CB05ABA32DA}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {84B8819E-9123-43CE-A788-8CB05ABA32DA}.Release|Any CPU.Build.0 = Release|Any CPU
+ {84B8819E-9123-43CE-A788-8CB05ABA32DA}.Release|ARM.ActiveCfg = Release|Any CPU
+ {84B8819E-9123-43CE-A788-8CB05ABA32DA}.Release|ARM.Build.0 = Release|Any CPU
+ {84B8819E-9123-43CE-A788-8CB05ABA32DA}.Release|iPhone.ActiveCfg = Release|Any CPU
+ {84B8819E-9123-43CE-A788-8CB05ABA32DA}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
+ {84B8819E-9123-43CE-A788-8CB05ABA32DA}.Release|x64.ActiveCfg = Release|Any CPU
+ {84B8819E-9123-43CE-A788-8CB05ABA32DA}.Release|x64.Build.0 = Release|Any CPU
+ {84B8819E-9123-43CE-A788-8CB05ABA32DA}.Release|x86.ActiveCfg = Release|Any CPU
+ {84B8819E-9123-43CE-A788-8CB05ABA32DA}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
{160053B8-745A-41DB-9B33-30479729D6DC} = {ED56954D-28FE-42BF-A5FD-AD5AD5AF0A0C}
{868A9B7B-3977-4B56-91F7-F6B75657198B} = {ED56954D-28FE-42BF-A5FD-AD5AD5AF0A0C}
{E1586CE6-8EAC-4388-A15A-1AABF108B5F8} = {F6F6A11F-CA66-4C7E-AB84-CD21D817C2CD}
+ {84B8819E-9123-43CE-A788-8CB05ABA32DA} = {F6F6A11F-CA66-4C7E-AB84-CD21D817C2CD}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {650AE971-2F29-46A8-822C-FB4FCDC6A9A0}
Xamarin.Forms.Material.Android/bin/$(BuildConfiguration)/**/*.dll
Xamarin.Forms.Material.Android/bin/$(BuildConfiguration)/**/*.pdb
Xamarin.Forms.Material.Android/bin/$(BuildConfiguration)/**/*.mdb
+ Xamarin.Forms.Material.Tizen/bin/$(BuildConfiguration)/**/*.dll
+ Xamarin.Forms.Material.Tizen/bin/$(BuildConfiguration)/**/*.pdb
+ Xamarin.Forms.Material.Tizen/bin/$(BuildConfiguration)/**/*.mdb
Xamarin.Forms.Platform.WP8/bin/$(BuildConfiguration)/**/*.dll
Xamarin.Forms.Platform.UAP/bin/$(BuildConfiguration)/**/*.pdb
Xamarin.Forms.Platform.UAP/bin/$(BuildConfiguration)/**/*.dll
- task: PublishBuildArtifacts@1
displayName: 'Publish Artifact: win_build'
inputs:
- ArtifactName: 'win_build'
\ No newline at end of file
+ ArtifactName: 'win_build'