X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2FTizen.NUI%2Fsrc%2Fpublic%2FTheme%2FTheme.cs;h=d5e866d0d3c62d9640305bfbf3a9690b674119de;hb=4e2330536d29cbc51d0b2264574fcdd32ebe4ced;hp=7c200da0c8b5380ede3e180b5ae9e2e4bb8a08c6;hpb=963f0a40a4361dc772b6bc9a0b5d05e9ac9f2841;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git
diff --git a/src/Tizen.NUI/src/public/Theme/Theme.cs b/src/Tizen.NUI/src/public/Theme/Theme.cs
index 7c200da..d5e866d 100755
--- a/src/Tizen.NUI/src/public/Theme/Theme.cs
+++ b/src/Tizen.NUI/src/public/Theme/Theme.cs
@@ -1,5 +1,5 @@
/*
- * Copyright(c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright(c) 2021 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.
@@ -93,6 +93,12 @@ namespace Tizen.NUI
public string Id { get; set; }
///
+ /// The string key to identify the Theme.
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string Version { get; set; } = null;
+
+ ///
/// For Xaml use only.
/// The bulit-in theme id that will be used as base of this.
/// View styles with same key are merged.
@@ -106,7 +112,7 @@ namespace Tizen.NUI
if (string.IsNullOrEmpty(baseTheme)) return;
- var baseThemeInstance = ThemeManager.GetBuiltinTheme(baseTheme);
+ var baseThemeInstance = (Theme)ThemeManager.GetBuiltinTheme(baseTheme)?.Clone();
if (baseThemeInstance != null)
{
@@ -186,6 +192,8 @@ namespace Tizen.NUI
internal int Count => map.Count;
+ internal int PackageCount { get; set; } = 0;
+
///
/// Get an enumerator of the theme.
///
@@ -218,7 +226,11 @@ namespace Tizen.NUI
/// The string key to find a ViewStyle.
/// Founded style instance.
[EditorBrowsable(EditorBrowsableState.Never)]
- public ViewStyle GetStyle(string styleName) => map.ContainsKey(styleName) ? map[styleName] : null;
+ public ViewStyle GetStyle(string styleName)
+ {
+ map.TryGetValue(styleName, out ViewStyle result);
+ return result;
+ }
///
/// Gets a style of given view type.
@@ -313,7 +325,15 @@ namespace Tizen.NUI
if (theme == null)
throw new ArgumentNullException(nameof(theme));
- if (Id == null) Id = theme.Id;
+ if (Id == null)
+ {
+ Id = theme.Id;
+ }
+
+ if (Version == null)
+ {
+ Version = theme.Version;
+ }
foreach (var item in theme)
{
@@ -345,6 +365,33 @@ namespace Tizen.NUI
///
internal void AddStyleWithoutClone(string styleName, ViewStyle value) => map[styleName] = value;
+ internal void ApplyExternalTheme(IExternalTheme externalTheme, HashSet keyListSet)
+ {
+ Id = externalTheme.Id;
+ Version = externalTheme.Version;
+
+ if (keyListSet == null)
+ {
+ // Nothing to apply
+ return;
+ }
+
+ foreach (var keyList in keyListSet)
+ {
+ keyList?.ApplyKeyActions(externalTheme, this);
+ }
+ }
+
+ internal bool HasSameIdAndVersion(IExternalTheme externalTheme)
+ {
+ if (externalTheme == null)
+ {
+ return false;
+ }
+
+ return string.Equals(Id, externalTheme.Id, StringComparison.OrdinalIgnoreCase) && string.Equals(Version, externalTheme.Version, StringComparison.OrdinalIgnoreCase);
+ }
+
internal void SetChangedResources(IEnumerable> changedResources)
{
this.changedResources = changedResources;