Add Apps gadget.
authorPiotr Czaja/Advanced Frameworks (PLT) /SRPOL/Engineer/Samsung Electronics <p.czaja@samsung.com>
Wed, 14 Jun 2023 13:43:02 +0000 (15:43 +0200)
committerYurii Zinchuk/Tizen Services & IoT (PLT) /SRPOL/Engineer/Samsung Electronics <y.zinchuk@samsung.com>
Wed, 28 Jun 2023 07:10:44 +0000 (09:10 +0200)
Change-Id: I3e8f9ea40c567f427771e16502d144e903fc5292

SettingMainGadget/SettingMainGadget/AppsGadget.cs [new file with mode: 0644]
SettingMainGadget/SettingMainGadget/MainMenuProvider.cs
SettingMainGadget/SettingMainGadget/SettingMainGadget.csproj
SettingMainGadget/SettingMainGadget/res/allowed/SettingMainGadget/apps.svg [new file with mode: 0644]

diff --git a/SettingMainGadget/SettingMainGadget/AppsGadget.cs b/SettingMainGadget/SettingMainGadget/AppsGadget.cs
new file mode 100644 (file)
index 0000000..1a3df13
--- /dev/null
@@ -0,0 +1,73 @@
+using SettingCore;
+using SettingCore.Views;
+using SettingMainGadget;
+using SettingMainGadget.TextResources;
+using System.Collections.Generic;
+using System.Linq;
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Components;
+
+namespace Setting.Menu
+{
+    internal class AppsGadget : MainMenuGadget
+    {
+        public override Color ProvideIconColor() => new Color(IsLightTheme ? "#7F2982" : "#922F95");
+
+        public override string ProvideIconPath() => GetResourcePath("apps.svg");
+
+        public override string ProvideTitle() => NUIGadgetResourceManager.GetString(nameof(Resources.IDS_ST_BODY_APPLICATIONS));
+
+        private ScrollableBase content;
+        private Sections sections = new Sections();
+
+        protected override View OnCreate()
+        {
+            base.OnCreate();
+
+            content = new ScrollableBase()
+            {
+                WidthSpecification = LayoutParamPolicies.MatchParent,
+                HeightSpecification = LayoutParamPolicies.MatchParent,
+                ScrollingDirection = ScrollableBase.Direction.Vertical,
+                HideScrollbar = false,
+                Layout = new LinearLayout()
+                {
+                    LinearOrientation = LinearLayout.Orientation.Vertical,
+                },
+            };
+
+            CreateView();
+
+            return content;
+        }
+
+        private void CreateView()
+        {
+            content.RemoveAllChildren(true);
+            sections.RemoveAllSectionsFromView(content);
+
+            var appsManagerItem = TextListItem.CreatePrimaryTextItem(NUIGadgetResourceManager.GetString(nameof(Resources.IDS_ST_BODY_APPLICATION_MANAGER)));
+            sections.Add(MainMenuProvider.Apps_AppsManager, appsManagerItem);
+            appsManagerItem.Clicked += (o, e) =>
+            {
+                // TODO : NavigateTo App Manager
+            };
+            content.Add(appsManagerItem);
+
+            var defaultAppsItem = TextListItem.CreatePrimaryTextItem(NUIGadgetResourceManager.GetString(nameof(Resources.IDS_ST_HEADER_DEFAULT_APPLICATIONS_ABB)));
+            sections.Add(MainMenuProvider.Apps_DefaultApps, defaultAppsItem);
+            defaultAppsItem.Clicked += (o, e) =>
+            {
+                // TODO : NavigateTo Default apps
+            };
+            content.Add(defaultAppsItem);
+        }
+        protected override void OnCustomizationUpdate(IEnumerable<MenuCustomizationItem> items)
+        {
+            Logger.Verbose($"{nameof(AppsGadget)} got customization with {items.Count()} items. Recreating view.");
+            CreateView();
+        }
+
+    }
+}
index 1d808b7c0f749a387c2a539b2744e4b2ed3deabd..d2721293572c2bea961dc8b67be45d8b0c3219a6 100644 (file)
@@ -46,6 +46,11 @@ namespace SettingMainGadget
         public static string About_DeviceStatus_storage = "About.DeviceStatus.Storage";
         public static string About_DeviceStatus_cpu_usage = "About.DeviceStatus.CpuUsage";
 
+        // apps
+        public static string Apps = "Apps";
+        public static string Apps_AppsManager = "Apps.AppsManager";
+        public static string Apps_DefaultApps = "Apps.DefaultApps";
+
         //storage
         public static string Storage = "Storage";
         public static string Storage_InternalUsage = "Storage.InternalUsage";
@@ -116,6 +121,10 @@ namespace SettingMainGadget
                 new SettingMenu(path: About_DeviceStatus_wifi_mac_address, defaultOrder: 20),
                 new SettingMenu(path: About_DeviceStatus_storage, defaultOrder: 30),
                 new SettingMenu(path: About_DeviceStatus_cpu_usage, defaultOrder: 40),
+                // apps
+                new SettingMenu(path: Apps, defaultOrder: 80, type: typeof(Setting.Menu.AppsGadget)),
+                new SettingMenu(path: Apps_AppsManager, defaultOrder: 10),
+                new SettingMenu(path: Apps_DefaultApps, defaultOrder: 20),
                 //storage
                 new SettingMenu(path: Storage, defaultOrder: 120, type: typeof(Setting.Menu.StorageGadget)),
                 new SettingMenu(path: Storage_InternalUsage, defaultOrder: 10),
index 822a27fe9ba90bccd6abbdb7de9f582697c19117..b52eb46d7be716501fdf71d077f4c6904182b705 100644 (file)
     </EmbeddedResource>
   </ItemGroup>
 
