Initial code for Apps Application 77/278577/1
authorShivam Varshney/Core S/W Group /SRI-Delhi/Engineer/Samsung Electronics <shivam.v2@samsung.com>
Fri, 22 Jul 2022 06:25:53 +0000 (11:55 +0530)
committerShivam Varshney/Core S/W Group /SRI-Delhi/Engineer/Samsung Electronics <shivam.v2@samsung.com>
Fri, 22 Jul 2022 06:25:53 +0000 (11:55 +0530)
Change-Id: I6e8d0978168e9c51b9eca315c02380c0170580dd
Signed-off-by: Shivam Varshney/Core S/W Group /SRI-Delhi/Engineer/Samsung Electronics <shivam.v2@samsung.com>
22 files changed:
.gitignore [new file with mode: 0644]
Apps/Apps.cs [new file with mode: 0644]
Apps/Apps.csproj [new file with mode: 0644]
Apps/Apps.sln [new file with mode: 0644]
Apps/Common/DeviceInfo.cs [new file with mode: 0644]
Apps/Common/PropertyNotifier.cs [new file with mode: 0644]
Apps/Common/Resources.cs [new file with mode: 0644]
Apps/Core/AppLauncher.cs [new file with mode: 0644]
Apps/Models/AppInfoModel.cs [new file with mode: 0644]
Apps/ViewManager.cs [new file with mode: 0644]
Apps/ViewModels/AppInfoViewModel.cs [new file with mode: 0644]
Apps/ViewModels/AppViewModel.cs [new file with mode: 0644]
Apps/Views/AppItemLayout.cs [new file with mode: 0644]
Apps/Views/AppView.cs [new file with mode: 0644]
Apps/res/themes/dark.xaml [new file with mode: 0644]
Apps/res/themes/light.xaml [new file with mode: 0644]
Apps/shared/res/Apps.png [new file with mode: 0644]
Apps/tizen-manifest.xml [new file with mode: 0644]
LICENSE [new file with mode: 0644]
NOTICE [new file with mode: 0644]
packaging/org.tizen.Apps-1.0.0.tpk [new file with mode: 0644]
packaging/org.tizen.Apps.spec [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..010c61f
--- /dev/null
@@ -0,0 +1,4 @@
+Apps/.vs/
+Apps/bin/
+Apps/obj/
+Apps/Apps.csproj.user
diff --git a/Apps/Apps.cs b/Apps/Apps.cs
new file mode 100644 (file)
index 0000000..a718618
--- /dev/null
@@ -0,0 +1,69 @@
+using Tizen.NUI;
+using Apps.Common;
+
+namespace Apps
+{
+    public class Program : NUIApplication
+    {
+        //We need to show Apps application above tray application .
+        //Current height of tray application is 360. This needs to be updated if height of tray application changes in future.
+        private const int TrayApplicationHeight = 360;
+        private ViewManager viewManager;
+
+        public Program() : base(ThemeOptions.PlatformThemeEnabled)
+        {
+        }
+
+        protected override void OnCreate()
+        {
+            Tizen.Log.Info(Resources.LogTag, "Program OnCreate");
+            base.OnCreate();
+            Window window = Window.Instance;
+            window.SetTransparency(true);
+            int width, height, positionX, positionY;
+            if (DeviceInfo.IsPortrait)
+            {
+                width = DeviceInfo.DisplayHeight / 2;
+                height = DeviceInfo.DisplayWidth / 2;
+                positionX = (DeviceInfo.DisplayWidth - width) / 2;
+                positionY = (DeviceInfo.DisplayHeight - height) / 2;
+            }
+            else
+            {
+                width = DeviceInfo.DisplayWidth / 2;
+                height = DeviceInfo.DisplayHeight / 2;
+                positionX = (DeviceInfo.DisplayWidth - width) / 2;
+                positionY = DeviceInfo.DisplayHeight - height - TrayApplicationHeight.SpToPx();
+            }
+            window.WindowPosition = new Position2D(positionX, positionY);
+            window.WindowSize = new Size2D(width, height);
+            window.BackgroundColor = Color.Transparent;
+            window.KeyEvent += OnKeyEvent;
+            viewManager = new ViewManager(window);
+            Tizen.Log.Info(Resources.LogTag, "Show Window");
+        }
+
+        protected override void OnTerminate()
+        {
+            Tizen.Log.Info(Resources.LogTag, "On App Terminate");
+            viewManager.CleanUp();
+            base.OnTerminate();
+        }
+
+        public void OnKeyEvent(object sender, Window.KeyEventArgs e)
+        {
+            if (e.Key.State == Key.StateType.Down && (e.Key.KeyPressedName == "XF86Back" || e.Key.KeyPressedName == "Escape"))
+            {
+                Exit();
+            }
+        }
+
+        static void Main(string[] args)
+        {
+            Tizen.Log.Info(Resources.LogTag, "Main statrted");
+            Program app = new Program();
+            app.Run(args);
+            Tizen.Log.Info(Resources.LogTag, "Main ended");
+        }
+    }
+}
diff --git a/Apps/Apps.csproj b/Apps/Apps.csproj
new file mode 100644 (file)
index 0000000..9dfc20a
--- /dev/null
@@ -0,0 +1,36 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <OutputType>Exe</OutputType>
+    <TargetFramework>netcoreapp3.1</TargetFramework>
+      <TargetFrameworkIdentifier>Tizen</TargetFrameworkIdentifier>
+    <AssemblyName>Apps</AssemblyName>
+  </PropertyGroup>
+
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugType>portable</DebugType>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>None</DebugType>
+  </PropertyGroup>
+  <ItemGroup>
+    <Compile Remove="res\images\**" />
+    <EmbeddedResource Remove="res\images\**" />
+    <None Remove="res\images\**" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <PackageReference Include="Tizen.NET" Version="10.0.0.17305" />
+    <PackageReference Include="Tizen.NET.Sdk" Version="1.1.8" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <None Update="res\themes\dark.xaml">
+      <Generator>MSBuild:Compile</Generator>
+    </None>
+    <None Update="res\themes\light.xaml">
+      <Generator>MSBuild:Compile</Generator>
+    </None>
+  </ItemGroup>
+
+</Project>
diff --git a/Apps/Apps.sln b/Apps/Apps.sln
new file mode 100644 (file)
index 0000000..5700b09
--- /dev/null
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.30907.101
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Apps", "Apps.csproj", "{A49D73AA-CB7E-4D21-B865-E61570EEF070}"
+EndProject
+Global
+       GlobalSection(SolutionConfigurationPlatforms) = preSolution
+               Debug|Any CPU = Debug|Any CPU
+               Release|Any CPU = Release|Any CPU
+       EndGlobalSection
+       GlobalSection(ProjectConfigurationPlatforms) = postSolution
+               {A49D73AA-CB7E-4D21-B865-E61570EEF070}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+               {A49D73AA-CB7E-4D21-B865-E61570EEF070}.Debug|Any CPU.Build.0 = Debug|Any CPU
+               {A49D73AA-CB7E-4D21-B865-E61570EEF070}.Release|Any CPU.ActiveCfg = Release|Any CPU
+               {A49D73AA-CB7E-4D21-B865-E61570EEF070}.Release|Any CPU.Build.0 = Release|Any CPU
+       EndGlobalSection
+       GlobalSection(SolutionProperties) = preSolution
+               HideSolutionNode = FALSE
+       EndGlobalSection
+       GlobalSection(ExtensibilityGlobals) = postSolution
+               SolutionGuid = {BEA88B8F-9C50-44CA-8A31-B3DDC15622F5}
+       EndGlobalSection
+EndGlobal
diff --git a/Apps/Common/DeviceInfo.cs b/Apps/Common/DeviceInfo.cs
new file mode 100644 (file)
index 0000000..8ad1e92
--- /dev/null
@@ -0,0 +1,31 @@
+using Tizen.System;
+
+namespace Apps.Common
+{
+    public static class DeviceInfo
+    {
+        private static int width;
+        private static int height;
+        private const string WidthKey = "tizen.org/feature/screen.width";
+        private const string HeightKey = "tizen.org/feature/screen.height";
+
+        static DeviceInfo()
+        {
+            bool isWidthAvailable = Information.TryGetValue(WidthKey, out width);
+            bool isHeightAvailable = Information.TryGetValue(HeightKey, out height);
+            if(isHeightAvailable == false || isWidthAvailable == false)
+            {
+                width = 1920;
+                height = 1080;
+                Tizen.Log.Debug(Resources.LogTag, "Width and height are not available , setting default size as 1920 x 1080");
+            }
+            IsPortrait = width < height;
+        }
+
+        public static bool IsPortrait { get; private set; }
+
+        public static int DisplayWidth => width;
+
+        public static int DisplayHeight => height;
+    }
+}
diff --git a/Apps/Common/PropertyNotifier.cs b/Apps/Common/PropertyNotifier.cs
new file mode 100644 (file)
index 0000000..c324bc6
--- /dev/null
@@ -0,0 +1,27 @@
+using System.ComponentModel;
+using System.Runtime.CompilerServices;
+
+namespace Apps.Common
+{
+    class PropertyNotifier : INotifyPropertyChanged
+    {
+        public event PropertyChangedEventHandler PropertyChanged;
+
+        protected bool SetProperty<T>(ref T storage, T value, [CallerMemberName] string propertyName = null)
+        {
+            if (Equals(storage, value))
+            {
+                return false;
+            }
+
+            storage = value;
+            OnPropertyChanged(propertyName);
+            return true;
+        }
+
+        protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
+        {
+            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+        }
+    }
+}
diff --git a/Apps/Common/Resources.cs b/Apps/Common/Resources.cs
new file mode 100644 (file)
index 0000000..70657ad
--- /dev/null
@@ -0,0 +1,14 @@
+namespace Apps.Common
+{
+    class Resources
+    {
+        public const string LogTag = "AppsApplication";
+        public const string LightPlatformThemeId = "org.tizen.default-light-theme";
+        public const string DarkPlatformThemeId = "org.tizen.default-dark-theme";
+
+        public static string GetThemePath()
+        {
+            return Tizen.Applications.Application.Current.DirectoryInfo.Resource + "themes/";
+        }
+    }
+}
diff --git a/Apps/Core/AppLauncher.cs b/Apps/Core/AppLauncher.cs
new file mode 100644 (file)
index 0000000..fe35320
--- /dev/null
@@ -0,0 +1,17 @@
+using Tizen.Applications;
+
+namespace Apps.Core
+{
+    public static class AppLauncher
+    {
+        public static void LaunchApplication(string id)
+        {
+            AppControl appControl = new AppControl()
+            {
+                ApplicationId = id,
+                Operation = id == "org.tizen.homescreen-efl" ? AppControlOperations.Main : AppControlOperations.Default,
+            };
+            AppControl.SendLaunchRequest(appControl);
+        }
+    }
+}
diff --git a/Apps/Models/AppInfoModel.cs b/Apps/Models/AppInfoModel.cs
new file mode 100644 (file)
index 0000000..d40f8bd
--- /dev/null
@@ -0,0 +1,26 @@
+using Apps.Common;
+
+namespace Apps.Models
+{
+    class AppInfoModel : PropertyNotifier
+    {
+        public AppInfoModel(string name, string applicationId, string url)
+        {
+            Name = name;
+            ApplicationId = applicationId;
+            IconUrl = url;
+        }
+
+        public string Name { get; internal set; }
+
+        public string ApplicationId { get; internal set; }
+
+        private string iconUrl;
+
+        public string IconUrl
+        {
+            get => iconUrl;
+            set => SetProperty(ref iconUrl, value);
+        }
+    }
+}
diff --git a/Apps/ViewManager.cs b/Apps/ViewManager.cs
new file mode 100644 (file)
index 0000000..1abe142
--- /dev/null
@@ -0,0 +1,136 @@
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using System.Linq;
+using System.IO;
+using Tizen.NUI.Xaml;
+using Tizen.Applications;
+using Tizen.NUI;
+using Apps.Common;
+using Apps.ViewModels;
+using Apps.Views;
+
+namespace Apps
+{
+    class ViewManager
+    {
+        private IEnumerable<ApplicationInfo> appList;
+        private AppViewModel appViewModel;
+        private AppView appView;
+
+        public ViewManager(Window window)
+        {
+            Task<IEnumerable<ApplicationInfo>> appListTask = CreateAppList();
+
+            UpdateTheme(ThemeManager.PlatformThemeId);
+
+            appViewModel = new AppViewModel();
+            appView = new AppView(appViewModel);
+            window.Add(appView);
+            window.Resized += OnResize;
+            UpdateViewModel(appListTask);
+
+            PackageManager.InstallProgressChanged += OnInstallProgressChanged;
+            PackageManager.UninstallProgressChanged += OnUninstallProgressChanged;
+
+            ThemeManager.ThemeChanged += OnThemeChanged;
+        }
+
+        public void CleanUp()
+        {
+            PackageManager.InstallProgressChanged -= OnInstallProgressChanged;
+            PackageManager.UninstallProgressChanged -= OnUninstallProgressChanged;
+            ThemeManager.ThemeChanged -= OnThemeChanged;
+            appView?.Dispose();            
+        }
+
+        private void OnThemeChanged(object sender, ThemeChangedEventArgs e)
+        {
+            if (e.IsPlatformThemeChanged)
+            {
+                Tizen.Log.Info(Resources.LogTag, "Theme Changed: " + e.ThemeId);
+                UpdateTheme(e.PlatformThemeId);
+            }
+        }
+
+        private void OnResize(object sender, Window.ResizedEventArgs e)
+        {
+            appView.SizeHeight = Window.Instance.Size.Height - 48.SpToPx();
+        }
+
+        private Task<IEnumerable<ApplicationInfo>> CreateAppList()
+        {
+            ApplicationInfoFilter appInfoFilter = new ApplicationInfoFilter();
+            appInfoFilter.Filter.Add(ApplicationInfoFilter.Keys.NoDisplay, "False");
+            return ApplicationManager.GetInstalledApplicationsAsync(appInfoFilter);
+        }
+
+        private void UpdateViewModel(Task<IEnumerable<ApplicationInfo>> appListTask)
+        {
+            appListTask.Wait();
+            appList = appListTask.Result;
+            appList = appList.OrderBy(c => c.Label);
+            appViewModel.CreateData(appList);
+        }
+
+        private void OnInstallProgressChanged(object sender, PackageManagerEventArgs e)
+        {
+            if (e.State == PackageEventState.Completed)
+            {
+                Task<IEnumerable<ApplicationInfo>> appListTask= CreateAppList();
+                UpdateViewModel(appListTask);
+            }
+        }
+
+        private void OnUninstallProgressChanged(object sender, PackageManagerEventArgs e)
+        {
+            if (e.Progress == 0)
+            {
+                appList = appList.Where(c => c.PackageId != e.PackageId);
+                appViewModel.CreateData(appList);
+            }
+        }
+
+        private void SetTheme(string path)
+        {
+            try
+            {
+                Theme theme = new Theme(path);
+                ThemeManager.ApplyTheme(theme);
+            }
+            catch (ArgumentNullException e)
+            {
+                Tizen.Log.Error(Resources.LogTag, "ArgumentNullException: " + e.ParamName);
+            }
+            catch (IOException e)
+            {
+                Tizen.Log.Error(Resources.LogTag, "IOException: " + e.Message);
+            }
+            catch (XamlParseException e)
+            {
+                Tizen.Log.Error(Resources.LogTag, "XamlParseException: " + e.Message);
+                if (e.XmlInfo != null)
+                {
+                    Tizen.Log.Error(Resources.LogTag, "XamlParseException, LineNo." + e.XmlInfo.LineNumber + " Pos: " + e.XmlInfo.LinePosition + " HasInfo: " + e.XmlInfo.HasLineInfo().ToString());
+                }
+            }
+        }
+
+        private void UpdateTheme(string platformThemeId)
+        {
+            if (platformThemeId == null)
+            {
+                Tizen.Log.Error(Resources.LogTag, "Platform theme id is null");
+                return;
+            }
+            if (platformThemeId.Equals(Resources.LightPlatformThemeId))
+            {
+                SetTheme(Resources.GetThemePath() + "light.xaml");
+            }
+            else if (platformThemeId.Equals(Resources.DarkPlatformThemeId))
+            {
+                SetTheme(Resources.GetThemePath() + "dark.xaml");
+            }
+        }
+    }
+}
diff --git a/Apps/ViewModels/AppInfoViewModel.cs b/Apps/ViewModels/AppInfoViewModel.cs
new file mode 100644 (file)
index 0000000..3008653
--- /dev/null
@@ -0,0 +1,31 @@
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using Tizen.Applications;
+using Apps.Common;
+using Apps.Models;
+
+namespace Apps.ViewModels
+{
+    class AppInfoViewModel : ObservableCollection<AppInfoModel>
+    {
+        public AppInfoViewModel()
+        {
+        }
+
+        public void CreateData(IEnumerable<ApplicationInfo> list)
+        {
+            Clear();
+            foreach (ApplicationInfo appInfo in list)
+            {
+                if (string.IsNullOrEmpty(appInfo.IconPath) || appInfo.Label == "Apps" || appInfo.Label == "TrayApplication")
+                {
+                    continue;
+                }
+                AppInfoModel appInfoModel = new AppInfoModel(appInfo.Label, appInfo.ApplicationId, appInfo.IconPath);
+                Add(appInfoModel);
+                Tizen.Log.Info(Resources.LogTag, "App name is " + appInfo.Label);
+                Tizen.Log.Info(Resources.LogTag, "Application ID is " + appInfo.ApplicationId);
+            }
+        }
+    }
+}
diff --git a/Apps/ViewModels/AppViewModel.cs b/Apps/ViewModels/AppViewModel.cs
new file mode 100644 (file)
index 0000000..9e088c7
--- /dev/null
@@ -0,0 +1,48 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Text;
+using System.Windows.Input;
+using Tizen.Applications;
+using Tizen.NUI.Binding;
+using Apps.Common;
+using Apps.Models;
+
+namespace Apps.ViewModels
+{
+    class AppViewModel : PropertyNotifier
+    {
+        public AppViewModel()
+        {
+            AppListSource = new AppInfoViewModel();
+            AppSelectCommand = new Command(OnAppSelect);
+        }
+
+        private IEnumerable appListSource;
+
+        public IEnumerable AppListSource
+        {
+            get => appListSource;
+            set => SetProperty(ref appListSource, value);
+        }
+
+        private ICommand appSelectCommand;
+
+        public ICommand AppSelectCommand
+        {
+            get => appSelectCommand;
+            set => SetProperty(ref appSelectCommand, value);
+        }
+
+        public void CreateData(IEnumerable<ApplicationInfo> list)
+        {
+            ((AppInfoViewModel)AppListSource).CreateData(list);
+        }
+
+        private void OnAppSelect(object selectedItem)
+        {
+            Models.AppInfoModel appInfo = (Models.AppInfoModel)selectedItem;
+            Core.AppLauncher.LaunchApplication(appInfo.ApplicationId);
+        }
+    }
+}
diff --git a/Apps/Views/AppItemLayout.cs b/Apps/Views/AppItemLayout.cs
new file mode 100644 (file)
index 0000000..cdd734a
--- /dev/null
@@ -0,0 +1,134 @@
+using Tizen.NUI;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using Apps.Common;
+
+namespace Apps.Views
+{
+    class AppItemLayout : RecyclerViewItem
+    {
+        private View baseView;
+        private View iconBackgroundView;
+        private TextLabel appLabel;
+        private ImageView appIcon;
+
+        public AppItemLayout() : base()
+        {
+            BackgroundColor = Color.Transparent;
+            WidthSpecification = 154.SpToPx();
+            HeightSpecification = 162.SpToPx();
+            Layout = new LinearLayout()
+            {
+                Padding = new Extents(8, 8, 12, 12).SpToPx(),
+                VerticalAlignment = VerticalAlignment.Center,
+                HorizontalAlignment = HorizontalAlignment.Center,
+            };
+
+            baseView = new View()
+            {
+                ThemeChangeSensitive = true,
+                StyleName = "TrayBackGround",
+                WidthSpecification = 138.SpToPx(),
+                HeightSpecification = 138.SpToPx(),
+                CornerRadius = new Vector4(12, 12, 12, 12),
+                BoxShadow = new Shadow(4.0f, new Color(0, 0, 0, 0.10f), new Vector2(2, 2)),
+                Layout = new LinearLayout()
+                {
+                    Padding = new Extents(0, 0, 8, 0).SpToPx(),
+                    HorizontalAlignment = HorizontalAlignment.Center,
+                    VerticalAlignment = VerticalAlignment.Top,
+                    LinearOrientation = LinearLayout.Orientation.Vertical,
+                }
+            };
+            base.Add(baseView);
+
+            iconBackgroundView = new View()
+            {
+                CornerRadius = new Vector4(12, 12, 12, 12),
+                WidthSpecification = 122.SpToPx(),
+                HeightSpecification = 102.SpToPx(),
+                Layout = new LinearLayout()
+                {
+                    VerticalAlignment = VerticalAlignment.Center,
+                    HorizontalAlignment = HorizontalAlignment.Center,
+                },
+            };
+            baseView.Add(iconBackgroundView);
+
+            appIcon = new ImageView()
+            {
+                MaximumSize = new Size2D(96, 96).SpToPx(),
+            };
+            iconBackgroundView.Add(appIcon);
+
+            appLabel = new TextLabel()
+            {
+                StyleName = "ItemTitle",
+                ThemeChangeSensitive = true,
+                HeightSpecification = 24.SpToPx(),
+                WidthSpecification = LayoutParamPolicies.MatchParent,
+                HorizontalAlignment = HorizontalAlignment.Center,
+                VerticalAlignment = VerticalAlignment.Center,
+            };
+
+            baseView.Add(appLabel);
+
+            UpdateTheme(ThemeManager.PlatformThemeId);
+            ThemeManager.ThemeChanged += OnThemeUpdated;
+        }
+
+        public TextLabel Label => appLabel;
+
+        public ImageView Icon => appIcon;
+
+        public View IconBackground => iconBackgroundView;
+
+        protected override void Dispose(DisposeTypes type)
+        {
+            if (Disposed)
+            {
+                return;
+            }
+            if (type == DisposeTypes.Explicit)
+            {
+                baseView.Remove(appLabel);
+                appLabel?.Dispose();
+                appLabel = null;
+                
+                iconBackgroundView.Remove(appIcon);
+                appIcon?.Dispose();
+                appIcon = null;
+
+                baseView.Remove(iconBackgroundView);
+                iconBackgroundView?.Dispose();
+                iconBackgroundView = null;
+
+                Remove(baseView);
+                baseView?.Dispose();
+                baseView = null;
+            }
+            Tizen.Log.Info(Resources.LogTag, "Dispose appItemLayout");
+            base.Dispose(type);
+        }
+
+        private void OnThemeUpdated(object sender, ThemeChangedEventArgs e)
+        {
+            if (e.IsPlatformThemeChanged)
+            {
+                UpdateTheme(e.PlatformThemeId);
+            }
+        }
+
+        private void UpdateTheme(string currentPlatformThemeId)
+        {
+            if (currentPlatformThemeId.Equals(Resources.LightPlatformThemeId))
+            {
+                baseView.BoxShadow = new Shadow(4.0f, new Color(0, 0, 0, 0.20f), new Vector2(2, 2));
+            }
+            else if (currentPlatformThemeId.Equals(Resources.DarkPlatformThemeId))
+            {
+                baseView.BoxShadow = new Shadow(4.0f, new Color(1.0f, 1.0f, 1.0f, 0.20f), new Vector2(2, 2));
+            }
+        }
+    }
+}
diff --git a/Apps/Views/AppView.cs b/Apps/Views/AppView.cs
new file mode 100644 (file)
index 0000000..9c5daf7
--- /dev/null
@@ -0,0 +1,89 @@
+using System.Collections;
+using System.Windows.Input;
+using Tizen.NUI;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Binding;
+using Apps.Common;
+
+namespace Apps.Views
+{
+    class AppView : CollectionView
+    {
+        public static readonly BindableProperty AppSelectCommandProperty = BindableProperty.Create(nameof(AppSelectCommand), typeof(ICommand), typeof(AppView), null, propertyChanged: (bindable, oldValue, newValue) =>
+        {
+            var instance = (AppView)bindable;
+            if (oldValue != newValue)
+            {
+                instance.appSelectCommand = (ICommand)newValue;
+            }
+        },
+        defaultValueCreator: (bindable) => ((AppView)bindable).appSelectCommand);
+
+        public AppView(object viewModel) : base()
+        {
+            Name = "AppView";
+            StyleName = "TrayBackGround";
+            ThemeChangeSensitive = true;
+            CornerRadius = new Vector4(24, 24, 24, 24);
+            WidthSpecification = LayoutParamPolicies.MatchParent;
+            HeightSpecification = Window.Instance.Size.Height - 48.SpToPx();
+            ItemsLayouter = new GridLayouter();
+            ScrollingDirection = Direction.Vertical;
+            SelectionMode = ItemSelectionMode.Single;
+            BindingContext = viewModel;
+            ItemTemplate = new DataTemplate(() =>
+            {
+                AppItemLayout item = new AppItemLayout();
+                item.Label.SetBinding(TextLabel.TextProperty, "Name");
+                item.Icon.SetBinding(ImageView.ResourceUrlProperty, "IconUrl");
+                return item;
+            });
+            Header = GetHeader();
+            this.SetBinding(CollectionView.ItemsSourceProperty, "AppListSource");
+            this.SetBinding(AppSelectCommandProperty, "AppSelectCommand");
+
+            SelectionChanged += OnAppSelection;
+            Tizen.Log.Info(Resources.LogTag, "AppView");
+        }
+
+        private ICommand appSelectCommand;
+
+        public ICommand AppSelectCommand
+        {
+            get => (ICommand)GetValue(AppSelectCommandProperty);
+            set => SetValue(AppSelectCommandProperty, value);
+        }
+
+        private void OnAppSelection(object sender, SelectionChangedEventArgs e)
+        {
+            if(SelectedItem == null)
+            {
+                return;
+            }
+            AppSelectCommand.Execute(SelectedItem);
+            SelectedItem = null;
+            NUIApplication.Current.Exit();
+        }
+
+        private RecyclerViewItem GetHeader()
+        {
+            DefaultTitleItem allAppTitle = new DefaultTitleItem("Header")
+            {
+                ThemeChangeSensitive = true,
+                Padding = new Extents(40, 40, 0, 0).SpToPx(),
+                Text = "All Apps",
+                HeightSpecification = 44.SpToPx(),
+                WidthSpecification = LayoutParamPolicies.MatchParent,
+            };
+            allAppTitle.Label.FontFamily = "BreezeSans";
+            allAppTitle.Label.FontStyle = new PropertyMap().
+                                                           Add("width", new PropertyValue("normal")).
+                                                           Add("weight", new PropertyValue("normal")).
+                                                           Add("slant", new PropertyValue("normal"));
+
+            return allAppTitle;
+        }
+    }
+}
+
diff --git a/Apps/res/themes/dark.xaml b/Apps/res/themes/dark.xaml
new file mode 100644 (file)
index 0000000..90d1f92
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Theme
+xmlns="http://tizen.org/Tizen.NUI/2018/XAML"
+xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+xmlns:c="clr-namespace:Tizen.NUI.Components;assembly=Tizen.NUI.Components"
+Id="DarkTheme">
+
+    <ViewStyle x:Key="TrayBackGround" BackgroundColor="#16131A" />
+    <c:DefaultTitleItemStyle x:Key="Header" ThemeChangeSensitive="True" >
+        <c:DefaultTitleItemStyle.Label>
+            <TextLabelStyle PixelSize ="24sp" TextColor ="#FDFDFD" />
+        </c:DefaultTitleItemStyle.Label>
+    </c:DefaultTitleItemStyle>
+
+    <TextLabelStyle x:Key="ItemTitle" TextColor="#FDFDFD" FontFamily="BreezeSans" PixelSize="16sp"/>
+</Theme>
\ No newline at end of file
diff --git a/Apps/res/themes/light.xaml b/Apps/res/themes/light.xaml
new file mode 100644 (file)
index 0000000..e3f046b
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Theme
+xmlns="http://tizen.org/Tizen.NUI/2018/XAML"
+xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+xmlns:c="clr-namespace:Tizen.NUI.Components;assembly=Tizen.NUI.Components"
+Id="LightTheme">
+
+    <ViewStyle x:Key="TrayBackGround" BackgroundColor="#FAFAFA" />
+    <c:DefaultTitleItemStyle x:Key="Header" ThemeChangeSensitive="True">
+        <c:DefaultTitleItemStyle.Label>
+            <TextLabelStyle PixelSize ="24sp" TextColor ="#090E21" />
+        </c:DefaultTitleItemStyle.Label>
+    </c:DefaultTitleItemStyle>
+
+    <TextLabelStyle x:Key="ItemTitle" TextColor="#090E21" FontFamily="BreezeSans" PixelSize="16sp"/>
+</Theme>
\ No newline at end of file
diff --git a/Apps/shared/res/Apps.png b/Apps/shared/res/Apps.png
new file mode 100644 (file)
index 0000000..9f3cb98
Binary files /dev/null and b/Apps/shared/res/Apps.png differ
diff --git a/Apps/tizen-manifest.xml b/Apps/tizen-manifest.xml
new file mode 100644 (file)
index 0000000..d0f2840
--- /dev/null
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest package="org.tizen.Apps" version="1.0.0" api-version="6" xmlns="http://tizen.org/ns/packages">
+    <profile name="common" />
+    <ui-application appid="org.tizen.Apps" exec="Apps.dll" multiple="false" nodisplay="false" taskmanage="true" type="dotnet" launch_mode="single">
+        <label>Apps</label>
+        <icon>Apps.png</icon>
+        <metadata key="http://tizen.org/metadata/prefer_dotnet_aot" value="true" />
+        <splash-screens />
+    </ui-application>
+    <shortcut-list />
+    <privileges>
+               <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
+               <privilege>http://tizen.org/privilege/packagemanager.info</privilege>
+    </privileges>
+    <dependencies />
+    <provides-appdefined-privileges />
+</manifest>
diff --git a/LICENSE b/LICENSE
new file mode 100644 (file)
index 0000000..54b213e
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,204 @@
+Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
diff --git a/NOTICE b/NOTICE
new file mode 100644 (file)
index 0000000..e5bd3ca
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1,3 @@
+Copyright (c) 2022 Samsung Electronics Co., Ltd. All rights reserved.
+Except as noted, this software is licensed under Apache License, Version 2.
+Please, see the LICENSE file for Apache License terms and conditions.
\ No newline at end of file
diff --git a/packaging/org.tizen.Apps-1.0.0.tpk b/packaging/org.tizen.Apps-1.0.0.tpk
new file mode 100644 (file)
index 0000000..258c360
Binary files /dev/null and b/packaging/org.tizen.Apps-1.0.0.tpk differ
diff --git a/packaging/org.tizen.Apps.spec b/packaging/org.tizen.Apps.spec
new file mode 100644 (file)
index 0000000..e829632
--- /dev/null
@@ -0,0 +1,35 @@
+Name:       org.tizen.Apps
+Summary:    org.tizen.Apps
+Version:    1.0.0
+Release:    1
+Group:      N/A
+License:    Apache-2.0
+Source0:    %{name}-%{version}.tar.gz
+
+ExclusiveArch:  %{ix86} %{arm} aarch64
+
+
+BuildRequires:  pkgconfig(libtzplatform-config)
+Requires(post):  /usr/bin/tpk-backend
+
+%define internal_name org.tizen.Apps
+%define preload_tpk_path %{TZ_SYS_RO_APP}/.preload-tpk
+
+%description
+This is the application to access all installed apps in the device
+
+%prep
+%setup -q
+
+%build
+
+%install
+rm -rf %{buildroot}
+mkdir -p %{buildroot}/%{preload_tpk_path}
+install packaging/%{internal_name}-%{version}.tpk %{buildroot}/%{preload_tpk_path}/
+
+%post
+
+%files
+%defattr(-,root,root,-)
+%{preload_tpk_path}/*