diff options
author | Shivam Varshney/Core S/W Group /SRI-Delhi/Engineer/Samsung Electronics <shivam.v2@samsung.com> | 2024-01-15 19:18:24 +0530 |
---|---|---|
committer | Shivam Varshney/Core S/W Group /SRI-Delhi/Engineer/Samsung Electronics <shivam.v2@samsung.com> | 2024-01-15 19:18:24 +0530 |
commit | 47cf7c0cc0afb2a73957969314a88ec4aea0d415 (patch) | |
tree | aa5f6b65e0579cb03ba1d779e093b663cc0f40b4 | |
parent | 04de8c242cd60a2b0403e28a032bf4fab0104116 (diff) | |
download | tray-47cf7c0cc0afb2a73957969314a88ec4aea0d415.tar.gz tray-47cf7c0cc0afb2a73957969314a88ec4aea0d415.tar.bz2 tray-47cf7c0cc0afb2a73957969314a88ec4aea0d415.zip |
This commit has following changes:accepted/tizen/unified/x/20240205.063829accepted/tizen/unified/20240122.175427
1. Updating Apps UI as per new UX
2. Updating Addition/Removal of Apps on App Install/Uninstall
Change-Id: I8ea02417b1a34b9ddec88b4ac5500d74863cee14
Signed-off-by: Shivam Varshney/Core S/W Group /SRI-Delhi/Engineer/Samsung Electronics <shivam.v2@samsung.com>
-rw-r--r-- | Apps/Core/AppLauncher.cs | 1 | ||||
-rwxr-xr-x | Apps/Models/AppInfoModel.cs | 34 | ||||
-rw-r--r-- | Apps/TextResources/Resources.Designer.cs | 3 | ||||
-rwxr-xr-x | Apps/ViewManager.cs | 22 | ||||
-rwxr-xr-x | Apps/ViewModels/AppInfoViewModel.cs | 14 | ||||
-rwxr-xr-x | Apps/ViewModels/AppViewModel.cs | 37 | ||||
-rw-r--r-- | Apps/Views/AppItemLayout.cs | 1 | ||||
-rwxr-xr-x | Apps/Views/AppView.cs | 1 | ||||
-rw-r--r-- | Apps/Views/SelectAppItemLayout.cs | 1 | ||||
-rw-r--r-- | Apps/Views/SelectAppsView.cs | 1 | ||||
-rwxr-xr-x | packaging/org.tizen.Apps-1.0.0.tpk | bin | 88281 -> 88321 bytes |
11 files changed, 61 insertions, 54 deletions
diff --git a/Apps/Core/AppLauncher.cs b/Apps/Core/AppLauncher.cs index c17abf0..9165011 100644 --- a/Apps/Core/AppLauncher.cs +++ b/Apps/Core/AppLauncher.cs @@ -16,7 +16,6 @@ using System; using Tizen.Applications; using Tizen.Applications.Exceptions; -using Tizen; using Apps.Common; namespace Apps.Core { diff --git a/Apps/Models/AppInfoModel.cs b/Apps/Models/AppInfoModel.cs index 27fe832..b39e5bd 100755 --- a/Apps/Models/AppInfoModel.cs +++ b/Apps/Models/AppInfoModel.cs @@ -14,7 +14,6 @@ * limitations under the License */ -using System; using System.Windows.Input; using Tizen.NUI; using Tizen.NUI.Binding; @@ -30,7 +29,6 @@ namespace Apps.Models Name = name; ApplicationId = applicationId; IconUrl = url; - SetBackgroundColor(url); IsSelected = false; AppSelectCommand = new Command(OnAppSelect); } @@ -55,14 +53,6 @@ namespace Apps.Models set => SetProperty(ref isSelected, value); } - private Color iconBackgroundColor; - - public Color IconBackgroundColor - { - get => iconBackgroundColor; - set => SetProperty(ref iconBackgroundColor, value); - } - private ICommand appSelectCommand; public ICommand AppSelectCommand { @@ -75,29 +65,5 @@ namespace Apps.Models AppLauncher.LaunchApplication(ApplicationId); NUIApplication.Current.Exit(); } - - public void SetBackgroundColor(string path) - { - Tizen.Log.Debug(Resources.LogTag, "Path for the color image thumbnail" + path); - PixelBuffer pixelBuffer = ImageLoader.LoadImageFromFile(path); - Palette palette = null; - try - { - palette = Palette.Generate(pixelBuffer); - } - catch (ArgumentNullException e) - { - Tizen.Log.Error(Resources.LogTag, "ArgumentNullException: " + e.Message); - } - if (palette == null || palette.GetDominantSwatch() == null) - { - IconBackgroundColor = Color.Transparent; - } - else - { - IconBackgroundColor = palette.GetDominantSwatch().GetRgb(); - } - pixelBuffer.Dispose(); - } } } diff --git a/Apps/TextResources/Resources.Designer.cs b/Apps/TextResources/Resources.Designer.cs index 010224c..0e5ce52 100644 --- a/Apps/TextResources/Resources.Designer.cs +++ b/Apps/TextResources/Resources.Designer.cs @@ -19,7 +19,7 @@ namespace Apps.TextResources { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { @@ -31,7 +31,6 @@ namespace Apps.TextResources { [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Resources() { } - /// <summary> /// Returns the cached ResourceManager instance used by this class. diff --git a/Apps/ViewManager.cs b/Apps/ViewManager.cs index e7c992b..2d9885d 100755 --- a/Apps/ViewManager.cs +++ b/Apps/ViewManager.cs @@ -18,10 +18,8 @@ using System; using System.Linq; using System.Threading.Tasks; using System.Collections.Generic; -using System.IO; using Tizen.NUI; using Tizen.NUI.Binding; -using Tizen.NUI.Xaml; using Tizen.NUI.Components; using Tizen.Applications; using Apps.Common; @@ -117,8 +115,16 @@ namespace Apps { if (e.State == PackageEventState.Completed) { - Task<IEnumerable<ApplicationInfo>> appListTask= CreateAppList(); - UpdateViewModel(appListTask); + Package package = PackageManager.GetPackage(e.PackageId); + foreach(ApplicationInfo appInfo in package.GetApplications()) + { + if (appInfo.IsNoDisplay == false) + { + appList = appList.Append(appInfo); + appViewModel.InsertApp(appInfo); + } + } + appList = appList.OrderBy(c => c.Label); } } private void OnUninstallProgressChanged(object sender, PackageManagerEventArgs e) @@ -126,8 +132,14 @@ namespace Apps if (e.State == PackageEventState.Completed) { Tizen.Log.Info(Resources.LogTag, "Package id is : " + e.PackageId); + foreach (ApplicationInfo appInfo in appList) + { + if (appInfo.PackageId == e.PackageId) + { + appViewModel.RemoveApp(appInfo.ApplicationId); + } + } appList = appList.Where(c => c.PackageId != e.PackageId); - appViewModel.CreateData(appList); string uninstallSuccessMessage = "App has been uninstalled successfully"; Notification.MakeToast(uninstallSuccessMessage, Notification.ToastBottom).Post(Notification.ToastShort); } diff --git a/Apps/ViewModels/AppInfoViewModel.cs b/Apps/ViewModels/AppInfoViewModel.cs index 4155b2e..6691fd3 100755 --- a/Apps/ViewModels/AppInfoViewModel.cs +++ b/Apps/ViewModels/AppInfoViewModel.cs @@ -16,6 +16,7 @@ using System.Collections.Generic; using System.Collections.ObjectModel; +using System.Collections.Specialized; using Tizen.Applications; using Apps.Common; using Apps.Models; @@ -47,5 +48,18 @@ namespace Apps.ViewModels Tizen.Log.Info(Resources.LogTag, "Application ID is " + appInfo.ApplicationId); } } + + public void InsertItem(int index, ApplicationInfo appInfo) + { + AppInfoModel appInfoModel = new AppInfoModel(appInfo.Label, appInfo.ApplicationId, appInfo.IconPath); + InsertItem(index, appInfoModel); + // Using Reset action because collectionView is not responding correctly to Add action. + OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset)); + } + + public void RemoveItemAt(int index) + { + RemoveItem(index); + } } } diff --git a/Apps/ViewModels/AppViewModel.cs b/Apps/ViewModels/AppViewModel.cs index 5a21abb..f71e685 100755 --- a/Apps/ViewModels/AppViewModel.cs +++ b/Apps/ViewModels/AppViewModel.cs @@ -14,8 +14,8 @@ * limitations under the License */ using System; -using System.Collections; using System.Collections.Generic; +using System.Collections.ObjectModel; using System.Windows.Input; using Tizen.Applications; using Tizen.NUI.Binding; @@ -35,13 +35,7 @@ namespace Apps.ViewModels AppRemoveCommand = new Command(OnAppRemove); } - private IEnumerable appListSource; - - public IEnumerable AppListSource - { - get => appListSource; - set => SetProperty(ref appListSource, value); - } + public ObservableCollection<AppInfoModel> AppListSource { get; set; } private ICommand appRemoveCommand; @@ -80,6 +74,33 @@ namespace Apps.ViewModels ((AppInfoViewModel)AppListSource).CreateData(list); } + public void InsertApp(ApplicationInfo appInfo) + { + int index = 0; + while (string.Compare(appInfo.Label,AppListSource[index]?.Name) > 0) + { + index++; + } + ((AppInfoViewModel)AppListSource)?.InsertItem(index, appInfo); + } + + public void RemoveApp(string appId) + { + int index = 0; + for (; index < AppListSource?.Count; index++) + { + if(AppListSource[index]?.ApplicationId == appId) + { + break; + } + } + if (index == AppListSource?.Count) + { + return; + } + ((AppInfoViewModel)AppListSource)?.RemoveItemAt(index); + } + private void OnAppRemove(object selectedItem) { AppInfoModel appInfo = (AppInfoModel)selectedItem; diff --git a/Apps/Views/AppItemLayout.cs b/Apps/Views/AppItemLayout.cs index c5ff551..acb8fe6 100644 --- a/Apps/Views/AppItemLayout.cs +++ b/Apps/Views/AppItemLayout.cs @@ -99,7 +99,6 @@ namespace Apps.Views FontFamily = "BreezeSans", ThemeChangeSensitive = true, PixelSize = AppConstants.AppNamesPixelSize.SpToPx(), - WidthSpecification = LayoutParamPolicies.MatchParent, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, }; diff --git a/Apps/Views/AppView.cs b/Apps/Views/AppView.cs index ff2057c..d915bb3 100755 --- a/Apps/Views/AppView.cs +++ b/Apps/Views/AppView.cs @@ -106,7 +106,6 @@ namespace Apps.Views AppItemLayout item = new AppItemLayout(removeMode); item.Label.SetBinding(TextLabel.TextProperty, "Name"); item.Icon.SetBinding(ImageView.ResourceUrlProperty, "IconUrl"); - item.IconBackground.SetBinding(BackgroundColorProperty, "IconBackgroundColor"); item.SetBinding(AppItemLayout.AppSelectCommandProperty, "AppSelectCommand"); item.LongPressed += OnLongPressed; if (removeMode && item.CrossButton != null) diff --git a/Apps/Views/SelectAppItemLayout.cs b/Apps/Views/SelectAppItemLayout.cs index 7674e0e..33c7f81 100644 --- a/Apps/Views/SelectAppItemLayout.cs +++ b/Apps/Views/SelectAppItemLayout.cs @@ -60,7 +60,6 @@ namespace Apps.Views FontFamily = "BreezeSans", ThemeChangeSensitive = true, PixelSize = AppConstants.AppNamesPixelSize.SpToPx(), - WidthSpecification = LayoutParamPolicies.MatchParent, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, }; diff --git a/Apps/Views/SelectAppsView.cs b/Apps/Views/SelectAppsView.cs index d158c1c..f31357e 100644 --- a/Apps/Views/SelectAppsView.cs +++ b/Apps/Views/SelectAppsView.cs @@ -35,7 +35,6 @@ namespace Apps.Views SelectAppItemLayout item = new SelectAppItemLayout(); item.Label.SetBinding(TextLabel.TextProperty, "Name"); item.Icon.SetBinding(ImageView.ResourceUrlProperty, "IconUrl"); - item.IconBackground.SetBinding(BackgroundColorProperty, "IconBackgroundColor"); item.SelectButton.SetBinding(Button.IsSelectedProperty, "IsSelected"); return item; }); diff --git a/packaging/org.tizen.Apps-1.0.0.tpk b/packaging/org.tizen.Apps-1.0.0.tpk Binary files differindex 70d2a51..51baa82 100755 --- a/packaging/org.tizen.Apps-1.0.0.tpk +++ b/packaging/org.tizen.Apps-1.0.0.tpk |