summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWonYoung Choi <wy80.choi@samsung.com>2017-04-14 03:56:04 (GMT)
committerWonYoung Choi <wy80.choi@samsung.com>2017-04-14 04:02:14 (GMT)
commitdfad930cda60996d4ea4efc8b021a1c37b64c5f4 (patch)
treec2b40385975f8cb94a16df44bd51d32847bf0058
parent9ab25fd9ed9c2215de11d9e6baba43d52a809130 (diff)
downloadxamarin-forms-dfad930cda60996d4ea4efc8b021a1c37b64c5f4.zip
xamarin-forms-dfad930cda60996d4ea4efc8b021a1c37b64c5f4.tar.gz
xamarin-forms-dfad930cda60996d4ea4efc8b021a1c37b64c5f4.tar.bz2
Fix FocusDirection to string type to avoid invalid reference in Tizen.Xamarin.Forms.Extension Change-Id: Ie452f14a32dbe0b5776ab28996eb52c81e8223c4
-rw-r--r--Xamarin.Forms.Core/PlatformConfiguration/TizenSpecific/FocusDirection.cs16
-rw-r--r--Xamarin.Forms.Core/PlatformConfiguration/TizenSpecific/VisualElement.cs12
-rw-r--r--Xamarin.Forms.Platform.Tizen/Extensions/FocusDirectionExtensions.cs29
-rw-r--r--Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs18
4 files changed, 29 insertions, 46 deletions
diff --git a/Xamarin.Forms.Core/PlatformConfiguration/TizenSpecific/FocusDirection.cs b/Xamarin.Forms.Core/PlatformConfiguration/TizenSpecific/FocusDirection.cs
index b4f15e1..9a15c5d 100644
--- a/Xamarin.Forms.Core/PlatformConfiguration/TizenSpecific/FocusDirection.cs
+++ b/Xamarin.Forms.Core/PlatformConfiguration/TizenSpecific/FocusDirection.cs
@@ -3,14 +3,14 @@ using System.ComponentModel;
namespace Xamarin.Forms.PlatformConfiguration.TizenSpecific
{
[EditorBrowsable(EditorBrowsableState.Never)]
- public enum FocusDirection
+ public static class FocusDirection
{
- None,
- Back,
- Forward,
- Up,
- Down,
- Right,
- Left
+ public const string None = "None";
+ public const string Back = "Back";
+ public const string Forward = "Forward";
+ public const string Up = "Up";
+ public const string Down = "Down";
+ public const string Right = "Right";
+ public const string Left = "Left";
}
} \ No newline at end of file
diff --git a/Xamarin.Forms.Core/PlatformConfiguration/TizenSpecific/VisualElement.cs b/Xamarin.Forms.Core/PlatformConfiguration/TizenSpecific/VisualElement.cs
index 40c7d75..a7e7eff 100644
--- a/Xamarin.Forms.Core/PlatformConfiguration/TizenSpecific/VisualElement.cs
+++ b/Xamarin.Forms.Core/PlatformConfiguration/TizenSpecific/VisualElement.cs
@@ -10,7 +10,7 @@ namespace Xamarin.Forms.PlatformConfiguration.TizenSpecific
public static readonly BindableProperty IsFocusAllowedProperty = BindableProperty.Create("IsFocusAllowed", typeof(bool), typeof(VisualElement), true);
[EditorBrowsable(EditorBrowsableState.Never)]
- public static readonly BindableProperty NextFocusDirectionProperty = BindableProperty.Create("NextFocusDirection", typeof(FocusDirection), typeof(VisualElement), FocusDirection.None, propertyChanged: OnNextFocusDirectionPropertyChanged);
+ public static readonly BindableProperty NextFocusDirectionProperty = BindableProperty.Create("NextFocusDirection", typeof(string), typeof(VisualElement), FocusDirection.None, propertyChanged: OnNextFocusDirectionPropertyChanged);
public static readonly BindableProperty NextFocusUpViewProperty = BindableProperty.Create("NextFocusUpView", typeof(View), typeof(VisualElement), default(View));
@@ -67,25 +67,25 @@ namespace Xamarin.Forms.PlatformConfiguration.TizenSpecific
}
[EditorBrowsable(EditorBrowsableState.Never)]
- public static FocusDirection GetNextFocusDirection(BindableObject element)
+ public static string GetNextFocusDirection(BindableObject element)
{
- return (FocusDirection)element.GetValue(NextFocusDirectionProperty);
+ return (string)element.GetValue(NextFocusDirectionProperty);
}
[EditorBrowsable(EditorBrowsableState.Never)]
- public static void SetNextFocusDirection(BindableObject element, FocusDirection value)
+ public static void SetNextFocusDirection(BindableObject element, string value)
{
element.SetValue(NextFocusDirectionProperty, value);
}
[EditorBrowsable(EditorBrowsableState.Never)]
- public static FocusDirection GetNextFocusDirection(this IPlatformElementConfiguration<Tizen, FormsElement> config)
+ public static string GetNextFocusDirection(this IPlatformElementConfiguration<Tizen, FormsElement> config)
{
return GetNextFocusDirection(config.Element);
}
[EditorBrowsable(EditorBrowsableState.Never)]
- public static IPlatformElementConfiguration<Tizen, FormsElement> SetNextFocusDirection(this IPlatformElementConfiguration<Tizen, FormsElement> config, FocusDirection value)
+ public static IPlatformElementConfiguration<Tizen, FormsElement> SetNextFocusDirection(this IPlatformElementConfiguration<Tizen, FormsElement> config, string value)
{
SetNextFocusDirection(config.Element, value);
return config;
diff --git a/Xamarin.Forms.Platform.Tizen/Extensions/FocusDirectionExtensions.cs b/Xamarin.Forms.Platform.Tizen/Extensions/FocusDirectionExtensions.cs
deleted file mode 100644
index fe7d090..0000000
--- a/Xamarin.Forms.Platform.Tizen/Extensions/FocusDirectionExtensions.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-using Xamarin.Forms.PlatformConfiguration.TizenSpecific;
-using EFocusDirection = ElmSharp.FocusDirection;
-
-namespace Xamarin.Forms.Platform.Tizen
-{
- public static class FocusDirectionExtensions
- {
- public static EFocusDirection ToNative(this FocusDirection direction)
- {
- switch (direction)
- {
- case FocusDirection.Back:
- return EFocusDirection.Previous;
- case FocusDirection.Forward:
- return EFocusDirection.Next;
- case FocusDirection.Up:
- return EFocusDirection.Up;
- case FocusDirection.Down:
- return EFocusDirection.Down;
- case FocusDirection.Right:
- return EFocusDirection.Right;
- case FocusDirection.Left:
- return EFocusDirection.Left;
- default:
- return EFocusDirection.Next;
- }
- }
- }
-}
diff --git a/Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs b/Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs
index 51170bd..d7f7715 100644
--- a/Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs
+++ b/Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs
@@ -5,6 +5,7 @@ using System.ComponentModel;
using ElmSharp;
using ESize = ElmSharp.Size;
using ERect = ElmSharp.Rect;
+using EFocusDirection = ElmSharp.FocusDirection;
using Specific = Xamarin.Forms.PlatformConfiguration.TizenSpecific.VisualElement;
using XFocusDirection = Xamarin.Forms.PlatformConfiguration.TizenSpecific.FocusDirection;
@@ -809,7 +810,7 @@ namespace Xamarin.Forms.Platform.Tizen
var widget = NativeView as Widget;
if (widget != null)
{
- widget.FocusNext(direction.ToNative());
+ widget.FocusNext(ConvertToNativeFocusDirection(direction));
}
else
{
@@ -818,7 +819,7 @@ namespace Xamarin.Forms.Platform.Tizen
}
}
- void SetNextFocusViewInternal(XFocusDirection direction)
+ void SetNextFocusViewInternal(string direction)
{
var widget = NativeView as Widget;
if (widget != null)
@@ -850,7 +851,7 @@ namespace Xamarin.Forms.Platform.Tizen
}
if (nativeControl != null)
{
- widget.SetNextFocusObject(nativeControl, direction.ToNative());
+ widget.SetNextFocusObject(nativeControl, ConvertToNativeFocusDirection(direction));
}
}
else
@@ -994,6 +995,17 @@ namespace Xamarin.Forms.Platform.Tizen
NativeView.EvasMap = map;
}
}
+
+ EFocusDirection ConvertToNativeFocusDirection(string direction) {
+ if (direction == XFocusDirection.Back) return EFocusDirection.Previous;
+ if (direction == XFocusDirection.Forward) return EFocusDirection.Next;
+ if (direction == XFocusDirection.Up) return EFocusDirection.Up;
+ if (direction == XFocusDirection.Down) return EFocusDirection.Down;
+ if (direction == XFocusDirection.Right) return EFocusDirection.Right;
+ if (direction == XFocusDirection.Left) return EFocusDirection.Left;
+
+ return EFocusDirection.Next;
+ }
}
internal static class Settings