summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Xamarin.Forms.Core/PlatformConfiguration/TizenSpecific/Button.cs30
-rw-r--r--Xamarin.Forms.Core/PlatformConfiguration/TizenSpecific/ButtonStyle.cs9
-rw-r--r--Xamarin.Forms.Core/Xamarin.Forms.Core.csproj5
-rw-r--r--Xamarin.Forms.Platform.Tizen/Forms.cs5
-rw-r--r--Xamarin.Forms.Platform.Tizen/Native/Button.cs39
-rwxr-xr-x[-rw-r--r--]Xamarin.Forms.Platform.Tizen/Native/Span.cs4
-rw-r--r--Xamarin.Forms.Platform.Tizen/Renderers/ButtonRenderer.cs34
-rwxr-xr-x[-rw-r--r--]Xamarin.Forms.Platform.Tizen/ResourcePath.cs17
-rw-r--r--Xamarin.Forms.Platform.Tizen/TizenPlatformServices.cs2
-rw-r--r--packaging/xamarin-forms-tizen.spec2
10 files changed, 119 insertions, 28 deletions
diff --git a/Xamarin.Forms.Core/PlatformConfiguration/TizenSpecific/Button.cs b/Xamarin.Forms.Core/PlatformConfiguration/TizenSpecific/Button.cs
new file mode 100644
index 00000000..e74650fc
--- /dev/null
+++ b/Xamarin.Forms.Core/PlatformConfiguration/TizenSpecific/Button.cs
@@ -0,0 +1,30 @@
+namespace Xamarin.Forms.PlatformConfiguration.TizenSpecific
+{
+ using FormsElement = Forms.Button;
+
+ public static class Button
+ {
+ public static readonly BindableProperty ButtonStyleProperty = BindableProperty.Create("ButtonStyle", typeof(ButtonStyle), typeof(FormsElement), ButtonStyle.Default);
+
+ public static ButtonStyle GetButtonStyle(BindableObject element)
+ {
+ return (ButtonStyle)element.GetValue(ButtonStyleProperty);
+ }
+
+ public static void SetButtonStyle(BindableObject element, ButtonStyle value)
+ {
+ element.SetValue(ButtonStyleProperty, value);
+ }
+
+ public static ButtonStyle GetButtonStyle(this IPlatformElementConfiguration<Tizen, FormsElement> config)
+ {
+ return GetButtonStyle(config.Element);
+ }
+
+ public static IPlatformElementConfiguration<Tizen, FormsElement> SetButtonStyle(this IPlatformElementConfiguration<Tizen, FormsElement> config, ButtonStyle value)
+ {
+ SetButtonStyle(config.Element, value);
+ return config;
+ }
+ }
+}
diff --git a/Xamarin.Forms.Core/PlatformConfiguration/TizenSpecific/ButtonStyle.cs b/Xamarin.Forms.Core/PlatformConfiguration/TizenSpecific/ButtonStyle.cs
new file mode 100644
index 00000000..abe7bd81
--- /dev/null
+++ b/Xamarin.Forms.Core/PlatformConfiguration/TizenSpecific/ButtonStyle.cs
@@ -0,0 +1,9 @@
+namespace Xamarin.Forms.PlatformConfiguration.TizenSpecific
+{
+ public enum ButtonStyle
+ {
+ Default,
+ Circle,
+ Bottom
+ }
+}
diff --git a/Xamarin.Forms.Core/Xamarin.Forms.Core.csproj b/Xamarin.Forms.Core/Xamarin.Forms.Core.csproj
index 07dc83ea..26445cae 100644
--- a/Xamarin.Forms.Core/Xamarin.Forms.Core.csproj
+++ b/Xamarin.Forms.Core/Xamarin.Forms.Core.csproj
@@ -101,6 +101,8 @@
<Compile Include="PlatformConfiguration\iOSSpecific\VisualElement.cs" />
<Compile Include="PlatformConfiguration\TizenSpecific\Image.cs" />
<Compile Include="PlatformConfiguration\TizenSpecific\ProgressBar.cs" />
+ <Compile Include="PlatformConfiguration\TizenSpecific\Button.cs" />
+ <Compile Include="PlatformConfiguration\TizenSpecific\ButtonStyle.cs" />
<Compile Include="PlatformConfiguration\WindowsSpecific\MasterDetailPage.cs" />
<Compile Include="PlatformConfiguration\WindowsSpecific\CollapseStyle.cs" />
<Compile Include="Configuration.cs" />
@@ -455,10 +457,9 @@
<Name>Xamarin.Forms.Platform</Name>
</ProjectReference>
</ItemGroup>
- <ItemGroup />
<PropertyGroup>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
<ItemGroup />
-</Project> \ No newline at end of file
+</Project>
diff --git a/Xamarin.Forms.Platform.Tizen/Forms.cs b/Xamarin.Forms.Platform.Tizen/Forms.cs
index 453bab82..a12d9513 100644
--- a/Xamarin.Forms.Platform.Tizen/Forms.cs
+++ b/Xamarin.Forms.Platform.Tizen/Forms.cs
@@ -123,10 +123,8 @@ namespace Xamarin.Forms.Platform.Tizen
Elementary.ThemeOverlay();
}
- //TO-DO: Need to change to Tizen.
- Device.OS = TargetPlatform.Other;
+ Device.OS = TargetPlatform.Tizen;
-#if !NET45
// In .NETCore, AppDomain feature is not supported.
// The list of assemblies returned by AppDomain.GetAssemblies() method should be registered manually.
// The assembly of the executing application and referenced assemblies of it are added into the list here.
@@ -147,7 +145,6 @@ namespace Xamarin.Forms.Platform.Tizen
}
}
}
-#endif
Device.PlatformServices = new TizenPlatformServices(); ;
if (Device.info != null)
diff --git a/Xamarin.Forms.Platform.Tizen/Native/Button.cs b/Xamarin.Forms.Platform.Tizen/Native/Button.cs
index 8f85da63..71ec0c10 100644
--- a/Xamarin.Forms.Platform.Tizen/Native/Button.cs
+++ b/Xamarin.Forms.Platform.Tizen/Native/Button.cs
@@ -20,7 +20,7 @@ namespace Xamarin.Forms.Platform.Tizen.Native
/// <summary>
/// The internal padding of the button, helps to determine the size.
/// </summary>
- readonly ESize _internalPadding;
+ ESize _internalPadding;
/// <summary>
/// Optional image, if set will be drawn on the button.
@@ -201,6 +201,18 @@ namespace Xamarin.Forms.Platform.Tizen.Native
var padding = _internalPadding;
+ if (Style == "circle")
+ {
+ var circleTextPadding = (EdjeObject["icon_text_padding"]?.Geometry.Height).GetValueOrDefault(0);
+ var circleHeight = padding.Height + ((rawSize.Width == 0) ? 0 : circleTextPadding + formattedSize.Height);
+
+ return new ESize
+ {
+ Width = padding.Width,
+ Height = circleHeight
+ };
+ }
+
if (rawSize.Width > availableWidth)
{
// if the raw text width is larger than the available width, use
@@ -299,5 +311,30 @@ namespace Xamarin.Forms.Platform.Tizen.Native
SetPartContent("icon", _image);
}
}
+
+ public void UpdateStyle(string style)
+ {
+ if (Style != style)
+ {
+ Style = style;
+
+ if (Style == "circle")
+ {
+ var circleSize = (EdjeObject["bg"]?.Geometry.Width).GetValueOrDefault(0);
+ _internalPadding = new ESize(circleSize, circleSize);
+ _span.HorizontalTextAlignment = TextAlignment.Center;
+ }
+ else if (Style == "bottom")
+ {
+ _internalPadding = GetInternalPadding();
+ _span.HorizontalTextAlignment = TextAlignment.Auto;
+ }
+ else
+ {
+ _span.HorizontalTextAlignment = TextAlignment.Auto;
+ }
+ ApplyTextAndStyle();
+ }
+ }
}
}
diff --git a/Xamarin.Forms.Platform.Tizen/Native/Span.cs b/Xamarin.Forms.Platform.Tizen/Native/Span.cs
index 0e3f0000..c92fefcf 100644..100755
--- a/Xamarin.Forms.Platform.Tizen/Native/Span.cs
+++ b/Xamarin.Forms.Platform.Tizen/Native/Span.cs
@@ -144,7 +144,7 @@ namespace Xamarin.Forms.Platform.Tizen.Native
/// <summary>
/// This method return text decorated with markup if FormattedText is set or plain text otherwise.
/// </summary>
- internal string GetDecoratedText()
+ public string GetDecoratedText()
{
if (FormattedText != null)
{
@@ -275,7 +275,7 @@ namespace Xamarin.Forms.Platform.Tizen.Native
.Replace("\n", "<br>");
}
- internal string GetStyle()
+ public string GetStyle()
{
StringBuilder sb = new StringBuilder();
diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/ButtonRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/ButtonRenderer.cs
index a34df549..8af7bb69 100644
--- a/Xamarin.Forms.Platform.Tizen/Renderers/ButtonRenderer.cs
+++ b/Xamarin.Forms.Platform.Tizen/Renderers/ButtonRenderer.cs
@@ -1,5 +1,8 @@
using System;
+using System.ComponentModel;
using EColor = ElmSharp.Color;
+using Xamarin.Forms.PlatformConfiguration.TizenSpecific;
+using Specific = Xamarin.Forms.PlatformConfiguration.TizenSpecific.Button;
namespace Xamarin.Forms.Platform.Tizen
{
@@ -38,12 +41,23 @@ namespace Xamarin.Forms.Platform.Tizen
if (e.NewElement != null)
{
+ UpdateStyle();
Control.Clicked += ButtonClickedHandler;
}
base.OnElementChanged(e);
}
+ protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
+ {
+ base.OnElementPropertyChanged(sender, e);
+
+ if (e.PropertyName == Specific.ButtonStyleProperty.PropertyName)
+ {
+ UpdateStyle();
+ }
+ }
+
protected override Size MinimumSize()
{
return new Size(Control.MinimumWidth, Control.MinimumHeight);
@@ -84,6 +98,26 @@ namespace Xamarin.Forms.Platform.Tizen
}
}
+ void UpdateStyle()
+ {
+ string style;
+ switch (Specific.GetButtonStyle(Element))
+ {
+ case ButtonStyle.Circle:
+ style = "circle";
+ break;
+ case ButtonStyle.Bottom:
+ style = "bottom";
+ break;
+ default:
+ style = "default";
+ break;
+ }
+
+ Control.UpdateStyle(style);
+ ((IVisualElementController)Element).NativeSizeChanged();
+ }
+
void UpdateBorder()
{
/* The simpler way is to create some specialized theme for button in
diff --git a/Xamarin.Forms.Platform.Tizen/ResourcePath.cs b/Xamarin.Forms.Platform.Tizen/ResourcePath.cs
index d2387793..b3678727 100644..100755
--- a/Xamarin.Forms.Platform.Tizen/ResourcePath.cs
+++ b/Xamarin.Forms.Platform.Tizen/ResourcePath.cs
@@ -1,13 +1,10 @@
using System.IO;
-#if NET45
-using System.Reflection;
-#endif
using AppFW = Tizen.Applications;
namespace Xamarin.Forms.Platform.Tizen
{
- internal static class ResourcePath
+ public static class ResourcePath
{
public static string GetPath(string res)
{
@@ -26,18 +23,6 @@ namespace Xamarin.Forms.Platform.Tizen
}
}
-#if NET45
- string exedir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
- // ind resource in "exepath/../res/"
- {
- string resPath = exedir + "/../res/" + res;
- if (File.Exists(resPath))
- {
- return resPath;
- }
- }
-#endif
-
return res;
}
}
diff --git a/Xamarin.Forms.Platform.Tizen/TizenPlatformServices.cs b/Xamarin.Forms.Platform.Tizen/TizenPlatformServices.cs
index db7ee1de..bb7183a9 100644
--- a/Xamarin.Forms.Platform.Tizen/TizenPlatformServices.cs
+++ b/Xamarin.Forms.Platform.Tizen/TizenPlatformServices.cs
@@ -192,7 +192,6 @@ namespace Xamarin.Forms.Platform.Tizen
#endregion
-#if !NET45
// In .NETCore, AppDomain is not supported. The list of the assemblies should be generated manually.
internal class AppDomain
{
@@ -226,7 +225,6 @@ namespace Xamarin.Forms.Platform.Tizen
return _assemblies.ToArray();
}
}
-#endif
}
}
diff --git a/packaging/xamarin-forms-tizen.spec b/packaging/xamarin-forms-tizen.spec
index 81bbe540..80983d6d 100644
--- a/packaging/xamarin-forms-tizen.spec
+++ b/packaging/xamarin-forms-tizen.spec
@@ -18,7 +18,7 @@ Source1: %{name}.manifest
# let's override Mono provided portion
%define __mono_requires %{_builddir}/%name-%version/packaging/custom-find-requires
-ExcludeArch: aarch64 %ix86
+ExcludeArch: aarch64
BuildRequires: mono-compiler
BuildRequires: mono-devel