From 538f60857641d748c51967d453b2aa4f39c880cb Mon Sep 17 00:00:00 2001 From: Seoyeon Kim Date: Fri, 24 Mar 2023 13:29:45 +0900 Subject: [PATCH] Add Vconf interop and update turning on/off accessibility - Added Vconf Interop to set/get vconf bool - Updated to turn on/off tts feature Change-Id: Ie85e66b9c6eb4c787faccd289e9520821b4ff328 Signed-off-by: Seoyeon Kim --- .../Interop/Interop.Vconf.cs | 32 ++++++++++++++++++ .../SettingWidgetAccessibility.cs | 16 ++++++--- ...rg.tizen.cssetting-accessibility-1.0.0.tpk | Bin 3 files changed, 44 insertions(+), 4 deletions(-) create mode 100755 Settings/SettingAccessibility/Interop/Interop.Vconf.cs mode change 100644 => 100755 packaging/org.tizen.cssetting-accessibility-1.0.0.tpk diff --git a/Settings/SettingAccessibility/Interop/Interop.Vconf.cs b/Settings/SettingAccessibility/Interop/Interop.Vconf.cs new file mode 100755 index 0000000..fba8225 --- /dev/null +++ b/Settings/SettingAccessibility/Interop/Interop.Vconf.cs @@ -0,0 +1,32 @@ +/* + * Copyright(c) 2023 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +using System; +using System.Collections.Generic; +using System.Text; + +internal static partial class Interop +{ + internal static partial class Vconf + { + [global::System.Runtime.InteropServices.DllImport("libvconf.so.0", EntryPoint = "vconf_get_bool")] + internal static extern int GetVconfBool(string key, out bool value); + + [global::System.Runtime.InteropServices.DllImport("libvconf.so.0", EntryPoint = "vconf_set_bool")] + internal static extern int SetVconfBool(string key, bool value); + } +} diff --git a/Settings/SettingAccessibility/SettingWidgetAccessibility.cs b/Settings/SettingAccessibility/SettingWidgetAccessibility.cs index d439de4..325c5dd 100755 --- a/Settings/SettingAccessibility/SettingWidgetAccessibility.cs +++ b/Settings/SettingAccessibility/SettingWidgetAccessibility.cs @@ -7,6 +7,7 @@ using Tizen.NUI.Accessibility; using Tizen.Applications; using System.Runtime.InteropServices; using System.Collections.Generic; +using static Interop.Vconf; namespace SettingAccessibility { @@ -14,6 +15,7 @@ namespace SettingAccessibility { static Navigator navigator; static ScrollableBase settingScroll; + private static readonly string VconfkeyAccessibilityTts = "db/setting/accessibility/tts"; protected override void OnCreate(string contentInfo, Window window) { @@ -110,14 +112,20 @@ namespace SettingAccessibility if (e.IsSelected) { Tizen.Log.Debug("NUI", "Switch is selected! Screen Reader turns on. \n"); - // TODO : Need to add new Enable API - //Accessibility.BridgeEnableAutoInit(); + int ret = SetVconfBool(VconfkeyAccessibilityTts, true); + if (ret != 0) + { + Tizen.Log.Error("NUI", "Setting vconf is failed. error code ["+ret+"] \n"); + } } else { Tizen.Log.Debug("NUI", "Switch is unselected! Screen Reader turns off. \n"); - // TODO : Need to add new Disable API - //Accessibility.BridgeDisableAutoInit(); + int ret = SetVconfBool(VconfkeyAccessibilityTts, false); + if (ret != 0) + { + Tizen.Log.Error("NUI", "Setting vconf is failed. error code ["+ret+"] \n"); + } } }; // Extra is placed at the end(right end) of the item. diff --git a/packaging/org.tizen.cssetting-accessibility-1.0.0.tpk b/packaging/org.tizen.cssetting-accessibility-1.0.0.tpk old mode 100644 new mode 100755 -- 2.34.1