Add SpeechRateRow control.
authorPiotr Czaja <p.czaja@samsung.com>
Wed, 13 Dec 2023 06:12:20 +0000 (07:12 +0100)
committerPiotr Czaja/Tizen Services & IoT (PLT) /SRPOL/Engineer/Samsung Electronics <p.czaja@samsung.com>
Thu, 14 Dec 2023 11:44:47 +0000 (12:44 +0100)
Change-Id: Ia186855564ac3d820208f706d4cfda603d4d492a

.gitignore
SettingCore/TextResources/Resources.Designer.cs [deleted file]
SettingCore/TextResources/Resources.en-US.resx
SettingCore/TextResources/Resources.ko-KR.resx
SettingCore/TextResources/Resources.resx
SettingCore/Tools.cs [new file with mode: 0644]
SettingCore/Views/SpeechRateRow.cs [new file with mode: 0644]
SettingView/res/running-icon-dark.svg [new file with mode: 0644]
SettingView/res/running-icon-light.svg [new file with mode: 0644]
SettingView/res/walking-icon-dark.svg [new file with mode: 0644]
SettingView/res/walking-icon-light.svg [new file with mode: 0644]

index 790064b1fe3ff6560896968a099b188bb1a8473c..2c2b78777e3e6ec5be7edb8fb244d46b0d03de88 100644 (file)
@@ -9,6 +9,7 @@
 *.user
 *.userosscache
 *.sln.docstates
+**/Resources.Designer.cs
 
 # User-specific files (MonoDevelop/Xamarin Studio)
 *.userprefs
diff --git a/SettingCore/TextResources/Resources.Designer.cs b/SettingCore/TextResources/Resources.Designer.cs
deleted file mode 100644 (file)
index 9bd529d..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-//------------------------------------------------------------------------------
-// <auto-generated>
-//     This code was generated by a tool.
-//     Runtime Version:4.0.30319.42000
-//
-//     Changes to this file may cause incorrect behavior and will be lost if
-//     the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-namespace SettingCore.TextResources {
-    using System;
-    
-    
-    /// <summary>
-    ///   A strongly-typed resource class, for looking up localized strings, etc.
-    /// </summary>
-    // This class was auto-generated by the StronglyTypedResourceBuilder
-    // class via a tool like ResGen or Visual Studio.
-    // To add or remove a member, edit your .ResX file then rerun ResGen
-    // with the /str option, or rebuild your VS project.
-    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
-    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
-    public class Resources {
-        
-        private static global::System.Resources.ResourceManager resourceMan;
-        
-        private static global::System.Globalization.CultureInfo resourceCulture;
-        
-        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
-        internal Resources() {
-        }
-        
-        /// <summary>
-        ///   Returns the cached ResourceManager instance used by this class.
-        /// </summary>
-        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
-        public static global::System.Resources.ResourceManager ResourceManager {
-            get {
-                if (object.ReferenceEquals(resourceMan, null)) {
-                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SettingCore.TextResources.Resources", typeof(Resources).Assembly);
-                    resourceMan = temp;
-                }
-                return resourceMan;
-            }
-        }
-        
-        /// <summary>
-        ///   Overrides the current thread's CurrentUICulture property for all
-        ///   resource lookups using this strongly typed resource class.
-        /// </summary>
-        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
-        public static global::System.Globalization.CultureInfo Culture {
-            get {
-                return resourceCulture;
-            }
-            set {
-                resourceCulture = value;
-            }
-        }
-        
-        /// <summary>
-        ///   Looks up a localized string similar to Back.
-        /// </summary>
-        public static string IDS_ST_BUTTON_BACK {
-            get {
-                return ResourceManager.GetString("IDS_ST_BUTTON_BACK", resourceCulture);
-            }
-        }
-    }
-}
index 55ece30b5e8a44cb33ce77eb59439965a5c17f1a..8571d7da967b5997d1c93cd6f5ba527991151773 100644 (file)
   <data name="IDS_ST_BUTTON_BACK" xml:space="preserve">
     <value>Back</value>
   </data>
+  <data name="IDS_ST_HEADER_SPEECH_RATE_ABB" xml:space="preserve">
+    <value>Speech rate</value>
+  </data>
 </root>
\ No newline at end of file
index 4ab972e97f791119040968e95fc366ed7f90f07d..30f4f40d788931a536045c5151016a8dda72099e 100644 (file)
   <data name="IDS_ST_BUTTON_BACK" xml:space="preserve">
     <value>뒤로가기</value>
   </data>
