[NUI] Fix the issue that theme could not be changed (#1801)
authorhuayongxu <49056704+huayongxu@users.noreply.github.com>
Tue, 7 Jul 2020 06:09:41 +0000 (14:09 +0800)
committerGitHub <noreply@github.com>
Tue, 7 Jul 2020 06:09:41 +0000 (15:09 +0900)
* Fix the issue that theme could not be changed

* change default theme from lower to upper

src/Tizen.NUI.Components/Utils/StyleManager.cs

index 40d3e6897c8ffa2d3a38312b74e342a2f97063e6..253525659bba1384860603c350d08a015ff67f5c 100755 (executable)
@@ -30,8 +30,8 @@ namespace Tizen.NUI.Components
         internal const float PointSizeNormal = 12;
         internal const float PointSizeTitle = 16;
 
-        private const string defaultThemeName = "default";
-        private const string wearableThemeName = "wearable";
+        private const string defaultThemeName = "DEFAULT"; //"default";
+        private const string wearableThemeName = "WEARABLE"; //"wearable";
         
         private string currentThemeName = defaultThemeName;
         private Dictionary<string, Dictionary<string, StyleBase>> themeStyleSet = new Dictionary<string, Dictionary<string, StyleBase>>();
@@ -94,9 +94,9 @@ namespace Tizen.NUI.Components
 
             set
             {
-                if (currentThemeName != value)
+                if (value != null && currentThemeName != value)
                 {
-                    currentThemeName = value.ToLower();
+                    currentThemeName = value.ToUpperInvariant();
                     themeChangeHander?.Invoke(null, new ThemeChangeEventArgs { CurrentTheme = currentThemeName });
 
                     UpdateTheme();
@@ -132,6 +132,8 @@ namespace Tizen.NUI.Components
                 return;
             }
 
+            theme = theme.ToUpperInvariant();
+
             if (themeStyleSet.ContainsKey(style) && themeStyleSet[style].ContainsKey(theme))
             {
                 throw new InvalidOperationException($"{style}] already be used");