-  <ItemGroup>
-    <Folder Include="res\" />
-  </ItemGroup>
-
   <Target Name="PostBuild" AfterTargets="PostBuildEvent">
     <Exec Command=":: Copy resource dll&#xD;&#xA;rmdir /S /Q res\allowed\locale&#xD;&#xA;mkdir res\allowed\locale&#xD;&#xA;dir $(OutDir)\&#xD;&#xA;xcopy /S /K /D /H /Y $(OutDir)\ res\allowed\locale&#xD;&#xA;del /q res\allowed\locale\*.*&#xD;&#xA;xcopy /S /K /D /H /Y res\allowed\locale\* res\allowed&#xD;&#xA;rmdir /S /Q res\allowed\locale&#xD;&#xA;" />
   </Target>
diff --git a/SettingMainGadget/SettingMainGadget/res/allowed/SettingMainGadget/apps.svg b/SettingMainGadget/SettingMainGadget/res/allowed/SettingMainGadget/apps.svg
new file mode 100644 (file)
index 0000000..5ea6082
--- /dev/null
@@ -0,0 +1,6 @@
+<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
+  <path d="M13.7065 7.49414H8.70753C7.98238 7.49414 7.39453 8.08218 7.39453 8.80757V13.8082C7.39453 14.5336 7.98238 15.1216 8.70753 15.1216H13.7065C14.4317 15.1216 15.0195 14.5336 15.0195 13.8082V8.80757C15.0195 8.08218 14.4317 7.49414 13.7065 7.49414Z" fill="#FAFAFA"/>
+  <path d="M23.188 15.6278H18.188C17.7074 15.627 17.2468 15.4357 16.9069 15.0957C16.5671 14.7558 16.3758 14.295 16.375 13.8142V8.81259C16.3758 8.33193 16.5671 7.87119 16.907 7.53141C17.2468 7.19162 17.7075 7.00053 18.188 7H23.188C23.6684 7.00053 24.129 7.19166 24.4687 7.53147C24.8084 7.87128 24.9995 8.33202 25 8.81259V13.8142C24.9995 14.2949 24.8084 14.7557 24.4688 15.0957C24.1291 15.4357 23.6685 15.627 23.188 15.6278V15.6278ZM18.188 8.00033C17.9725 8.00033 17.7659 8.08587 17.6135 8.23817C17.461 8.39047 17.3753 8.59707 17.375 8.81259V13.8142C17.3753 14.0298 17.461 14.2365 17.6134 14.389C17.7658 14.5414 17.9724 14.6272 18.188 14.6275H23.188C23.4034 14.6272 23.61 14.5414 23.7623 14.3889C23.9145 14.2364 24 14.0297 24 13.8142V8.81259C23.9997 8.59724 23.9141 8.39079 23.7619 8.23852C23.6097 8.08624 23.4033 8.00059 23.188 8.00033H18.188Z" fill="#FAFAFA"/>
+  <path d="M23.188 24.9989H18.188C17.7074 24.9981 17.2468 24.8068 16.9069 24.4668C16.5671 24.1269 16.3758 23.6661 16.375 23.1853V18.1837C16.3758 17.703 16.5671 17.2423 16.907 16.9025C17.2468 16.5627 17.7075 16.3716 18.188 16.3711H23.188C23.6684 16.3716 24.129 16.5628 24.4687 16.9026C24.8084 17.2424 24.9995 17.7031 25 18.1837V23.1853C24.9995 23.666 24.8084 24.1268 24.4688 24.4668C24.1291 24.8067 23.6685 24.9981 23.188 24.9989V24.9989ZM18.188 17.3714C17.9725 17.3714 17.7659 17.457 17.6135 17.6093C17.461 17.7616 17.3753 17.9682 17.375 18.1837V23.1853C17.3753 23.4009 17.461 23.6076 17.6134 23.7601C17.7658 23.9125 17.9724 23.9983 18.188 23.9986H23.188C23.4034 23.9983 23.61 23.9125 23.7623 23.76C23.9145 23.6075 24 23.4008 24 23.1853V18.1837C23.9997 17.9683 23.9141 17.7619 23.7619 17.6096C23.6097 17.4573 23.4033 17.3717 23.188 17.3714H18.188Z" fill="#FAFAFA"/>
+  <path d="M13.812 24.9989H8.81195C8.33145 24.9981 7.87092 24.8067 7.53125 24.4668C7.19158 24.1268 7.00053 23.666 7 23.1853V18.1837C7.00053 17.7031 7.19161 17.2424 7.53131 16.9026C7.87101 16.5628 8.33154 16.3716 8.81195 16.3711H13.812C14.2925 16.3716 14.7532 16.5627 15.093 16.9025C15.4329 17.2423 15.6242 17.703 15.625 18.1837V23.1853C15.6242 23.6661 15.4329 24.1269 15.0931 24.4668C14.7532 24.8068 14.2925 24.9981 13.812 24.9989V24.9989ZM8.81195 17.3714C8.59668 17.3717 8.39032 17.4573 8.2381 17.6096C8.08588 17.7619 8.00026 17.9683 8 18.1837V23.1853C8 23.4008 8.08548 23.6075 8.23773 23.76C8.38998 23.9125 8.5965 23.9983 8.81195 23.9986H13.812C14.0275 23.9983 14.2341 23.9125 14.3865 23.7601C14.5389 23.6076 14.6247 23.4009 14.625 23.1853V18.1837C14.6247 17.9682 14.5389 17.7616 14.3865 17.6093C14.234 17.457 14.0274 17.3714 13.812 17.3714H8.81195Z" fill="#FAFAFA"/>
+</svg>