From 4df442f5fbc0efce81bbb13dfbcdb64e223fd60e Mon Sep 17 00:00:00 2001 From: Seungkeun Lee Date: Fri, 25 May 2018 23:37:13 +0900 Subject: [PATCH] [Tizen] Fix minor bugs (#2830) - BoxView geometry issue - IsFocusAllowed platform specific issue - PropagateEvents Issue --- .../Cells/EntryCellRenderer.cs | 1 + .../Cells/SwitchCellRenderer.cs | 5 ++++- .../Cells/ViewCellRenderer.cs | 1 + .../Native/RoundRectangle.cs | 3 +++ .../Renderers/ButtonRenderer.cs | 5 +---- .../Renderers/EditorRenderer.cs | 1 - .../Renderers/EntryRenderer.cs | 1 - .../Renderers/SliderRenderer.cs | 5 +---- .../Renderers/SwitchRenderer.cs | 1 - .../Renderers/VisualElementRenderer.cs | 19 ++++++++----------- 10 files changed, 19 insertions(+), 23 deletions(-) diff --git a/Xamarin.Forms.Platform.Tizen/Cells/EntryCellRenderer.cs b/Xamarin.Forms.Platform.Tizen/Cells/EntryCellRenderer.cs index 1088d5c91..6bfb422aa 100644 --- a/Xamarin.Forms.Platform.Tizen/Cells/EntryCellRenderer.cs +++ b/Xamarin.Forms.Platform.Tizen/Cells/EntryCellRenderer.cs @@ -62,6 +62,7 @@ namespace Xamarin.Forms.Platform.Tizen (renderer as LayoutRenderer)?.RegisterOnLayoutUpdated(); var nativeView = renderer.NativeView; + nativeView.PropagateEvents = false; nativeView.MinimumHeight = pixelHeight; _cacheCandidate[nativeView] = layout; nativeView.Deleted += (sender, e) => diff --git a/Xamarin.Forms.Platform.Tizen/Cells/SwitchCellRenderer.cs b/Xamarin.Forms.Platform.Tizen/Cells/SwitchCellRenderer.cs index bb52d5dfd..c9b61d1b9 100644 --- a/Xamarin.Forms.Platform.Tizen/Cells/SwitchCellRenderer.cs +++ b/Xamarin.Forms.Platform.Tizen/Cells/SwitchCellRenderer.cs @@ -48,7 +48,10 @@ namespace Xamarin.Forms.Platform.Tizen if (Device.Idiom == TargetIdiom.TV) { ((Check)nativeView).AllowFocus(false); - ((Check)nativeView).PropagateEvents = true; + } + else + { + nativeView.PropagateEvents = false; } return nativeView; diff --git a/Xamarin.Forms.Platform.Tizen/Cells/ViewCellRenderer.cs b/Xamarin.Forms.Platform.Tizen/Cells/ViewCellRenderer.cs index 261c71734..446668da8 100644 --- a/Xamarin.Forms.Platform.Tizen/Cells/ViewCellRenderer.cs +++ b/Xamarin.Forms.Platform.Tizen/Cells/ViewCellRenderer.cs @@ -49,6 +49,7 @@ namespace Xamarin.Forms.Platform.Tizen height = height > 0 ? height : FindCellContentHeight(viewCell); renderer.NativeView.MinimumHeight = Forms.ConvertToScaledPixel(height); + renderer.NativeView.PropagateEvents = false; (renderer as LayoutRenderer)?.RegisterOnLayoutUpdated(); return renderer.NativeView; diff --git a/Xamarin.Forms.Platform.Tizen/Native/RoundRectangle.cs b/Xamarin.Forms.Platform.Tizen/Native/RoundRectangle.cs index 4a7cfbb2f..0f6b581de 100644 --- a/Xamarin.Forms.Platform.Tizen/Native/RoundRectangle.cs +++ b/Xamarin.Forms.Platform.Tizen/Native/RoundRectangle.cs @@ -41,6 +41,9 @@ namespace Xamarin.Forms.Platform.Tizen.Native Width = bound.Width; Height = bound.Height; Draw(); + // It is workaround for fix geometry issue + // A polygon make a margin of 1 pixel at the outermost point + Geometry = bound; } diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/ButtonRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/ButtonRenderer.cs index 4c95f673e..ee6c77b43 100644 --- a/Xamarin.Forms.Platform.Tizen/Renderers/ButtonRenderer.cs +++ b/Xamarin.Forms.Platform.Tizen/Renderers/ButtonRenderer.cs @@ -23,10 +23,7 @@ namespace Xamarin.Forms.Platform.Tizen { if (Control == null) { - SetNativeControl(new Native.Button(Forms.NativeParent) - { - PropagateEvents = false, - }); + SetNativeControl(new Native.Button(Forms.NativeParent)); Control.Clicked += OnButtonClicked; Control.Pressed += OnButtonPressed; Control.Released += OnButtonReleased; diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/EditorRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/EditorRenderer.cs index bbd735796..4816524ab 100644 --- a/Xamarin.Forms.Platform.Tizen/Renderers/EditorRenderer.cs +++ b/Xamarin.Forms.Platform.Tizen/Renderers/EditorRenderer.cs @@ -26,7 +26,6 @@ namespace Xamarin.Forms.Platform.Tizen var entry = Device.Idiom == TargetIdiom.Phone || Device.Idiom == TargetIdiom.TV ? new Native.EditfieldEntry(Forms.NativeParent, "multiline") : new Native.Entry(Forms.NativeParent) { IsSingleLine = false, - PropagateEvents = false, }; entry.Focused += OnFocused; entry.Unfocused += OnUnfocused; diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/EntryRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/EntryRenderer.cs index d8edefc5b..57c123549 100644 --- a/Xamarin.Forms.Platform.Tizen/Renderers/EntryRenderer.cs +++ b/Xamarin.Forms.Platform.Tizen/Renderers/EntryRenderer.cs @@ -35,7 +35,6 @@ namespace Xamarin.Forms.Platform.Tizen var entry = new Native.EditfieldEntry(Forms.NativeParent) { IsSingleLine = true, - PropagateEvents = false, }; entry.SetVerticalTextAlignment("elm.text", 0.5); entry.SetVerticalTextAlignment("elm.guide", 0.5); diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/SliderRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/SliderRenderer.cs index 54e1b26a2..58e887637 100644 --- a/Xamarin.Forms.Platform.Tizen/Renderers/SliderRenderer.cs +++ b/Xamarin.Forms.Platform.Tizen/Renderers/SliderRenderer.cs @@ -16,10 +16,7 @@ namespace Xamarin.Forms.Platform.Tizen { if (Control == null) { - SetNativeControl(new ESlider(Forms.NativeParent) - { - PropagateEvents = false, - }); + SetNativeControl(new ESlider(Forms.NativeParent)); Control.ValueChanged += OnValueChanged; _defaultMinColor = Control.GetPartColor("bar"); _defaultMaxColor = Control.GetPartColor("bg"); diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/SwitchRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/SwitchRenderer.cs index 825431ff8..987c84cb8 100644 --- a/Xamarin.Forms.Platform.Tizen/Renderers/SwitchRenderer.cs +++ b/Xamarin.Forms.Platform.Tizen/Renderers/SwitchRenderer.cs @@ -26,7 +26,6 @@ namespace Xamarin.Forms.Platform.Tizen { SetNativeControl(new Check(Forms.NativeParent) { - PropagateEvents = false, Style = SwitchStyle.Toggle }); Control.StateChanged += OnStateChanged; diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs index 18de6cd87..f61e86e2b 100644 --- a/Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs +++ b/Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs @@ -795,19 +795,16 @@ namespace Xamarin.Forms.Platform.Tizen { } - void UpdateFocusAllowed(bool initialize) + void UpdateFocusAllowed() { - if (!initialize) + var widget = NativeView as Widget; + if (widget != null && Specific.IsFocusAllowed(Element).HasValue) { - var widget = NativeView as Widget; - if (widget != null && Specific.IsFocusAllowed(Element).HasValue) - { - widget.AllowFocus((bool)Specific.IsFocusAllowed(Element)); - } - else - { - Log.Warn("{0} uses {1} which does not support Focus management", this, NativeView); - } + widget.AllowFocus((bool)Specific.IsFocusAllowed(Element)); + } + else + { + Log.Warn("{0} uses {1} which does not support Focus management", this, NativeView); } }