summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Xamarin.Forms.Maps.Tizen/Xamarin.Forms.Maps.Tizen.nuspec2
-rw-r--r--Xamarin.Forms.Platform.Tizen/Cells/EntryCellRenderer.cs8
-rw-r--r--Xamarin.Forms.Platform.Tizen/Cells/ViewCellRenderer.cs3
-rw-r--r--Xamarin.Forms.Platform.Tizen/Forms.cs12
-rw-r--r--Xamarin.Forms.Platform.Tizen/Native/Box.cs20
-rw-r--r--Xamarin.Forms.Platform.Tizen/Native/LayoutEventArgs.cs11
-rw-r--r--Xamarin.Forms.Platform.Tizen/Native/ListView.cs2
-rw-r--r--Xamarin.Forms.Platform.Tizen/Native/SearchBar.cs33
-rw-r--r--Xamarin.Forms.Platform.Tizen/Renderers/ContentPageRenderer.cs6
-rw-r--r--Xamarin.Forms.Platform.Tizen/Renderers/FrameRenderer.cs54
-rw-r--r--Xamarin.Forms.Platform.Tizen/Renderers/LayoutRenderer.cs17
-rw-r--r--Xamarin.Forms.Platform.Tizen/Renderers/NavigationPageRenderer.cs11
-rw-r--r--Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs62
-rw-r--r--Xamarin.Forms.Platform.Tizen/Xamarin.Forms.Platform.Tizen.nuspec2
14 files changed, 108 insertions, 135 deletions
diff --git a/Xamarin.Forms.Maps.Tizen/Xamarin.Forms.Maps.Tizen.nuspec b/Xamarin.Forms.Maps.Tizen/Xamarin.Forms.Maps.Tizen.nuspec
index 23d0537f..555c1974 100644
--- a/Xamarin.Forms.Maps.Tizen/Xamarin.Forms.Maps.Tizen.nuspec
+++ b/Xamarin.Forms.Maps.Tizen/Xamarin.Forms.Maps.Tizen.nuspec
@@ -11,7 +11,7 @@
<description>Xamarin.Forms.Maps Renderer for Tizen.Net</description>
<copyright>Copyright 2016</copyright>
<dependencies>
- <dependency id="Xamarin.Forms.Maps" version="2.3.3.0" />
+ <dependency id="Xamarin.Forms.Maps" version="2.3.5.233-pre1" />
</dependencies>
</metadata>
<files>
diff --git a/Xamarin.Forms.Platform.Tizen/Cells/EntryCellRenderer.cs b/Xamarin.Forms.Platform.Tizen/Cells/EntryCellRenderer.cs
index 5db92394..1088d5c9 100644
--- a/Xamarin.Forms.Platform.Tizen/Cells/EntryCellRenderer.cs
+++ b/Xamarin.Forms.Platform.Tizen/Cells/EntryCellRenderer.cs
@@ -54,17 +54,21 @@ namespace Xamarin.Forms.Platform.Tizen
entry
}
};
- layout.Parent = cell.Parent;
+ layout.Parent = cell;
layout.BindingContext = entryCell;
layout.MinimumHeightRequest = Forms.ConvertToScaledDP(pixelHeight);
- var nativeView = Platform.GetOrCreateRenderer(layout).NativeView;
+ var renderer = Platform.GetOrCreateRenderer(layout);
+ (renderer as LayoutRenderer)?.RegisterOnLayoutUpdated();
+
+ var nativeView = renderer.NativeView;
nativeView.MinimumHeight = pixelHeight;
_cacheCandidate[nativeView] = layout;
nativeView.Deleted += (sender, e) =>
{
_cacheCandidate.Remove(sender as EvasObject);
};
+
return nativeView;
}
return null;
diff --git a/Xamarin.Forms.Platform.Tizen/Cells/ViewCellRenderer.cs b/Xamarin.Forms.Platform.Tizen/Cells/ViewCellRenderer.cs
index 38062c7c..261c7173 100644
--- a/Xamarin.Forms.Platform.Tizen/Cells/ViewCellRenderer.cs
+++ b/Xamarin.Forms.Platform.Tizen/Cells/ViewCellRenderer.cs
@@ -49,6 +49,8 @@ namespace Xamarin.Forms.Platform.Tizen
height = height > 0 ? height : FindCellContentHeight(viewCell);
renderer.NativeView.MinimumHeight = Forms.ConvertToScaledPixel(height);
+ (renderer as LayoutRenderer)?.RegisterOnLayoutUpdated();
+
return renderer.NativeView;
}
return null;
@@ -80,6 +82,7 @@ namespace Xamarin.Forms.Platform.Tizen
{
_cacheCandidate.Remove((EvasObject)sender);
};
+ (renderer as LayoutRenderer)?.RegisterOnLayoutUpdated();
return renderer.NativeView;
}
diff --git a/Xamarin.Forms.Platform.Tizen/Forms.cs b/Xamarin.Forms.Platform.Tizen/Forms.cs
index d9b73bf4..555b149e 100644
--- a/Xamarin.Forms.Platform.Tizen/Forms.cs
+++ b/Xamarin.Forms.Platform.Tizen/Forms.cs
@@ -15,6 +15,12 @@ namespace Xamarin.Forms.Platform.Tizen
static Lazy<int> s_dpi = new Lazy<int>(() =>
{
int dpi = 0;
+ var info = Device.Info as TizenDeviceInfo;
+ if (info != null && info.Profile == "tv")
+ {
+ // Use fixed DPI value (72) if TV profile
+ return 72;
+ }
TSystemInfo.TryGetValue<int>("http://tizen.org/feature/screen.dpi", out dpi);
return dpi;
});
@@ -69,6 +75,9 @@ namespace Xamarin.Forms.Platform.Tizen
public TizenDeviceInfo(FormsApplication formsApplication)
{
+ //TODO : Fix me if elm_config_profile_get() unavailable
+ profile = Elementary.GetProfile();
+
int width = 0;
int height = 0;
@@ -83,9 +92,6 @@ namespace Xamarin.Forms.Platform.Tizen
pixelScreenSize = new Size(width, height);
scaledScreenSize = new Size(width / scalingFactor, height / scalingFactor);
-
- //TODO : Fix me if elm_config_profile_get() unavailable
- profile = Elementary.GetProfile();
}
}
diff --git a/Xamarin.Forms.Platform.Tizen/Native/Box.cs b/Xamarin.Forms.Platform.Tizen/Native/Box.cs
index 2f551902..e2550e1a 100644
--- a/Xamarin.Forms.Platform.Tizen/Native/Box.cs
+++ b/Xamarin.Forms.Platform.Tizen/Native/Box.cs
@@ -40,24 +40,24 @@ namespace Xamarin.Forms.Platform.Tizen.Native
/// </remarks>
void NotifyOnLayout()
{
- var g = Geometry;
-
- if (0 == g.Width || 0 == g.Height)
- {
- // ignore irrelevant dimensions
- return;
- }
if (null != LayoutUpdated)
{
+ var g = Geometry;
+
+ if (0 == g.Width || 0 == g.Height || g == _previousGeometry)
+ {
+ // ignore irrelevant dimensions
+ return;
+ }
+
LayoutUpdated(this, new LayoutEventArgs()
{
- HasChanged = g != _previousGeometry,
Geometry = g,
}
);
- }
- _previousGeometry = g;
+ _previousGeometry = g;
+ }
}
}
}
diff --git a/Xamarin.Forms.Platform.Tizen/Native/LayoutEventArgs.cs b/Xamarin.Forms.Platform.Tizen/Native/LayoutEventArgs.cs
index 060a1212..ddad8039 100644
--- a/Xamarin.Forms.Platform.Tizen/Native/LayoutEventArgs.cs
+++ b/Xamarin.Forms.Platform.Tizen/Native/LayoutEventArgs.cs
@@ -9,21 +9,12 @@ namespace Xamarin.Forms.Platform.Tizen.Native
public class LayoutEventArgs : EventArgs
{
/// <summary>
- /// Whether or not the dimensions have changed.
- /// </summary>
- public bool HasChanged
- {
- get;
- internal set;
- }
-
- /// <summary>
/// Geometry of the layout area, absolute coordinate
/// </summary>
public Rect Geometry
{
get;
- set;
+ internal set;
}
}
}
diff --git a/Xamarin.Forms.Platform.Tizen/Native/ListView.cs b/Xamarin.Forms.Platform.Tizen/Native/ListView.cs
index fed99101..8501df10 100644
--- a/Xamarin.Forms.Platform.Tizen/Native/ListView.cs
+++ b/Xamarin.Forms.Platform.Tizen/Native/ListView.cs
@@ -595,6 +595,8 @@ namespace Xamarin.Forms.Platform.Tizen.Native
renderer.NativeView.MinimumHeight = Forms.ConvertToScaledPixel(element.MinimumHeightRequest);
}
+ (renderer as LayoutRenderer)?.RegisterOnLayoutUpdated();
+
return renderer.NativeView;
}
};
diff --git a/Xamarin.Forms.Platform.Tizen/Native/SearchBar.cs b/Xamarin.Forms.Platform.Tizen/Native/SearchBar.cs
index db597ed9..42ada16e 100644
--- a/Xamarin.Forms.Platform.Tizen/Native/SearchBar.cs
+++ b/Xamarin.Forms.Platform.Tizen/Native/SearchBar.cs
@@ -399,25 +399,20 @@ namespace Xamarin.Forms.Platform.Tizen.Native
/// <param name="e">Event arguments.</param>
void SearchBarLayoutUpdated(object sender, LayoutEventArgs e)
{
- if (!e.HasChanged)
- {
- return;
- }
-
- _underlineRectangle.Geometry = new ERect(Geometry.Left + RectanglePaddingHorizontal,
- Geometry.Top + EntryPaddingVertical + EntryHeight + RectanglePaddingTop,
- Geometry.Width - (RectanglePaddingHorizontal * 2),
- RectangleHeight);
-
- _entry.Geometry = new ERect(Geometry.Left + EntryPaddingHorizontal,
- Geometry.Top + EntryPaddingVertical,
- Geometry.Width - (EntryPaddingHorizontal + (CancelButtonPaddingHorizontal * 2) + CancelButtonSize),
- EntryHeight);
-
- _cancelButton.Geometry = new ERect(Geometry.Right - CancelButtonSize - CancelButtonPaddingHorizontal,
- Geometry.Top + RectanglePaddingBottom,
- CancelButtonSize,
- CancelButtonSize);
+ _underlineRectangle.Geometry = new ERect(e.Geometry.Left + RectanglePaddingHorizontal,
+ e.Geometry.Top + EntryPaddingVertical + EntryHeight + RectanglePaddingTop,
+ e.Geometry.Width - (RectanglePaddingHorizontal * 2),
+ RectangleHeight);
+
+ _entry.Geometry = new ERect(e.Geometry.Left + EntryPaddingHorizontal,
+ e.Geometry.Top + EntryPaddingVertical,
+ e.Geometry.Width - (EntryPaddingHorizontal + (CancelButtonPaddingHorizontal * 2) + CancelButtonSize),
+ EntryHeight);
+
+ _cancelButton.Geometry = new ERect(e.Geometry.Right - CancelButtonSize - CancelButtonPaddingHorizontal,
+ e.Geometry.Top + RectanglePaddingBottom,
+ CancelButtonSize,
+ CancelButtonSize);
}
}
}
diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/ContentPageRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/ContentPageRenderer.cs
index c4f79653..81a00a41 100644
--- a/Xamarin.Forms.Platform.Tizen/Renderers/ContentPageRenderer.cs
+++ b/Xamarin.Forms.Platform.Tizen/Renderers/ContentPageRenderer.cs
@@ -43,6 +43,11 @@ namespace Xamarin.Forms.Platform.Tizen
_page.Color = Element.BackgroundColor.ToNative();
}
+ protected override void UpdateLayout()
+ {
+ // empty on purpose
+ }
+
void UpdateBackgroundImage()
{
if (string.IsNullOrWhiteSpace(Element.BackgroundImage))
@@ -62,4 +67,3 @@ namespace Xamarin.Forms.Platform.Tizen
}
}
}
-
diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/FrameRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/FrameRenderer.cs
index 0684c4ac..0c815772 100644
--- a/Xamarin.Forms.Platform.Tizen/Renderers/FrameRenderer.cs
+++ b/Xamarin.Forms.Platform.Tizen/Renderers/FrameRenderer.cs
@@ -49,34 +49,7 @@ namespace Xamarin.Forms.Platform.Tizen
base.OnElementChanged(e);
}
- void OnLayoutUpdated(object sender, Native.LayoutEventArgs e)
- {
- UpdateGeometry();
- // TODO: why is this DoLayout() required?
- if (Element.Content != null)
- base.DoLayout(e);
- }
-
- void UpdateGeometry()
- {
- var geometry = NativeView.Geometry;
- DrawFrame(_frame,
- geometry.X,
- geometry.Y,
- geometry.Right,
- geometry.Bottom,
- _thickness
- );
- DrawFrame(_shadow,
- geometry.X + _shadow_shift,
- geometry.Y + _shadow_shift,
- geometry.Right - _thickness + _shadow_shift + _shadow_thickness,
- geometry.Bottom - _thickness + _shadow_shift + _shadow_thickness,
- _shadow_thickness
- );
- }
-
- void DrawFrame(Polygon frame, int left, int top, int right, int bottom, int thickness)
+ static void DrawFrame(Polygon frame, int left, int top, int right, int bottom, int thickness)
{
frame.ClearPoints();
if (left + thickness >= right || top + thickness >= bottom)
@@ -104,6 +77,30 @@ namespace Xamarin.Forms.Platform.Tizen
frame.AddPoint(left, top + thickness);
}
+ void OnLayoutUpdated(object sender, Native.LayoutEventArgs e)
+ {
+ UpdateGeometry();
+ }
+
+ void UpdateGeometry()
+ {
+ var geometry = NativeView.Geometry;
+ DrawFrame(_frame,
+ geometry.X,
+ geometry.Y,
+ geometry.Right,
+ geometry.Bottom,
+ _thickness
+ );
+ DrawFrame(_shadow,
+ geometry.X + _shadow_shift,
+ geometry.Y + _shadow_shift,
+ geometry.Right - _thickness + _shadow_shift + _shadow_thickness,
+ geometry.Bottom - _thickness + _shadow_shift + _shadow_thickness,
+ _shadow_thickness
+ );
+ }
+
void UpdateColor()
{
if (Element.OutlineColor.IsDefault)
@@ -119,6 +116,5 @@ namespace Xamarin.Forms.Platform.Tizen
else
_shadow.Hide();
}
-
}
}
diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/LayoutRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/LayoutRenderer.cs
index bf36afa4..2f723f3e 100644
--- a/Xamarin.Forms.Platform.Tizen/Renderers/LayoutRenderer.cs
+++ b/Xamarin.Forms.Platform.Tizen/Renderers/LayoutRenderer.cs
@@ -7,6 +7,8 @@ namespace Xamarin.Forms.Platform.Tizen
/// </summary>
public class LayoutRenderer : ViewRenderer<Layout, Native.Canvas>
{
+ bool _isLayoutUpdatedRegistered = false;
+
/// <summary>
/// Default constructor.
/// </summary>
@@ -14,12 +16,20 @@ namespace Xamarin.Forms.Platform.Tizen
{
}
+ public void RegisterOnLayoutUpdated()
+ {
+ if (!_isLayoutUpdatedRegistered)
+ {
+ Control.LayoutUpdated += OnLayoutUpdated;
+ _isLayoutUpdatedRegistered = true;
+ }
+ }
+
protected override void OnElementChanged(ElementChangedEventArgs<Layout> e)
{
if (null == Control)
{
var canvas = new Native.Canvas(Forms.Context.MainWindow);
- canvas.LayoutUpdated += OnLayoutUpdated;
SetNativeControl(canvas);
}
@@ -28,7 +38,10 @@ namespace Xamarin.Forms.Platform.Tizen
protected override void Dispose(bool disposing)
{
- Control.LayoutUpdated -= OnLayoutUpdated;
+ if (_isLayoutUpdatedRegistered)
+ {
+ Control.LayoutUpdated -= OnLayoutUpdated;
+ }
base.Dispose(disposing);
}
diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/NavigationPageRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/NavigationPageRenderer.cs
index a0cca4ed..bc1a2cb7 100644
--- a/Xamarin.Forms.Platform.Tizen/Renderers/NavigationPageRenderer.cs
+++ b/Xamarin.Forms.Platform.Tizen/Renderers/NavigationPageRenderer.cs
@@ -449,14 +449,9 @@ namespace Xamarin.Forms.Platform.Tizen
if (nre.Page == null)
throw new ArgumentNullException("page");
- Device.StartTimer(TimeSpan.FromMilliseconds(0), () =>
- {
- EvasObject page = Platform.GetOrCreateRenderer(nre.Page).NativeView;
- _naviFrame.InsertBefore(GetNaviItemForPage(nre.BeforePage), page, SpanTitle(nre.Page.Title));
-
- UpdateHasNavigationBar(nre.Page);
- return false;
- });
+ EvasObject page = Platform.GetOrCreateRenderer(nre.Page).NativeView;
+ _naviFrame.InsertBefore(GetNaviItemForPage(nre.BeforePage), page, SpanTitle(nre.Page.Title));
+ UpdateHasNavigationBar(nre.Page);
}
void AnimationFinishedHandler(object sender, EventArgs e)
diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs
index 512e3047..a3282a3f 100644
--- a/Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs
+++ b/Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs
@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.ComponentModel;
using Xamarin.Forms.Internals;
+using System.Linq;
using ElmSharp;
using ESize = ElmSharp.Size;
using ERect = ElmSharp.Rect;
@@ -44,9 +45,7 @@ namespace Xamarin.Forms.Platform.Tizen
HashSet<string> _batchedProperties = new HashSet<string>();
- int _layoutCallback = 0;
bool _movedCallbackEnabled = false;
-
/// <summary>
/// Default constructor.
/// </summary>
@@ -256,21 +255,10 @@ namespace Xamarin.Forms.Platform.Tizen
protected virtual void UpdateLayout()
{
- // we're updating the coordinates of native control only if they were modified
- // via Xamarin (IsNativeLayouting() returns false);
- // otherwise native control is already in the right place
- if (!IsNativeLayouting() && null != NativeView)
+ if (null != NativeView)
{
UpdateNativeGeometry();
}
-
- // we're updating just immediate children
- // To update the relative postion of children
- var logicalChildren = (Element as IElementController).LogicalChildren;
- foreach (var child in logicalChildren)
- {
- Platform.GetRenderer(child)?.UpdateNativeGeometry();
- }
}
/// <summary>
@@ -470,12 +458,10 @@ namespace Xamarin.Forms.Platform.Tizen
{
if (_flags.HasFlag(VisualElementRendererFlags.NeedsLayout))
{
- if (!IsNativeLayouting())
- {
- UpdateNativeGeometry();
- // UpdateLayout already updates transformation, clear NeedsTranformation flag then
- _flags &= ~VisualElementRendererFlags.NeedsTransformation;
- }
+ UpdateLayout();
+ // UpdateLayout already updates transformation, clear NeedsTranformation flag then
+ _flags &= ~VisualElementRendererFlags.NeedsTransformation;
+
_flags ^= VisualElementRendererFlags.NeedsLayout;
}
if (_flags.HasFlag(VisualElementRendererFlags.NeedsTransformation))
@@ -537,14 +523,14 @@ namespace Xamarin.Forms.Platform.Tizen
/// <param name="initialization">If set to <c>true</c> the method is called for an uninitialized object.</param>
protected void UpdateAllProperties(bool initialization)
{
- foreach (KeyValuePair<string, Action<bool>> kvp in _propertyHandlersWithInit)
+ foreach (var action in _propertyHandlersWithInit.Values.Distinct())
{
- kvp.Value(initialization);
+ action(initialization);
}
- foreach (KeyValuePair<string, Action> kvp in _propertyHandlers)
+ foreach (var action in _propertyHandlers.Values.Distinct())
{
- kvp.Value();
+ action();
}
}
@@ -558,16 +544,7 @@ namespace Xamarin.Forms.Platform.Tizen
protected void DoLayout(Native.LayoutEventArgs e)
{
- EnterNativeLayoutCallback();
- if (e.HasChanged)
- {
- var bound = e.Geometry.ToDP();
- bound.X = Element.X;
- bound.Y = Element.Y;
- Element.Layout(bound);
- UpdateLayout();
- }
- LeaveNativeLayoutCallback();
+ Element.Layout(e.Geometry.ToDP());
}
protected virtual Size MinimumSize()
@@ -610,12 +587,12 @@ namespace Xamarin.Forms.Platform.Tizen
static double ComputeAbsoluteX(VisualElement e)
{
- return e.X + (e.RealParent is VisualElement ? Forms.ConvertToScaledDP(Platform.GetRenderer(e.RealParent).NativeView.Geometry.X) : 0.0);
+ return e.X + ((e.RealParent is VisualElement) && !(e.RealParent is ListView) ? Forms.ConvertToScaledDP(Platform.GetRenderer(e.RealParent).NativeView.Geometry.X) : 0.0);
}
static double ComputeAbsoluteY(VisualElement e)
{
- return e.Y + (e.RealParent is VisualElement ? Forms.ConvertToScaledDP(Platform.GetRenderer(e.RealParent).NativeView.Geometry.Y) : 0.0);
+ return e.Y + ((e.RealParent is VisualElement) && !(e.RealParent is ListView) ? Forms.ConvertToScaledDP(Platform.GetRenderer(e.RealParent).NativeView.Geometry.Y) : 0.0);
}
static Point ComputeAbsolutePoint(VisualElement e)
@@ -1048,18 +1025,5 @@ namespace Xamarin.Forms.Platform.Tizen
return EFocusDirection.Next;
}
-
- void EnterNativeLayoutCallback()
- {
- _layoutCallback++;
- }
- void LeaveNativeLayoutCallback()
- {
- _layoutCallback--;
- }
- bool IsNativeLayouting()
- {
- return _layoutCallback > 0;
- }
}
}
diff --git a/Xamarin.Forms.Platform.Tizen/Xamarin.Forms.Platform.Tizen.nuspec b/Xamarin.Forms.Platform.Tizen/Xamarin.Forms.Platform.Tizen.nuspec
index b9b952c1..7b5e79cb 100644
--- a/Xamarin.Forms.Platform.Tizen/Xamarin.Forms.Platform.Tizen.nuspec
+++ b/Xamarin.Forms.Platform.Tizen/Xamarin.Forms.Platform.Tizen.nuspec
@@ -12,7 +12,7 @@
<description>Xamarin Forms Renderer to build native UIs for Tizen.Net</description>
<copyright>Copyright 2016</copyright>
<dependencies>
- <dependency id="Xamarin.Forms" version="2.3.4.214-pre5" />
+ <dependency id="Xamarin.Forms" version="2.3.5.233-pre1" />
</dependencies>
</metadata>
<files>