Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.

Commit 304023d

Browse files
authored
[Tizen] Enhances the shell renderer (#12119)
* Update calculation of absolute coordination * Enhancement Shell renderer * Apply device size independent scaling * Refactoring NavigationView structure * Fix Shell.FlyoutBehavior.Disabled * Update scale * Remove public symbol * Update ThemeManager for Shell and DisplayResolutionUnit * Change navigation stack default background color
1 parent 204380d commit 304023d

29 files changed

+2021
-1567
lines changed

Xamarin.Forms.Material.Tizen/Shell/MaterialNavigationDrawer.cs

Lines changed: 0 additions & 19 deletions
This file was deleted.

Xamarin.Forms.Material.Tizen/Shell/MaterialNavigationView.cs

Lines changed: 0 additions & 115 deletions
This file was deleted.

Xamarin.Forms.Material.Tizen/Shell/MaterialShellItemRenderer.cs

Lines changed: 0 additions & 21 deletions
This file was deleted.

Xamarin.Forms.Material.Tizen/Shell/MaterialShellRenderer.cs

Lines changed: 0 additions & 25 deletions
This file was deleted.

Xamarin.Forms.Material.Tizen/Shell/MaterialShellSectionNavigation.cs

Lines changed: 0 additions & 16 deletions
This file was deleted.

Xamarin.Forms.Material.Tizen/Shell/MaterialShellSectionRenderer.cs

Lines changed: 0 additions & 16 deletions
This file was deleted.

Xamarin.Forms.Material.Tizen/Shell/MaterialShellTabs.cs

Lines changed: 0 additions & 30 deletions
This file was deleted.

Xamarin.Forms.Platform.Tizen/Forms.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,8 @@ public override Size ScaledScreenSize
160160
}
161161
}
162162

163+
public Size PhysicalScreenSize { get; }
164+
163165
public override double ScalingFactor
164166
{
165167
get
@@ -184,6 +186,9 @@ public TizenDeviceInfo()
184186
TSystemInfo.TryGetValue("http://tizen.org/feature/screen.width", out width);
185187
TSystemInfo.TryGetValue("http://tizen.org/feature/screen.height", out height);
186188

189+
var physicalScale = s_dpi.Value / 160.0;
190+
PhysicalScreenSize = new Size(width / physicalScale, height / physicalScale);
191+
187192
scalingFactor = 1.0; // scaling is disabled, we're using pixels as Xamarin's geometry units
188193
if (DisplayResolutionUnit.UseVP && DisplayResolutionUnit.ViewportWidth > 0)
189194
{
@@ -198,9 +203,7 @@ public TizenDeviceInfo()
198203

199204
if (DisplayResolutionUnit.UseDeviceScale)
200205
{
201-
var physicalScale = s_dpi.Value / 160.0;
202-
203-
var portraitSize = (Math.Min(width, height)) / physicalScale;
206+
var portraitSize = Math.Min(PhysicalScreenSize.Width, PhysicalScreenSize.Height);
204207
if (portraitSize > 2000)
205208
{
206209
scalingFactor *= 4;
@@ -266,6 +269,10 @@ public static bool IsInitialized
266269

267270
public static DisplayResolutionUnit DisplayResolutionUnit { get; private set; }
268271

272+
public static int ScreenDPI => s_dpi.Value;
273+
274+
public static Size PhysicalScreenSize => (Device.info as TizenDeviceInfo).PhysicalScreenSize;
275+
269276
internal static TizenTitleBarVisibility TitleBarVisibility
270277
{
271278
get;

Xamarin.Forms.Platform.Tizen/Renderers/LayoutRenderer.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
using ElmSharp;
2-
using System;
31
using System.ComponentModel;
42

53
namespace Xamarin.Forms.Platform.Tizen
@@ -86,6 +84,17 @@ protected override void UpdateInputTransparent(bool initialize)
8684
GestureDetector.InputTransparent = Element.InputTransparent;
8785
}
8886
}
87+
protected override void UpdateLayout()
88+
{
89+
if (!_layoutUpdatedRegistered)
90+
{
91+
base.UpdateLayout();
92+
}
93+
else
94+
{
95+
ApplyTransformation();
96+
}
97+
}
8998

9099
void OnLayoutUpdated(object sender, Native.LayoutEventArgs e)
91100
{

Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -677,12 +677,12 @@ public virtual ERect GetNativeContentGeometry()
677677

678678
static double ComputeAbsoluteX(VisualElement e)
679679
{
680-
return e.X + ((e.RealParent is VisualElement) && !(e.RealParent is ListView || e.RealParent is ItemsView) ? Forms.ConvertToScaledDP(Platform.GetRenderer(e.RealParent).GetNativeContentGeometry().X) : 0.0);
680+
return e.X + ((e.RealParent is VisualElement) ? Forms.ConvertToScaledDP(Platform.GetRenderer(e.RealParent).GetNativeContentGeometry().X) : 0.0);
681681
}
682682

683683
static double ComputeAbsoluteY(VisualElement e)
684684
{
685-
return e.Y + ((e.RealParent is VisualElement) && !(e.RealParent is ListView || e.RealParent is ItemsView) ? Forms.ConvertToScaledDP(Platform.GetRenderer(e.RealParent).GetNativeContentGeometry().Y) : 0.0);
685+
return e.Y + ((e.RealParent is VisualElement) ? Forms.ConvertToScaledDP(Platform.GetRenderer(e.RealParent).GetNativeContentGeometry().Y) : 0.0);
686686
}
687687

688688
static Point ComputeAbsolutePoint(VisualElement e)

0 commit comments

Comments
 (0)