summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.Tizen
diff options
context:
space:
mode:
authordarkleem <cdark.lim@samsung.com>2017-05-19 21:31:53 +0900
committerKangho Hur <kangho.hur@samsung.com>2017-07-10 11:11:26 +0900
commit6ab530cd1629ad44c9cc9b88c7c282329281d4b4 (patch)
tree08f726b520fdea3d77e49704a257fbc4ef4872de /Xamarin.Forms.Platform.Tizen
parente1a5a17d172f0d7242446fc7612205825e754162 (diff)
downloadxamarin-forms-6ab530cd1629ad44c9cc9b88c7c282329281d4b4.tar.gz
xamarin-forms-6ab530cd1629ad44c9cc9b88c7c282329281d4b4.tar.bz2
xamarin-forms-6ab530cd1629ad44c9cc9b88c7c282329281d4b4.zip
Fix Native.Button default size issue
- DatePicker & TimePicker size issue can be resolved. Change-Id: I2eb1ad1577be7cbb91c4dc2b8bd21e0dabc72298 Signed-off-by: darkleem <cdark.lim@samsung.com>
Diffstat (limited to 'Xamarin.Forms.Platform.Tizen')
-rw-r--r--Xamarin.Forms.Platform.Tizen/Native/Button.cs69
1 files changed, 9 insertions, 60 deletions
diff --git a/Xamarin.Forms.Platform.Tizen/Native/Button.cs b/Xamarin.Forms.Platform.Tizen/Native/Button.cs
index c6638662..a3f36a4b 100644
--- a/Xamarin.Forms.Platform.Tizen/Native/Button.cs
+++ b/Xamarin.Forms.Platform.Tizen/Native/Button.cs
@@ -1,8 +1,8 @@
-using System;
using ElmSharp;
+using System;
using EButton = ElmSharp.Button;
-using ESize = ElmSharp.Size;
using EColor = ElmSharp.Color;
+using ESize = ElmSharp.Size;
namespace Xamarin.Forms.Platform.Tizen.Native
{
@@ -18,11 +18,6 @@ namespace Xamarin.Forms.Platform.Tizen.Native
readonly Span _span = new Span();
/// <summary>
- /// The internal padding of the button, helps to determine the size.
- /// </summary>
- ESize _internalPadding;
-
- /// <summary>
/// Optional image, if set will be drawn on the button.
/// </summary>
Image _image;
@@ -186,51 +181,14 @@ namespace Xamarin.Forms.Platform.Tizen.Native
/// </summary>
public ESize Measure(int availableWidth, int availableHeight)
{
- var size = Geometry;
-
- // resize the control using the whole available width
- Resize(availableWidth, size.Height);
-
- // measure the button's text, use it as a hint for the size
- var rawSize = Native.TextHelper.GetRawTextBlockSize(this);
- var formattedSize = Native.TextHelper.GetFormattedTextBlockSize(this);
-
- // restore the original size
- Resize(size.Width, size.Height);
-
- var padding = _internalPadding;
-
- // TODO : If the efl theme for the circle button is modified, it will be deleted.
- if (Style == "circle")
+ switch (Style)
{
- 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
- // either formatted size or internal padding, whichever is bigger
- return new ESize()
- {
- Width = Math.Max(padding.Width, formattedSize.Width),
- Height = Math.Max(padding.Height, Math.Min(formattedSize.Height, Math.Max(rawSize.Height, availableHeight))),
- };
- }
- else
- {
- // otherwise use the formatted size along with padding
- return new ESize()
- {
- Width = padding.Width + formattedSize.Width,
- Height = Math.Max(padding.Height, formattedSize.Height),
- };
+ case "bottom":
+ case "circle":
+ return new ESize(MinimumWidth, MinimumHeight);
+ default:
+ var rawSize = TextHelper.GetRawTextBlockSize(this);
+ return new ESize(rawSize.Width + MinimumWidth, Math.Max(MinimumHeight, rawSize.Height));
}
}
@@ -310,19 +268,10 @@ namespace Xamarin.Forms.Platform.Tizen.Native
if (Style != style)
{
Style = style;
-
- //TODO : If the efl theme for the circle button is modified, will use MinimumWidth, MinimumHeight to get the size.
if (Style == "circle")
- {
- var circleSize = (EdjeObject["bg"]?.Geometry.Width).GetValueOrDefault(0);
- _internalPadding = new ESize(circleSize, circleSize);
_span.HorizontalTextAlignment = TextAlignment.Center;
- }
else
- {
- _internalPadding = new ESize(MinimumWidth, MinimumHeight);
_span.HorizontalTextAlignment = TextAlignment.Auto;
- }
ApplyTextAndStyle();
}
}