summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs
diff options
context:
space:
mode:
authorKangho Hur <kangho.hur@samsung.com>2017-07-10 06:42:16 +0000
committerKangho Hur <kangho.hur@samsung.com>2017-10-23 13:34:38 +0900
commitf2241f6713c416f509d1e48e8ecdf77517675ec7 (patch)
tree431bf2692e75734df434efbc98628deeffe41411 /Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs
parenta605093b48e4199f2f6aea6d8884c2315256d049 (diff)
downloadxamarin-forms-f2241f6713c416f509d1e48e8ecdf77517675ec7.tar.gz
xamarin-forms-f2241f6713c416f509d1e48e8ecdf77517675ec7.tar.bz2
xamarin-forms-f2241f6713c416f509d1e48e8ecdf77517675ec7.zip
Revert "Move registration of property handles to static constructors"
This reverts commit 509e6f117c9966e5503deb8ff1c5135b41eb2a3e. Change-Id: Icb16fdc0b1006405a92e4e5ef77f20749c2ce3e5
Diffstat (limited to 'Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs')
-rw-r--r--Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs74
1 files changed, 34 insertions, 40 deletions
diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs
index 5b80bd01..a6c1c3a3 100644
--- a/Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs
+++ b/Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs
@@ -33,38 +33,37 @@ namespace Xamarin.Forms.Platform.Tizen
/// </summary>
EvasObject _view;
- static Dictionary<string, Action<VisualElementRenderer<TElement>, bool>> s_propertyHandlersWithInit = new Dictionary<string, Action<VisualElementRenderer<TElement>, bool>>();
+ Dictionary<string, Action<bool>> _propertyHandlersWithInit = new Dictionary<string, Action<bool>>();
- static Dictionary<string, Action<VisualElementRenderer<TElement>>> s_propertyHandlers = new Dictionary<string, Action<VisualElementRenderer<TElement>>>();
+ Dictionary<string, Action> _propertyHandlers = new Dictionary<string, Action>();
HashSet<string> _batchedProperties = new HashSet<string>();
bool _movedCallbackEnabled = false;
-
/// <summary>
/// Default constructor.
/// </summary>
- static VisualElementRenderer()
+ protected VisualElementRenderer()
{
- RegisterPropertyHandler(VisualElement.IsVisibleProperty, (r) => r.UpdateIsVisible());
- RegisterPropertyHandler(VisualElement.OpacityProperty, (r, i) => r.UpdateOpacity(i));
- RegisterPropertyHandler(VisualElement.IsEnabledProperty, (r, i) => r.UpdateIsEnabled(i));
- RegisterPropertyHandler(VisualElement.InputTransparentProperty, (r, i) => r.UpdateInputTransparent(i));
- RegisterPropertyHandler(VisualElement.BackgroundColorProperty, (r, i) => r.UpdateBackgroundColor(i));
+ RegisterPropertyHandler(VisualElement.IsVisibleProperty, UpdateIsVisible);
+ RegisterPropertyHandler(VisualElement.OpacityProperty, UpdateOpacity);
+ RegisterPropertyHandler(VisualElement.IsEnabledProperty, UpdateIsEnabled);
+ RegisterPropertyHandler(VisualElement.InputTransparentProperty, UpdateInputTransparent);
+ RegisterPropertyHandler(VisualElement.BackgroundColorProperty, UpdateBackgroundColor);
// Use TizenSpecific APIs only if available
if (TizenPlatformServices.AppDomain.IsTizenSpecificAvailable)
{
- RegisterPropertyHandler("ThemeStyle", (r) => r.UpdateThemeStyle());
- RegisterPropertyHandler("IsFocusAllowed", (r, i) => r.UpdateFocusAllowed(i));
- RegisterPropertyHandler("NextFocusDirection", (r, i) => r.UpdateFocusDirection(i));
- RegisterPropertyHandler("NextFocusUpView", (r, i) => r.UpdateFocusUpView(i));
- RegisterPropertyHandler("NextFocusDownView", (r, i) => r.UpdateFocusDownView(i));
- RegisterPropertyHandler("NextFocusLeftView", (r, i) => r.UpdateFocusLeftView(i));
- RegisterPropertyHandler("NextFocusRightView", (r, i) => r.UpdateFocusRightView(i));
- RegisterPropertyHandler("NextFocusBackView", (r, i) => r.UpdateFocusBackView(i));
- RegisterPropertyHandler("NextFocusForwardView", (r, i) => r.UpdateFocusForwardView(i));
- RegisterPropertyHandler("ToolTip", (r, i) => r.UpdateToolTip(i));
+ RegisterPropertyHandler("ThemeStyle", UpdateThemeStyle);
+ RegisterPropertyHandler("IsFocusAllowed", UpdateFocusAllowed);
+ RegisterPropertyHandler("NextFocusDirection", UpdateFocusDirection);
+ RegisterPropertyHandler("NextFocusUpView", UpdateFocusUpView);
+ RegisterPropertyHandler("NextFocusDownView", UpdateFocusDownView);
+ RegisterPropertyHandler("NextFocusLeftView", UpdateFocusLeftView);
+ RegisterPropertyHandler("NextFocusRightView", UpdateFocusRightView);
+ RegisterPropertyHandler("NextFocusBackView", UpdateFocusBackView);
+ RegisterPropertyHandler("NextFocusForwardView", UpdateFocusForwardView);
+ RegisterPropertyHandler("ToolTip", UpdateToolTip);
}
RegisterPropertyHandler(VisualElement.AnchorXProperty, ApplyTransformation);
@@ -382,17 +381,17 @@ namespace Xamarin.Forms.Platform.Tizen
return;
}
- Action<VisualElementRenderer<TElement>, bool> init;
- if (s_propertyHandlersWithInit.TryGetValue(e.PropertyName, out init))
+ Action<bool> init;
+ if (_propertyHandlersWithInit.TryGetValue(e.PropertyName, out init))
{
- init(this, false);
+ init(false);
}
else
{
- Action<VisualElementRenderer<TElement>> handler;
- if (s_propertyHandlers.TryGetValue(e.PropertyName, out handler))
+ Action handler;
+ if (_propertyHandlers.TryGetValue(e.PropertyName, out handler))
{
- handler(this);
+ handler();
}
}
}
@@ -481,7 +480,7 @@ namespace Xamarin.Forms.Platform.Tizen
/// </summary>
/// <param name="property">Handled property.</param>
/// <param name="handler">Action to be executed when property changes.</param>
- protected static void RegisterPropertyHandler(BindableProperty property, Action<VisualElementRenderer<TElement>, bool> handler)
+ protected void RegisterPropertyHandler(BindableProperty property, Action<bool> handler)
{
RegisterPropertyHandler(property.PropertyName, handler);
}
@@ -491,9 +490,9 @@ namespace Xamarin.Forms.Platform.Tizen
/// </summary>
/// <param name="name">Name of the handled property.</param>
/// <param name="handler">Action to be executed when property changes.</param>
- protected static void RegisterPropertyHandler(string name, Action<VisualElementRenderer<TElement>, bool> handler)
+ protected void RegisterPropertyHandler(string name, Action<bool> handler)
{
- s_propertyHandlersWithInit.Add(name, handler);
+ _propertyHandlersWithInit.Add(name, handler);
}
/// <summary>
@@ -501,7 +500,7 @@ namespace Xamarin.Forms.Platform.Tizen
/// </summary>
/// <param name="property">Handled property.</param>
/// <param name="handler">Action to be executed when property changes.</param>
- protected static void RegisterPropertyHandler(BindableProperty property, Action<VisualElementRenderer<TElement>> handler)
+ protected void RegisterPropertyHandler(BindableProperty property, Action handler)
{
RegisterPropertyHandler(property.PropertyName, handler);
}
@@ -511,9 +510,9 @@ namespace Xamarin.Forms.Platform.Tizen
/// </summary>
/// <param name="name">Name of the handled property.</param>
/// <param name="handler">Action to be executed when property changes.</param>
- protected static void RegisterPropertyHandler(string name, Action<VisualElementRenderer<TElement>> handler)
+ protected void RegisterPropertyHandler(string name, Action handler)
{
- s_propertyHandlers.Add(name, handler);
+ _propertyHandlers.Add(name, handler);
}
/// <summary>
@@ -522,14 +521,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 (var action in s_propertyHandlersWithInit.Values.Distinct())
+ foreach (var action in _propertyHandlersWithInit.Values.Distinct())
{
- action(this, initialization);
+ action(initialization);
}
- foreach (var action in s_propertyHandlers.Values.Distinct())
+ foreach (var action in _propertyHandlers.Values.Distinct())
{
- action(this);
+ action();
}
}
@@ -989,11 +988,6 @@ namespace Xamarin.Forms.Platform.Tizen
}
}
- private static void ApplyTransformation(VisualElementRenderer<TElement> renderer)
- {
- renderer.ApplyTransformation();
- }
-
protected virtual void ApplyTransformation()
{
if (null == NativeView)