summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeungkeun Lee <sngn.lee@samsung.com>2017-06-12 05:26:04 (GMT)
committerKangho Hur <kangho.hur@samsung.com>2017-07-10 02:11:26 (GMT)
commitfe737802c58a800f05fbf9c263c594b724f7e49a (patch)
treefe9698124689039e45ee0ccb9524d27b2122324f
parentb1e53c75bdb39b35ac1c233656dc800bd11f6b43 (diff)
downloadxamarin-forms-fe737802c58a800f05fbf9c263c594b724f7e49a.zip
xamarin-forms-fe737802c58a800f05fbf9c263c594b724f7e49a.tar.gz
xamarin-forms-fe737802c58a800f05fbf9c263c594b724f7e49a.tar.bz2
Update Label internal implemnets
- TextStyle was added in ElmSharp.Label - VerticalTextAlignment API was added in ElmSharp.Layout - Update LineBreakMode code with LineWrapType and IsEllipsis Change-Id: Ic4ee266f58ae2f29442e3a236283bbc05dc65a05
-rw-r--r--Xamarin.Forms.Platform.Tizen/Native/Entry.cs2
-rw-r--r--Xamarin.Forms.Platform.Tizen/Native/Label.cs104
-rw-r--r--Xamarin.Forms.Platform.Tizen/Native/Span.cs20
-rw-r--r--Xamarin.Forms.Platform.Tizen/Renderers/EntryRenderer.cs2
4 files changed, 78 insertions, 50 deletions
diff --git a/Xamarin.Forms.Platform.Tizen/Native/Entry.cs b/Xamarin.Forms.Platform.Tizen/Native/Entry.cs
index 26b775c..d6f3f45 100644
--- a/Xamarin.Forms.Platform.Tizen/Native/Entry.cs
+++ b/Xamarin.Forms.Platform.Tizen/Native/Entry.cs
@@ -414,7 +414,7 @@ namespace Xamarin.Forms.Platform.Tizen.Native
/// <param name="markupText">Markup text to be used as a placeholder.</param>
void SetInternalPlaceholderAndStyle(string markupText)
{
- SetPartText("guide", markupText ?? "");
+ SetPartText("elm.guide", markupText ?? "");
}
}
}
diff --git a/Xamarin.Forms.Platform.Tizen/Native/Label.cs b/Xamarin.Forms.Platform.Tizen/Native/Label.cs
index 911ca31..8d09536 100644
--- a/Xamarin.Forms.Platform.Tizen/Native/Label.cs
+++ b/Xamarin.Forms.Platform.Tizen/Native/Label.cs
@@ -210,8 +210,35 @@ namespace Xamarin.Forms.Platform.Tizen.Native
{
if (value != _span.LineBreakMode)
{
+ var previousMode = _span.LineBreakMode;
_span.LineBreakMode = value;
- ApplyTextAndStyle();
+ switch(value)
+ {
+ case LineBreakMode.NoWrap:
+ LineWrapType = WrapType.None;
+ IsEllipsis = false;
+ break;
+ case LineBreakMode.CharacterWrap:
+ LineWrapType = WrapType.Char;
+ IsEllipsis = false;
+ break;
+ case LineBreakMode.WordWrap:
+ LineWrapType = WrapType.Word;
+ IsEllipsis = false;
+ break;
+ case LineBreakMode.MixedWrap:
+ LineWrapType = WrapType.Mixed;
+ IsEllipsis = false;
+ break;
+ default:
+ LineWrapType = WrapType.None;
+ IsEllipsis = true;
+ break;
+ }
+ if (IsEllipsis || previousMode >= LineBreakMode.HeadTruncation)
+ {
+ ApplyTextAndStyle();
+ }
}
}
}
@@ -243,9 +270,48 @@ namespace Xamarin.Forms.Platform.Tizen.Native
/// <value>The vertical text alignment.</value>
public TextAlignment VerticalTextAlignment
{
- // TODO. need to EFL new API
- get;
- set;
+ // README: It only work on Tizen 4.0
+ get
+ {
+ double valign = GetVerticalTextAlignment("elm.text");
+ if (valign == 0.0)
+ {
+ return TextAlignment.Start;
+ }
+ else if (valign == 0.5)
+ {
+ return TextAlignment.Center;
+ }
+ else if (valign == 1.0)
+ {
+ return TextAlignment.End;
+ }
+ else
+ {
+ return TextAlignment.Auto;
+ }
+ }
+ set
+ {
+ double valign = 0;
+ switch (value)
+ {
+ case TextAlignment.Auto:
+ valign = -1;
+ break;
+ case TextAlignment.None:
+ case TextAlignment.Start:
+ valign = 0;
+ break;
+ case TextAlignment.Center:
+ valign = 0.5;
+ break;
+ case TextAlignment.End:
+ valign = 1.0;
+ break;
+ }
+ SetVerticalTextAlignment("elm.text", valign);
+ }
}
/// <summary>
@@ -323,36 +389,8 @@ namespace Xamarin.Forms.Platform.Tizen.Native
void SetInternalTextAndStyle(string formattedText, string textStyle)
{
- string emission = "elm,state,text,visible";
-
- if (string.IsNullOrEmpty(formattedText))
- {
- formattedText = null;
- textStyle = null;
- emission = "elm,state,text,hidden";
- }
-
base.Text = formattedText;
-
- var textblock = EdjeObject["elm.text"];
-
- if (textblock != null)
- {
- textblock.TextStyle = textStyle;
- }
-
- EdjeObject.EmitSignal(emission, "elm");
-
- switch (LineBreakMode)
- {
- case LineBreakMode.NoWrap:
- emission = "elm,state,horizontal,expandable";
- break;
- default:
- emission = "elm,state,horizontal,fixed";
- break;
- }
- EdjeObject.EmitSignal(emission, "elm");
+ TextStyle = textStyle;
}
}
}
diff --git a/Xamarin.Forms.Platform.Tizen/Native/Span.cs b/Xamarin.Forms.Platform.Tizen/Native/Span.cs
index 2f26649..3b410ba 100644
--- a/Xamarin.Forms.Platform.Tizen/Native/Span.cs
+++ b/Xamarin.Forms.Platform.Tizen/Native/Span.cs
@@ -233,22 +233,6 @@ namespace Xamarin.Forms.Platform.Tizen.Native
switch (LineBreakMode)
{
- case LineBreakMode.NoWrap:
- _formattingString.Append("wrap=none");
- break;
-
- case LineBreakMode.CharacterWrap:
- _formattingString.Append("wrap=char");
- break;
-
- case LineBreakMode.WordWrap:
- _formattingString.Append("wrap=word");
- break;
-
- case LineBreakMode.MixedWrap:
- _formattingString.Append("wrap=mixed");
- break;
-
case LineBreakMode.HeadTruncation:
_formattingString.Append("ellipsis=0.0");
break;
@@ -261,6 +245,10 @@ namespace Xamarin.Forms.Platform.Tizen.Native
_formattingString.Append("ellipsis=1.0");
break;
+ case LineBreakMode.NoWrap:
+ case LineBreakMode.CharacterWrap:
+ case LineBreakMode.WordWrap:
+ case LineBreakMode.MixedWrap:
case LineBreakMode.None:
break;
}
diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/EntryRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/EntryRenderer.cs
index c880098..ba6a15a 100644
--- a/Xamarin.Forms.Platform.Tizen/Renderers/EntryRenderer.cs
+++ b/Xamarin.Forms.Platform.Tizen/Renderers/EntryRenderer.cs
@@ -29,6 +29,8 @@ namespace Xamarin.Forms.Platform.Tizen
IsSingleLine = true,
PropagateEvents = false,
};
+ entry.SetVerticalTextAlignment("elm.text", 0.5);
+ entry.SetVerticalTextAlignment("elm.guide", 0.5);
SetNativeControl(entry);
}