diff options
author | Seungkeun Lee <sngn.lee@samsung.com> | 2017-06-21 11:25:25 +0900 |
---|---|---|
committer | Kangho Hur <kangho.hur@samsung.com> | 2017-07-10 11:11:27 +0900 |
commit | 535265c5ad415d89ea596385ac4d75436f957a3a (patch) | |
tree | 870bfa384cc47a4eea643ce525895ded1a5613a2 /Xamarin.Forms.Platform.Tizen/Renderers | |
parent | 3dae3f36abba30dfb5e3faaca653f007dbdf435e (diff) | |
download | xamarin-forms-535265c5ad415d89ea596385ac4d75436f957a3a.tar.gz xamarin-forms-535265c5ad415d89ea596385ac4d75436f957a3a.tar.bz2 xamarin-forms-535265c5ad415d89ea596385ac4d75436f957a3a.zip |
Remove unnecessary update at initialize
Change-Id: Ia6e1bcfa7c7ceb35b7b0c8d17376ebecb05f0d97
Diffstat (limited to 'Xamarin.Forms.Platform.Tizen/Renderers')
9 files changed, 65 insertions, 17 deletions
diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/ActivityIndicatorRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/ActivityIndicatorRenderer.cs index 65407622..25e891cf 100755..100644 --- a/Xamarin.Forms.Platform.Tizen/Renderers/ActivityIndicatorRenderer.cs +++ b/Xamarin.Forms.Platform.Tizen/Renderers/ActivityIndicatorRenderer.cs @@ -36,8 +36,11 @@ namespace Xamarin.Forms.Platform.Tizen base.OnElementChanged(e); } - void UpdateColor() + void UpdateColor(bool initialize) { + if (initialize && Element.Color.IsDefault) + return; + Control.Color = (Element.Color == Color.Default) ? s_defaultColor : Element.Color.ToNative(); } diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/BoxViewRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/BoxViewRenderer.cs index f34bd322..ff23d67a 100644 --- a/Xamarin.Forms.Platform.Tizen/Renderers/BoxViewRenderer.cs +++ b/Xamarin.Forms.Platform.Tizen/Renderers/BoxViewRenderer.cs @@ -31,13 +31,22 @@ namespace Xamarin.Forms.Platform.Tizen base.OnElementPropertyChanged(sender, e); } - protected override void UpdateBackgroundColor() + protected override void UpdateBackgroundColor(bool initialize) { - UpdateColor(); + if (initialize && Element.BackgroundColor.IsDefault) + return; + + if (Element.Color.IsDefault) + { + UpdateColor(); + } } - protected override void UpdateOpacity() + protected override void UpdateOpacity(bool initialize) { + if (initialize && Element.Opacity == 1d) + return; + UpdateColor(); } diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/ButtonRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/ButtonRenderer.cs index c44c6294..97b07bb7 100644 --- a/Xamarin.Forms.Platform.Tizen/Renderers/ButtonRenderer.cs +++ b/Xamarin.Forms.Platform.Tizen/Renderers/ButtonRenderer.cs @@ -95,8 +95,12 @@ namespace Xamarin.Forms.Platform.Tizen protected override void UpdateThemeStyle() { - Control.UpdateStyle(Specific.GetStyle(Element)); - ((IVisualElementController)Element).NativeSizeChanged(); + var style = Specific.GetStyle(Element); + if (!string.IsNullOrEmpty(style)) + { + Control.UpdateStyle(style); + ((IVisualElementController)Element).NativeSizeChanged(); + } } void UpdateBorder() diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/ContentPageRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/ContentPageRenderer.cs index 81a00a41..974cf384 100644 --- a/Xamarin.Forms.Platform.Tizen/Renderers/ContentPageRenderer.cs +++ b/Xamarin.Forms.Platform.Tizen/Renderers/ContentPageRenderer.cs @@ -34,8 +34,11 @@ namespace Xamarin.Forms.Platform.Tizen base.OnElementChanged(e); } - protected override void UpdateBackgroundColor() + protected override void UpdateBackgroundColor(bool initialize) { + if (initialize && Element.BackgroundColor.IsDefault) + return; + // base.UpdateBackgroundColor() is not called on purpose, we don't want the regular background setting if (Element.BackgroundColor.IsDefault || Element.BackgroundColor.A == 0) _page.Color = EColor.Transparent; @@ -48,8 +51,11 @@ namespace Xamarin.Forms.Platform.Tizen // empty on purpose } - void UpdateBackgroundImage() + void UpdateBackgroundImage(bool initiaize) { + if (initiaize && string.IsNullOrWhiteSpace(Element.BackgroundImage)) + return; + if (string.IsNullOrWhiteSpace(Element.BackgroundImage)) _page.File = null; else diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/EditorRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/EditorRenderer.cs index ff96a677..b904b7da 100644 --- a/Xamarin.Forms.Platform.Tizen/Renderers/EditorRenderer.cs +++ b/Xamarin.Forms.Platform.Tizen/Renderers/EditorRenderer.cs @@ -77,8 +77,11 @@ namespace Xamarin.Forms.Platform.Tizen Control.FontAttributes = Element.FontAttributes; } - void UpdateKeyboard() + void UpdateKeyboard(bool initialize) { + if (initialize && Element.Keyboard == Keyboard.Default) + return; + Control.Keyboard = Element.Keyboard.ToNative(); } } diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/EntryRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/EntryRenderer.cs index f269869e..3274ec3e 100644 --- a/Xamarin.Forms.Platform.Tizen/Renderers/EntryRenderer.cs +++ b/Xamarin.Forms.Platform.Tizen/Renderers/EntryRenderer.cs @@ -111,8 +111,11 @@ namespace Xamarin.Forms.Platform.Tizen Control.HorizontalTextAlignment = Element.HorizontalTextAlignment.ToNative(); } - void UpdateKeyboard() + void UpdateKeyboard(bool initialize) { + if (initialize && Element.Keyboard == Keyboard.Default) + return; + Control.Keyboard = Element.Keyboard.ToNative(); } diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/ListViewRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/ListViewRenderer.cs index fff21794..a602ae01 100644 --- a/Xamarin.Forms.Platform.Tizen/Renderers/ListViewRenderer.cs +++ b/Xamarin.Forms.Platform.Tizen/Renderers/ListViewRenderer.cs @@ -347,8 +347,11 @@ namespace Xamarin.Forms.Platform.Tizen /// <summary> /// Updates the height of the row. /// </summary> - void UpdateRowHeight() + void UpdateRowHeight(bool initialize) { + if (initialize) + return; + Control.UpdateRealizedItems(); } diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/SwitchRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/SwitchRenderer.cs index da00ef9f..e0b54d51 100644 --- a/Xamarin.Forms.Platform.Tizen/Renderers/SwitchRenderer.cs +++ b/Xamarin.Forms.Platform.Tizen/Renderers/SwitchRenderer.cs @@ -20,6 +20,7 @@ namespace Xamarin.Forms.Platform.Tizen var _switch = new Check(Forms.Context.MainWindow) { PropagateEvents = false, + Style = SwitchStyle.Toggle }; SetNativeControl(_switch); } @@ -40,6 +41,10 @@ namespace Xamarin.Forms.Platform.Tizen protected override void UpdateThemeStyle() { var style = Specific.GetStyle(Element); + if (string.IsNullOrEmpty(style)) + { + return; + } switch (style) { case SwitchStyle.Toggle: diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs index f40ece7e..0e762987 100644 --- a/Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs +++ b/Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs @@ -566,8 +566,11 @@ namespace Xamarin.Forms.Platform.Tizen return new ESize(NativeView.MinimumWidth, NativeView.MinimumHeight); } - protected virtual void UpdateBackgroundColor() + protected virtual void UpdateBackgroundColor(bool initialize) { + if (initialize && Element.BackgroundColor.IsDefault) + return; + if (NativeView is Widget) { (NativeView as Widget).BackgroundColor = Element.BackgroundColor.ToNative(); @@ -578,8 +581,11 @@ namespace Xamarin.Forms.Platform.Tizen } } - protected virtual void UpdateOpacity() + protected virtual void UpdateOpacity(bool initialize) { + if (initialize && Element.Opacity == 1d) + return; + if (NativeView is Widget) { (NativeView as Widget).Opacity = (int)(Element.Opacity * 255.0); @@ -764,8 +770,11 @@ namespace Xamarin.Forms.Platform.Tizen /// <summary> /// Updates the IsEnabled property. /// </summary> - void UpdateIsEnabled() + void UpdateIsEnabled(bool initialize) { + if (initialize && Element.IsEnabled) + return; + var widget = NativeView as Widget; if (widget != null) { @@ -776,8 +785,11 @@ namespace Xamarin.Forms.Platform.Tizen /// <summary> /// Updates the InputTransparent property. /// </summary> - void UpdateInputTransparent() + void UpdateInputTransparent(bool initialize) { + if (initialize && Element.InputTransparent == default(bool)) + return; + NativeView.PassEvents = Element.InputTransparent; } @@ -818,14 +830,14 @@ namespace Xamarin.Forms.Platform.Tizen } } - void UpdateToolTip() + void UpdateToolTip(bool initialize) { var tooltip = Specific.GetToolTip(Element); if (tooltip != null) { NativeView.SetTooltipText(tooltip); } - else + else if (!initialize) { NativeView.UnsetTooltip(); } |