[NUI] simplify code of LottieXXXStyle by using 'is' operator (#1935)
authorYeongJong Lee <cleanlyj@naver.com>
Thu, 27 Aug 2020 10:34:32 +0000 (19:34 +0900)
committerGitHub <noreply@github.com>
Thu, 27 Aug 2020 10:34:32 +0000 (19:34 +0900)
Co-authored-by: Jiyun Yang <ji.yang@samsung.com>
Co-authored-by: Yeongjong Lee <yj34.lee@samsung.com>
Co-authored-by: Jiyun Yang <ji.yang@samsung.com>
Co-authored-by: woohyun <woo_hyun0705@naver.com>
src/Tizen.NUI.Components/Style/Extension/LottieButtonStyle.cs
src/Tizen.NUI.Components/Style/Extension/LottieSwitchStyle.cs

index 729bcc9..ff4ce86 100644 (file)
@@ -60,15 +60,11 @@ namespace Tizen.NUI.Components.Extension
         {
             base.CopyFrom(bindableObject);
 
-            LottieButtonStyle style = bindableObject as LottieButtonStyle;
-
-            if (style == null)
+            if (bindableObject is LottieButtonStyle lottieButtonStyle)
             {
-                return;
+                LottieUrl = lottieButtonStyle.LottieUrl;
+                PlayRange = lottieButtonStyle.PlayRange?.Clone();
             }
-
-            LottieUrl = style.LottieUrl;
-            PlayRange = style.PlayRange;
         }
 
         /// <inheritdoc/>
index 6f30488..daf1b80 100644 (file)
@@ -60,15 +60,11 @@ namespace Tizen.NUI.Components.Extension
         {
             base.CopyFrom(bindableObject);
 
-            LottieSwitchStyle style = bindableObject as LottieSwitchStyle;
-
-            if (style == null)
+            if (bindableObject is LottieSwitchStyle lottieSwitchStyle)
             {
-                return;
+                LottieUrl = lottieSwitchStyle.LottieUrl;
+                PlayRange = lottieSwitchStyle.PlayRange?.Clone();
             }
-
-            LottieUrl = style.LottieUrl;
-            PlayRange = style.PlayRange;
         }
 
         /// <inheritdoc/>
@@ -77,9 +73,5 @@ namespace Tizen.NUI.Components.Extension
         {
             return new LottieSwitchExtension();
         }
-
-        private void InitSubStyle()
-        {
-        }
     }
 }