+  <data name="IDS_ST_HEADER_SPEECH_RATE_ABB" xml:space="preserve">
+    <value>읽어주는 속도</value>
+  </data>
 </root>
\ No newline at end of file
index 55ece30b5e8a44cb33ce77eb59439965a5c17f1a..8571d7da967b5997d1c93cd6f5ba527991151773 100644 (file)
   <data name="IDS_ST_BUTTON_BACK" xml:space="preserve">
     <value>Back</value>
   </data>
+  <data name="IDS_ST_HEADER_SPEECH_RATE_ABB" xml:space="preserve">
+    <value>Speech rate</value>
+  </data>
 </root>
\ No newline at end of file
diff --git a/SettingCore/Tools.cs b/SettingCore/Tools.cs
new file mode 100644 (file)
index 0000000..5317924
--- /dev/null
@@ -0,0 +1,9 @@
+using Tizen.NUI;
+
+namespace SettingCore
+{
+    public static class Tools
+    {
+        public static bool IsLightTheme => ThemeManager.PlatformThemeId == "org.tizen.default-light-theme";
+    }
+}
diff --git a/SettingCore/Views/SpeechRateRow.cs b/SettingCore/Views/SpeechRateRow.cs
new file mode 100644 (file)
index 0000000..520896f
--- /dev/null
@@ -0,0 +1,101 @@
+using SettingCore.TextResources;
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Components;
+
+namespace SettingCore.Views
+{
+    public class SpeechRateRow : BaseComponent
+    {
+        private readonly ThemeColor TrackColors = new ThemeColor(new Color("#FF6200"), new Color("#FF8A00"), Color.Transparent, Color.Transparent, new Color("#CACACA"), new Color("#CACACA"));
+        private readonly ThemeColor BgTrackColors = new ThemeColor(new Color(1.0f, 0.37f, 0.0f, 0.1f), new Color(1.0f, 0.37f, 0.0f, 0.1f), Color.Transparent, Color.Transparent);
+        private readonly ThemeColor TextColors = new ThemeColor(new Color("#090E21"), new Color("#FDFDFD"), Color.Transparent, Color.Transparent, new Color("#CACACA"), new Color("#666666"));
+
+        private ImageView leftIcon;
+        private ImageView rightIcon;
+        private TextLabel primary;
+
+        private string leftImageUrl => Tools.IsLightTheme ? "walking-icon-light.svg" : "walking-icon-dark.svg";
+        private string rightImageUrl => Tools.IsLightTheme ? "running-icon-light.svg" : "running-icon-dark.svg";
+        public Slider Slider { get; private set; }
+
+        public SpeechRateRow()
+        {
+            Layout = new LinearLayout()
+            {
+                LinearOrientation = LinearLayout.Orientation.Vertical,
+            };
+
+            primary = new TextLabel
+            {
+                AccessibilityHidden = true,
+                ThemeChangeSensitive = true,
+                Text = Resources.IDS_ST_HEADER_SPEECH_RATE_ABB,
+                Margin = new Extents(16, 0, 16, 0).SpToPx(),
+                PixelSize = 24.SpToPx(),
+            };
+
+            var sliderView = new View
+            {
+                WidthSpecification = LayoutParamPolicies.MatchParent,
+                Margin = new Extents(16, 16, 16, 16).SpToPx(),
+                Layout = new LinearLayout()
+                {
+                    LinearOrientation = LinearLayout.Orientation.Horizontal,
+                    VerticalAlignment = VerticalAlignment.Center,
+                },
+            };
+
+            leftIcon = new ImageView(GetResourcePath(leftImageUrl))
+            {
+                Size2D = new Size2D(48, 48).SpToPx(),
+                Margin = new Extents(16, 0, 8, 8).SpToPx(),
+            };
+
+            rightIcon = new ImageView(GetResourcePath(rightImageUrl))
+            {
+                Size2D = new Size2D(48, 48).SpToPx(),
+                Margin = new Extents(0, 16, 8, 8).SpToPx(),
+            };
+
+            Slider = new Slider()
+            {
+                WidthResizePolicy = ResizePolicyType.FillToParent,
+                Direction = Slider.DirectionType.Horizontal,
+                TrackThickness = (uint)8.SpToPx(),
+                ThumbSize = new Size(24, 24).SpToPx(),
+                BgTrackColor = BgTrackColors.Normal,
+                SlidedTrackColor = TrackColors.Normal,
+
+                IsDiscrete = true,
+                DiscreteValue = 1,
+            };
+
+            sliderView.Add(leftIcon);
+            sliderView.Add(Slider);
+            sliderView.Add(rightIcon);
+
+            Add(primary);
+            Add(sliderView);
+
+            ThemeManager.ThemeChanged += ThemeManager_ThemeChanged;
+        }
+
+        private void ThemeManager_ThemeChanged(object sender, ThemeChangedEventArgs e)
+        {
+            primary.TextColor = TextColors.Normal;
+
+            Slider.BgTrackColor = BgTrackColors.Normal;
+            Slider.SlidedTrackColor = TrackColors.Normal;
+
+            leftIcon.ResourceUrl = GetResourcePath(leftImageUrl);
+            rightIcon.ResourceUrl = GetResourcePath(rightImageUrl);
+        }
+
+        private static string GetResourcePath(string relativePath) => System.IO.Path.Combine(Tizen.Applications.Application.Current.DirectoryInfo.Resource, relativePath);
+        protected override string AccessibilityGetName()
+        {
+            return $"{primary.Text}, {(int)(Slider.CurrentValue / Slider.MaxValue * 100)} %";
+        }
+    }
+}
diff --git a/SettingView/res/running-icon-dark.svg b/SettingView/res/running-icon-dark.svg
new file mode 100644 (file)
index 0000000..11e30ed
--- /dev/null
@@ -0,0 +1,3 @@
+<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M33.1324 18.7501L30.228 13.3262L24.5357 11.4288L24.5226 11.4693L15.6757 13.997C15.0499 14.1779 14.4996 14.5568 14.1073 15.0768C13.715 15.5969 13.5018 16.2301 13.4998 16.8815V24.7501H16.4998V16.8816L23.3998 14.9102L20.3518 24.2508L20.3372 24.2456L17.575 31.9799C17.4413 32.3481 17.1697 32.6498 16.8175 32.8213C16.4654 32.9928 16.0603 33.0205 15.6881 32.8987L9.47414 30.8271L8.52539 33.6731L14.7393 35.7444C15.8558 36.1164 17.0735 36.0363 18.1316 35.5213C19.1897 35.0062 20.0039 34.0972 20.3998 32.989L22.6715 26.6281L24.2815 27.1531L28.8096 31.6812C28.9496 31.8202 29.0605 31.9857 29.1361 32.1679C29.2117 32.3501 29.2503 32.5455 29.2498 32.7428V42.7501H32.2498V32.7428C32.2513 32.1516 32.1357 31.5659 31.9094 31.0197C31.6832 30.4735 31.3509 29.9776 30.9317 29.5607L26.4069 25.036L28.9178 17.3412L30.7243 20.5928C30.9192 20.9435 31.2043 21.2357 31.5501 21.4391C31.8959 21.6426 32.2898 21.75 32.691 21.7501H40.4998V18.7501H33.1324ZM26.8899 10.2851C27.4792 10.7775 28.2187 11.0543 28.9865 11.0696C29.7542 11.085 30.5043 10.8381 31.1128 10.3697C31.7213 9.90122 32.1518 9.23928 32.3334 8.49312C32.5149 7.74697 32.4365 6.96122 32.1112 6.26561C31.7859 5.57 31.2331 5.00612 30.5441 4.66708C29.8551 4.32803 29.0711 4.2341 28.3215 4.40078C27.5718 4.56746 26.9015 4.98479 26.4211 5.58387C25.9406 6.18294 25.6789 6.92794 25.679 7.69586C25.6781 8.18992 25.7862 8.6781 25.9955 9.12564C26.2048 9.57318 26.5102 9.96908 26.8899 10.2851Z" fill="#FF8A00"/>
+</svg>
diff --git a/SettingView/res/running-icon-light.svg b/SettingView/res/running-icon-light.svg
new file mode 100644 (file)
index 0000000..1916618
--- /dev/null
@@ -0,0 +1,3 @@
+<svg width="49" height="49" viewBox="0 0 49 49" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M33.8736 18.8771L30.9692 13.4532L25.2769 11.5558L25.2638 11.5963L16.4169 14.1239C15.7911 14.3048 15.2408 14.6837 14.8485 15.2038C14.4562 15.7238 14.243 16.357 14.241 17.0084V24.8771H17.241V17.0085L24.141 15.0372L21.093 24.3778L21.0784 24.3725L18.3162 32.1069C18.1825 32.475 17.9109 32.7768 17.5587 32.9483C17.2066 33.1197 16.8015 33.1475 16.4293 33.0256L10.2154 30.954L9.2666 33.8001L15.4805 35.8713C16.597 36.2434 17.8147 36.1633 18.8728 35.6482C19.9309 35.1332 20.7451 34.2241 21.141 33.1159L23.4127 26.7551L25.0227 27.2801L29.5508 31.8082C29.6908 31.9472 29.8017 32.1126 29.8773 32.2948C29.9529 32.4771 29.9915 32.6725 29.991 32.8697V42.8771H32.991V32.8697C32.9926 32.2785 32.8769 31.6929 32.6506 31.1467C32.4244 30.6005 32.0921 30.1046 31.6729 29.6877L27.1481 25.1629L29.659 17.4682L31.4655 20.7197C31.6604 21.0704 31.9455 21.3626 32.2913 21.5661C32.6371 21.7696 33.031 21.8769 33.4323 21.8771H41.241V18.8771H33.8736ZM27.6311 10.4121C28.2204 10.9045 28.9599 11.1812 29.7277 11.1966C30.4955 11.212 31.2455 10.965 31.854 10.4966C32.4625 10.0282 32.893 9.36623 33.0746 8.62008C33.2561 7.87392 33.1777 7.08818 32.8524 6.39257C32.5271 5.69695 31.9743 5.13308 31.2853 4.79403C30.5963 4.45499 29.8123 4.36105 29.0627 4.52773C28.3131 4.69441 27.6427 5.11174 27.1623 5.71082C26.6819 6.3099 26.4201 7.0549 26.4202 7.82281C26.4193 8.31687 26.5274 8.80505 26.7367 9.25259C26.946 9.70013 27.2514 10.096 27.6311 10.4121Z" fill="#FF6200"/>
+</svg>
diff --git a/SettingView/res/walking-icon-dark.svg b/SettingView/res/walking-icon-dark.svg
new file mode 100644 (file)
index 0000000..30d080b
--- /dev/null
@@ -0,0 +1,4 @@
+<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M29.0551 10.8915C30.8201 10.8915 32.2509 9.46071 32.2509 7.69575C32.2509 5.93079 30.8201 4.5 29.0551 4.5C27.2902 4.5 25.8594 5.93079 25.8594 7.69575C25.8594 9.46071 27.2902 10.8915 29.0551 10.8915Z" fill="#FF8A00"/>
+<path d="M30.1878 13.4487L24.5079 11.5137L17.2315 14.1599C16.798 14.3185 16.4236 14.6062 16.1588 14.9843C15.8939 15.3623 15.7513 15.8125 15.7503 16.2741V21.7491H18.7503V16.7998L23.3263 15.1358L14.8711 41.2491H18.0223L22.7175 26.6418L23.4554 26.8826L27.0003 33.3815V41.2491H30.0003V33.1904C30 32.8139 29.9055 32.4435 29.7255 32.1129L26.2043 25.6572L28.9182 17.3401L30.7248 20.5918C30.9197 20.9424 31.2048 21.2347 31.5506 21.4381C31.8964 21.6416 32.2903 21.749 32.6916 21.7491H37.5003V18.7491H33.1328L30.1878 13.4487Z" fill="#FF8A00"/>
+</svg>
diff --git a/SettingView/res/walking-icon-light.svg b/SettingView/res/walking-icon-light.svg
new file mode 100644 (file)
index 0000000..4f8156b
--- /dev/null
@@ -0,0 +1,4 @@
+<svg width="49" height="49" viewBox="0 0 49 49" fill="none" xmlns="http://www.w3.org/2000/svg">
+<path d="M29.7973 11.0185C31.5623 11.0185 32.9931 9.58767 32.9931 7.8227C32.9931 6.05774 31.5623 4.62695 29.7973 4.62695C28.0323 4.62695 26.6016 6.05774 26.6016 7.8227C26.6016 9.58767 28.0323 11.0185 29.7973 11.0185Z" fill="#FF6200"/>
+<path d="M30.93 13.5756L25.2501 11.6406L17.9737 14.2868C17.5402 14.4454 17.1658 14.7332 16.901 15.1112C16.6361 15.4893 16.4935 15.9395 16.4925 16.4011V21.8761H19.4925V16.9267L24.0685 15.2627L15.6133 41.3761H18.7645L23.4597 26.7688L24.1976 27.0095L27.7425 33.5085V41.3761H30.7425V33.3173C30.7422 32.9409 30.6477 32.5705 30.4677 32.2398L26.9464 25.7841L29.6604 17.4671L31.467 20.7187C31.6619 21.0694 31.947 21.3616 32.2928 21.5651C32.6386 21.7686 33.0325 21.8759 33.4338 21.8761H38.2425V18.8761H33.875L30.93 13.5756Z" fill="#FF6200"/>
+</svg>