summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.Tizen
diff options
context:
space:
mode:
authorSeungkeun Lee <sngn.lee@samsung.com>2016-12-19 00:18:31 (GMT)
committerSeungkeun Lee <sngn.lee@samsung.com>2016-12-19 00:18:31 (GMT)
commit4f1ea2eb553240932fc173c758d0d975bafe4dbd (patch)
tree13f0b390d45bed611dcc5c7aff87b20cb676d694 /Xamarin.Forms.Platform.Tizen
parent347db139a9b1b93cd07739e281631bf13031496b (diff)
downloadxamarin-forms-4f1ea2eb553240932fc173c758d0d975bafe4dbd.zip
xamarin-forms-4f1ea2eb553240932fc173c758d0d975bafe4dbd.tar.gz
xamarin-forms-4f1ea2eb553240932fc173c758d0d975bafe4dbd.tar.bz2
Fix TextCell text color bugrefs/changes/04/105504/1
- Remove predefined default color in CellRenderers - handle Color.Default in Span Change-Id: I901f93c4b9d929b9d3e646ae29a5a3fb81237152
Diffstat (limited to 'Xamarin.Forms.Platform.Tizen')
-rw-r--r--Xamarin.Forms.Platform.Tizen/Cells/CellRenderer.cs8
-rw-r--r--Xamarin.Forms.Platform.Tizen/Cells/EntryCellRenderer.cs5
-rw-r--r--Xamarin.Forms.Platform.Tizen/Cells/TextCellRenderer.cs6
-rw-r--r--Xamarin.Forms.Platform.Tizen/Native/Span.cs24
4 files changed, 24 insertions, 19 deletions
diff --git a/Xamarin.Forms.Platform.Tizen/Cells/CellRenderer.cs b/Xamarin.Forms.Platform.Tizen/Cells/CellRenderer.cs
index 1cda74c..4701905 100644
--- a/Xamarin.Forms.Platform.Tizen/Cells/CellRenderer.cs
+++ b/Xamarin.Forms.Platform.Tizen/Cells/CellRenderer.cs
@@ -7,8 +7,6 @@ namespace Xamarin.Forms.Platform.Tizen
public abstract class CellRenderer : IRegisterable
{
const string _heightProperty = "Height";
- protected static readonly EColor s_defaultTextColor = EColor.Black;
- protected static readonly EColor s_defaultBackgroundColor = EColor.White;
readonly Dictionary<Cell, Dictionary<string, EvasObject>> _realizedNativeViews = new Dictionary<Cell, Dictionary<string, EvasObject>>();
protected CellRenderer(string style)
@@ -69,9 +67,9 @@ namespace Xamarin.Forms.Platform.Tizen
{
var nativeSpan = new Native.Span();
nativeSpan.Text = span.Text;
- nativeSpan.ForegroundColor = span.ForegroundColor.IsDefault ? s_defaultTextColor : span.ForegroundColor.ToNative();
+ nativeSpan.ForegroundColor = span.ForegroundColor.ToNative();
nativeSpan.FontAttributes = span.FontAttributes;
- nativeSpan.BackgroundColor = span.BackgroundColor.IsDefault ? s_defaultBackgroundColor : span.BackgroundColor.ToNative();
+ nativeSpan.BackgroundColor = span.BackgroundColor.ToNative();
nativeSpan.FontSize = span.FontSize;
nativeSpan.FontFamily = span.FontFamily;
return nativeSpan;
@@ -106,7 +104,7 @@ namespace Xamarin.Forms.Platform.Tizen
string GetText(object data, string part)
{
var span = OnGetText((data as Native.ListView.ItemContext).Cell, part);
- return span != null ? ToNative(span).GetDecoratedText() : null;
+ return span != null ? ToNative(span).GetMarkupText() : null;
}
EvasObject GetContent(object data, string part)
diff --git a/Xamarin.Forms.Platform.Tizen/Cells/EntryCellRenderer.cs b/Xamarin.Forms.Platform.Tizen/Cells/EntryCellRenderer.cs
index c07985f..4c4e7f1 100644
--- a/Xamarin.Forms.Platform.Tizen/Cells/EntryCellRenderer.cs
+++ b/Xamarin.Forms.Platform.Tizen/Cells/EntryCellRenderer.cs
@@ -8,6 +8,7 @@ namespace Xamarin.Forms.Platform.Tizen
public class EntryCellRenderer : ViewCellRenderer
{
const int _defaultHeight = 120;
+ static readonly EColor s_defaultLabelColor = EColor.Black;
readonly Dictionary<EvasObject, NativeEntryComponent> _realizedComponent = new Dictionary<EvasObject, NativeEntryComponent>();
public EntryCellRenderer()
@@ -46,9 +47,7 @@ namespace Xamarin.Forms.Platform.Tizen
{
IsSingleLine = true,
Text = entryCell.Text,
- TextColor = s_defaultTextColor,
Placeholder = entryCell.Placeholder,
- PlaceholderColor = s_defaultTextColor,
Keyboard = entryCell.Keyboard.ToNative(),
HorizontalTextAlignment = entryCell.HorizontalTextAlignment.ToNative(),
};
@@ -151,7 +150,7 @@ namespace Xamarin.Forms.Platform.Tizen
EColor GetLabelColor(EntryCell cell)
{
- return cell.LabelColor.IsDefault ? s_defaultTextColor : cell.LabelColor.ToNative();
+ return cell.LabelColor.IsDefault ? s_defaultLabelColor : cell.LabelColor.ToNative();
}
class NativeEntryComponent
diff --git a/Xamarin.Forms.Platform.Tizen/Cells/TextCellRenderer.cs b/Xamarin.Forms.Platform.Tizen/Cells/TextCellRenderer.cs
index 2bea384..1f9594a 100644
--- a/Xamarin.Forms.Platform.Tizen/Cells/TextCellRenderer.cs
+++ b/Xamarin.Forms.Platform.Tizen/Cells/TextCellRenderer.cs
@@ -34,7 +34,8 @@ namespace Xamarin.Forms.Platform.Tizen
return new Span()
{
Text = cell.Text,
- ForegroundColor = cell.TextColor
+ ForegroundColor = cell.TextColor,
+ FontSize = -1
};
}
@@ -43,7 +44,8 @@ namespace Xamarin.Forms.Platform.Tizen
return new Span()
{
Text = cell.Detail,
- ForegroundColor = cell.DetailColor
+ ForegroundColor = cell.DetailColor,
+ FontSize = -1
};
}
diff --git a/Xamarin.Forms.Platform.Tizen/Native/Span.cs b/Xamarin.Forms.Platform.Tizen/Native/Span.cs
index 6c479e3..7ac4134 100644
--- a/Xamarin.Forms.Platform.Tizen/Native/Span.cs
+++ b/Xamarin.Forms.Platform.Tizen/Native/Span.cs
@@ -8,6 +8,7 @@ namespace Xamarin.Forms.Platform.Tizen.Native
/// </summary>
public class Span
{
+ static EColor s_defaultLineColor = EColor.Black;
string _text;
/// <summary>
@@ -111,8 +112,8 @@ namespace Xamarin.Forms.Platform.Tizen.Native
FontFamily = "";
FontSize = -1;
FontAttributes = FontAttributes.None;
- ForegroundColor = EColor.White;
- BackgroundColor = EColor.Transparent;
+ ForegroundColor = EColor.Default;
+ BackgroundColor = EColor.Default;
HorizontalTextAlignment = TextAlignment.Auto;
VerticalTextAlignment = TextAlignment.Auto;
LineBreakMode = LineBreakMode.MixedWrap;
@@ -157,12 +158,15 @@ namespace Xamarin.Forms.Platform.Tizen.Native
StringBuilder PrepareFormattingString(StringBuilder _formattingString)
{
- var foregroundColor = ForegroundColor.ToHex();
-
- _formattingString.AppendFormat("color={0} ", foregroundColor);
+ if (!ForegroundColor.IsDefault)
+ {
+ _formattingString.AppendFormat("color={0} ", ForegroundColor.ToHex());
+ }
- _formattingString.AppendFormat("backing_color={0} ", BackgroundColor.ToHex());
- _formattingString.Append("backing=on ");
+ if (!BackgroundColor.IsDefault)
+ {
+ _formattingString.AppendFormat("backing_color={0} backing=on ", BackgroundColor.ToHex());
+ }
if (!string.IsNullOrEmpty(FontFamily))
{
@@ -185,12 +189,14 @@ namespace Xamarin.Forms.Platform.Tizen.Native
if (Underline)
{
- _formattingString.AppendFormat("underline=on underline_color={0} ", foregroundColor);
+ _formattingString.AppendFormat("underline=on underline_color={0} ",
+ ForegroundColor.IsDefault ? s_defaultLineColor.ToHex() : ForegroundColor.ToHex());
}
if (Strikethrough)
{
- _formattingString.AppendFormat("strikethrough=on strikethrough_color={0} ", foregroundColor);
+ _formattingString.AppendFormat("strikethrough=on strikethrough_color={0} ",
+ ForegroundColor.IsDefault ? s_defaultLineColor.ToHex() : ForegroundColor.ToHex());
}
switch (HorizontalTextAlignment)