summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPawel Andruszkiewicz <p.andruszkie@samsung.com>2017-06-12 08:35:25 (GMT)
committerKangho Hur <kangho.hur@samsung.com>2017-10-23 04:34:37 (GMT)
commit3ea1834e6f6771dacead4d86bad3c8d64bd5f8a2 (patch)
tree81187906ba88e6ed80522f6a3db9485f9845e030
parent66a992c24e304293ea59a465c04e25d78593f47d (diff)
downloadxamarin-forms-3ea1834e6f6771dacead4d86bad3c8d64bd5f8a2.zip
xamarin-forms-3ea1834e6f6771dacead4d86bad3c8d64bd5f8a2.tar.gz
xamarin-forms-3ea1834e6f6771dacead4d86bad3c8d64bd5f8a2.tar.bz2
Initialize Entry/Editor with a single batch update
Change-Id: Ibc7f697dfb51992040c8dbe476065ea884e33a49 Signed-off-by: Pawel Andruszkiewicz <p.andruszkie@samsung.com>
-rw-r--r--Xamarin.Forms.Platform.Tizen/Native/Entry.cs12
-rw-r--r--Xamarin.Forms.Platform.Tizen/Renderers/EditorRenderer.cs8
-rw-r--r--Xamarin.Forms.Platform.Tizen/Renderers/EntryRenderer.cs8
3 files changed, 26 insertions, 2 deletions
diff --git a/Xamarin.Forms.Platform.Tizen/Native/Entry.cs b/Xamarin.Forms.Platform.Tizen/Native/Entry.cs
index d6f3f45..8276aaa 100644
--- a/Xamarin.Forms.Platform.Tizen/Native/Entry.cs
+++ b/Xamarin.Forms.Platform.Tizen/Native/Entry.cs
@@ -10,7 +10,7 @@ namespace Xamarin.Forms.Platform.Tizen.Native
/// Extends the Entry control, providing basic formatting features,
/// i.e. font color, size, placeholder.
/// </summary>
- public class Entry : EEntry, IMeasurable
+ public class Entry : EEntry, IMeasurable, IBatchable
{
/// <summary>
/// Holds the formatted text of the entry.
@@ -342,12 +342,20 @@ namespace Xamarin.Forms.Platform.Tizen.Native
}
}
+ void IBatchable.OnBatchCommitted()
+ {
+ ApplyTextAndStyle();
+ }
+
/// <summary>
/// Applies entry's text and its style.
/// </summary>
void ApplyTextAndStyle()
{
- SetInternalTextAndStyle(_span.GetDecoratedText(), _span.GetStyle());
+ if (!this.IsBatched())
+ {
+ SetInternalTextAndStyle(_span.GetDecoratedText(), _span.GetStyle());
+ }
}
/// <summary>
diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/EditorRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/EditorRenderer.cs
index b904b7d..f37566a 100644
--- a/Xamarin.Forms.Platform.Tizen/Renderers/EditorRenderer.cs
+++ b/Xamarin.Forms.Platform.Tizen/Renderers/EditorRenderer.cs
@@ -1,4 +1,5 @@
´╗┐using System;
+using Xamarin.Forms.Platform.Tizen.Native;
using EColor = ElmSharp.Color;
namespace Xamarin.Forms.Platform.Tizen
@@ -37,11 +38,18 @@ namespace Xamarin.Forms.Platform.Tizen
{
Control.TextChanged += TextChanged;
Control.Unfocused += Completed;
+
+ Control.BatchBegin();
}
base.OnElementChanged(e);
}
+ protected override void OnElementReady()
+ {
+ Control?.BatchCommit();
+ }
+
void TextChanged(object sender, EventArgs e)
{
Element.Text = ((Native.Entry)sender).Text;
diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/EntryRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/EntryRenderer.cs
index 3274ec3..e54e739 100644
--- a/Xamarin.Forms.Platform.Tizen/Renderers/EntryRenderer.cs
+++ b/Xamarin.Forms.Platform.Tizen/Renderers/EntryRenderer.cs
@@ -1,4 +1,5 @@
using System;
+using Xamarin.Forms.Platform.Tizen.Native;
using Specific = Xamarin.Forms.PlatformConfiguration.TizenSpecific.Entry;
namespace Xamarin.Forms.Platform.Tizen
@@ -47,6 +48,8 @@ namespace Xamarin.Forms.Platform.Tizen
{
Control.TextChanged += EntryChangedHandler;
Control.Activated += EntryCompletedHandler;
+
+ Control.BatchBegin();
}
base.OnElementChanged(e);
@@ -63,6 +66,11 @@ namespace Xamarin.Forms.Platform.Tizen
base.Dispose(disposing);
}
+ protected override void OnElementReady()
+ {
+ Control?.BatchCommit();
+ }
+
void EntryChangedHandler(object sender, EventArgs e)
{
Element.Text = Control.Text;