From 855de6065179f6c04045f6abeb35333c59a9f5db Mon Sep 17 00:00:00 2001 From: "dongsug.song" Date: Wed, 15 Jun 2022 16:02:15 +0900 Subject: [PATCH] [NUI] Fix not to use PROFILE_MOBILE --- src/Tizen.NUI.Components/Controls/Button.Internal.cs | 2 -- src/Tizen.NUI.Components/Controls/Control.cs | 19 +++++++++++++++++-- src/Tizen.NUI.Components/Controls/Switch.cs | 3 +-- .../Tizen.NUI.Samples/Samples/SwitchSample.cs | 16 ---------------- test/Tizen.NUI.StyleGuide/Examples/SwitchExample.cs | 2 -- 5 files changed, 18 insertions(+), 24 deletions(-) diff --git a/src/Tizen.NUI.Components/Controls/Button.Internal.cs b/src/Tizen.NUI.Components/Controls/Button.Internal.cs index 41a6243..f24d899 100644 --- a/src/Tizen.NUI.Components/Controls/Button.Internal.cs +++ b/src/Tizen.NUI.Components/Controls/Button.Internal.cs @@ -277,9 +277,7 @@ namespace Tizen.NUI.Components buttonIcon = CreateIcon(); LayoutItems(); -#if PROFILE_MOBILE Feedback = true; -#endif } /// diff --git a/src/Tizen.NUI.Components/Controls/Control.cs b/src/Tizen.NUI.Components/Controls/Control.cs index a4b7a37..009f9b6 100755 --- a/src/Tizen.NUI.Components/Controls/Control.cs +++ b/src/Tizen.NUI.Components/Controls/Control.cs @@ -140,8 +140,23 @@ namespace Tizen.NUI.Components if (value) { - feedback = new Feedback(); - this.TouchEvent += OnTouchPlayFeedback; + try + { + feedback = new Feedback(); + this.TouchEvent += OnTouchPlayFeedback; + } + catch (NotSupportedException e) + { + Log.Error("NUI", $"[ERROR] No support of Feedback: {e}"); + } + catch (InvalidOperationException e) + { + Log.Error("NUI", $"[ERROR] Fail to initialize Feedback: {e}"); + } + catch (NullReferenceException e) + { + Log.Error("NUI", $"[ERROR] Null reference error in Feedback: {e}"); + } } else { diff --git a/src/Tizen.NUI.Components/Controls/Switch.cs b/src/Tizen.NUI.Components/Controls/Switch.cs index 1143a22..63e2e53 100755 --- a/src/Tizen.NUI.Components/Controls/Switch.cs +++ b/src/Tizen.NUI.Components/Controls/Switch.cs @@ -69,9 +69,8 @@ namespace Tizen.NUI.Components AccessibilityRole = Role.ToggleButton; IsSelectable = true; -#if PROFILE_MOBILE + Feedback = true; -#endif } /// diff --git a/test/Tizen.NUI.Samples/Tizen.NUI.Samples/Samples/SwitchSample.cs b/test/Tizen.NUI.Samples/Tizen.NUI.Samples/Samples/SwitchSample.cs index adc0539..cad4b99 100755 --- a/test/Tizen.NUI.Samples/Tizen.NUI.Samples/Samples/SwitchSample.cs +++ b/test/Tizen.NUI.Samples/Tizen.NUI.Samples/Samples/SwitchSample.cs @@ -225,9 +225,7 @@ namespace Tizen.NUI.Samples utilitySwitch[i].ApplyStyle(utilitySt); utilitySwitch[i].Size = new Size(96, 60); utilitySwitch[i].Margin = new Extents(100, 0, 20, 0); -#if PROFILE_MOBILE utilitySwitch[i].Feedback = true; -#endif parentView[2].Add(utilitySwitch[i]); } for (i = 0; i < 4; i++) @@ -235,9 +233,7 @@ namespace Tizen.NUI.Samples familySwitch[i] = new Switch(); familySwitch[i].ApplyStyle(familySt); familySwitch[i].Size = new Size(96, 60); -#if PROFILE_MOBILE familySwitch[i].Feedback = true; -#endif parentView[2].Add(familySwitch[i]); } for (i = 0; i < 4; i++) @@ -245,9 +241,7 @@ namespace Tizen.NUI.Samples foodSwitch[i] = new Switch(); foodSwitch[i].ApplyStyle(foodSt); foodSwitch[i].Size = new Size(96, 60); -#if PROFILE_MOBILE foodSwitch[i].Feedback = true; -#endif parentView[2].Add(foodSwitch[i]); } for (i = 0; i < 4; i++) @@ -255,9 +249,7 @@ namespace Tizen.NUI.Samples kitchenSwitch[i] = new Switch(); kitchenSwitch[i].ApplyStyle(kitchenSt); kitchenSwitch[i].Size = new Size(96, 60); -#if PROFILE_MOBILE kitchenSwitch[i].Feedback = true; -#endif parentView[2].Add(kitchenSwitch[i]); } @@ -267,9 +259,7 @@ namespace Tizen.NUI.Samples utilitySwitch2[i] = new Switch(); utilitySwitch2[i].ApplyStyle(utilitySt); utilitySwitch2[i].Size = new Size(96, 60); -#if PROFILE_MOBILE utilitySwitch2[i].Feedback = true; -#endif parentView[2].Add(utilitySwitch2[i]); } for (i = 0; i < 4; i++) @@ -277,9 +267,7 @@ namespace Tizen.NUI.Samples familySwitch2[i] = new Switch(); familySwitch2[i].ApplyStyle(familySt); familySwitch2[i].Size = new Size(96, 60); -#if PROFILE_MOBILE familySwitch2[i].Feedback = true; -#endif parentView[2].Add(familySwitch2[i]); } for (i = 0; i < 4; i++) @@ -287,9 +275,7 @@ namespace Tizen.NUI.Samples foodSwitch2[i] = new Switch(); foodSwitch2[i].ApplyStyle(foodSt); foodSwitch2[i].Size = new Size(96, 60); -#if PROFILE_MOBILE foodSwitch2[i].Feedback = true; -#endif parentView[2].Add(foodSwitch2[i]); } for (i = 0; i < 4; i++) @@ -297,9 +283,7 @@ namespace Tizen.NUI.Samples kitchenSwitch2[i] = new Switch(); kitchenSwitch2[i].ApplyStyle(kitchenSt); kitchenSwitch2[i].Size = new Size(96, 60); -#if PROFILE_MOBILE kitchenSwitch2[i].Feedback = true; -#endif parentView[2].Add(kitchenSwitch2[i]); } diff --git a/test/Tizen.NUI.StyleGuide/Examples/SwitchExample.cs b/test/Tizen.NUI.StyleGuide/Examples/SwitchExample.cs index 90a6de0..75379f6 100644 --- a/test/Tizen.NUI.StyleGuide/Examples/SwitchExample.cs +++ b/test/Tizen.NUI.StyleGuide/Examples/SwitchExample.cs @@ -111,9 +111,7 @@ namespace Tizen.NUI.StyleGuide switchTest[i].ApplyStyle(styleTest); switchTest[i].Size = new Size(200, 100); switchTest[i].Margin = new Extents(10, 10, 10, 10); -#if PROFILE_MOBILE switchTest[i].Feedback = true; -#endif rootContent.Add(switchTest[i]); } switchTest[2].IsEnabled = false; -- 2.7.4