summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs
diff options
context:
space:
mode:
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 5b80bd0..a6c1c3a 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)