From: Shivam Varshney/Core S/W Group /SRI-Delhi/Engineer/Samsung Electronics Date: Thu, 4 May 2023 11:17:34 +0000 (+0530) Subject: [TSEVENDF-4671] Updating new app ids, app background X-Git-Tag: accepted/tizen/unified/20230528.171033^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9bb8fe127f49a7b9fee4c2da9fcecdbeefde71ca;p=profile%2Fiot%2Fapps%2Fdotnet%2Ftray.git [TSEVENDF-4671] Updating new app ids, app background Change-Id: I0f63724ce42ba65313cc45aa7bd5857137fe4ef2 Signed-off-by: Shivam Varshney/Core S/W Group /SRI-Delhi/Engineer/Samsung Electronics --- diff --git a/Apps/Apps.cs b/Apps/Apps.cs index 848a16e..7a0f338 100755 --- a/Apps/Apps.cs +++ b/Apps/Apps.cs @@ -92,7 +92,7 @@ namespace Apps ApplicationId = "org.tizen.Apps", Operation = AppControlOperations.Send }; - appControl?.ExtraData.Add("SelectedApps", selectedApps); + appControl.ExtraData?.Add("SelectedApps", selectedApps); e.ReceivedAppControl.ReplyToLaunchRequest(appControl, AppControlReplyResult.Succeeded); Exit(); } diff --git a/TrayApplication/Models/AppInfoModel.cs b/TrayApplication/Models/AppInfoModel.cs index a908212..1a4bd6f 100755 --- a/TrayApplication/Models/AppInfoModel.cs +++ b/TrayApplication/Models/AppInfoModel.cs @@ -26,9 +26,6 @@ namespace TrayApplication.Models { class AppInfoModel : PropertyNotifier { - private ImageVisual defaultVisual; - private GradientVisual gradientVisual; - public AppInfoModel(string name, string applicationId, string url) { Name = name; @@ -59,11 +56,11 @@ namespace TrayApplication.Models set => SetProperty(ref iconUrl, value); } - private PropertyMap iconBackground; - public PropertyMap IconBackground + private Color iconBackgroundColor; + public Color IconBackgroundColor { - get => iconBackground; - set => SetProperty(ref iconBackground, value); + get => iconBackgroundColor; + set => SetProperty(ref iconBackgroundColor, value); } private ICommand appSelectCommand; @@ -85,79 +82,7 @@ namespace TrayApplication.Models } } - private void SetDefaultImageVisual() - { - defaultVisual = new ImageVisual() - { - URL = Resources.GetImagePath() + "default_gradient.png", - CornerRadius = new Vector4(12, 12, 12, 12), - }; - } - - private void SetGradientVisual(PropertyArray stopColor) - { - gradientVisual = new GradientVisual() - { - StartPosition = new Vector2(0.0f, -1.0f), - EndPosition = new Vector2(0.0f, 1.0f), - StopColor = stopColor, - SpreadMethod = GradientVisualSpreadMethodType.Pad, - CornerRadius = new Vector4(12, 12, 12, 12), - }; - } - - private PropertyArray GetGradientStopColors(Palette palette) - { - PropertyArray propertyArray = new PropertyArray(); - if (palette == null) - { - Tizen.Log.Error(Resources.LogTag, "Color palette from background is null"); - return propertyArray; - } - - Palette.Swatch lightMutedSwatch = palette.GetLightMutedSwatch(); - Palette.Swatch darkMutedSwatch = palette.GetDarkMutedSwatch(); - if (lightMutedSwatch != null && darkMutedSwatch != null) - { - propertyArray.PushBack(new PropertyValue(lightMutedSwatch.GetRgb())); - propertyArray.PushBack(new PropertyValue(darkMutedSwatch.GetRgb())); - return propertyArray; - } - - Palette.Swatch lightVibrantSwatch = palette.GetLightVibrantSwatch(); - Palette.Swatch darkVibrantSwatch = palette.GetDarkVibrantSwatch(); - if (lightVibrantSwatch != null && darkVibrantSwatch != null) - { - propertyArray.PushBack(new PropertyValue(lightVibrantSwatch.GetRgb())); - propertyArray.PushBack(new PropertyValue(darkVibrantSwatch.GetRgb())); - return propertyArray; - } - - Palette.Swatch mutedSwatch = palette.GetMutedSwatch(); - Palette.Swatch vibrantSwatch = palette.GetVibrantSwatch(); - if (mutedSwatch != null && vibrantSwatch != null) - { - propertyArray.PushBack(new PropertyValue(mutedSwatch.GetRgb())); - propertyArray.PushBack(new PropertyValue(vibrantSwatch.GetRgb())); - return propertyArray; - } - - IReadOnlyCollection swatches = palette.GetSwatches(); - foreach (Palette.Swatch swatch in swatches) - { - if (propertyArray.Count() >= 2) - { - return propertyArray; - } - if (swatch != null) - { - propertyArray.PushBack(new PropertyValue(swatch.GetRgb())); - } - } - return propertyArray; - } - - public void SetExtractedBackground(string path) + public void SetBackgroundColor(string path) { Tizen.Log.Debug(Resources.LogTag, "Path for the color image thumbnail" + path); PixelBuffer pixelBuffer = ImageLoader.LoadImageFromFile(path); @@ -166,34 +91,27 @@ namespace TrayApplication.Models { palette = Palette.Generate(pixelBuffer); } - catch( ArgumentNullException e) + catch (ArgumentNullException e) { Tizen.Log.Error(Resources.LogTag, "ArgumentNullException: " + e.Message); } - PropertyArray stopColor = GetGradientStopColors(palette); - if (stopColor.Count() < 2) + if (palette == null || palette.GetDominantSwatch() == null) { - Tizen.Log.Info(Resources.LogTag, "Palette or palatte values not valid, adding default gradient"); - SetDefaultImageVisual(); - IconBackground = defaultVisual.OutputVisualMap; + IconBackgroundColor = Color.Transparent; } else { - Tizen.Log.Info(Resources.LogTag, "setting palette color"); - SetGradientVisual(stopColor); - IconBackground = gradientVisual.OutputVisualMap; + IconBackgroundColor = palette.GetDominantSwatch().GetRgb(); } + pixelBuffer.Dispose(); } ~AppInfoModel() { - Tizen.Log.Info(Resources.LogTag, "Clearing NUI PropertyMap resources"); - defaultVisual?.Dispose(); - defaultVisual = null; - gradientVisual?.Dispose(); - gradientVisual = null; - IconBackground?.Dispose(); - IconBackground = null; + if (Name == "back") + { + InputGeneratorBase.FinalizeInputGenerator(); + } } } } diff --git a/TrayApplication/ViewModels/ApplicationViewModel.cs b/TrayApplication/ViewModels/ApplicationViewModel.cs index 6b0caff..78e96e2 100755 --- a/TrayApplication/ViewModels/ApplicationViewModel.cs +++ b/TrayApplication/ViewModels/ApplicationViewModel.cs @@ -65,7 +65,7 @@ namespace TrayApplication.ViewModels private void AddAppsApplication() { AppInfoModel appsApp = new AppInfoModel("Apps", AppsId, Resources.GetCurrentThemePath() + "apps.png"); - appsApp.SetExtractedBackground(string.Empty); + appsApp.SetBackgroundColor(string.Empty); appInfoModelDictionary.Add(AppsId, appsApp); } @@ -73,7 +73,7 @@ namespace TrayApplication.ViewModels { ApplicationInfo appInfo = new ApplicationInfo(appId); AppInfoModel appInfoModel = new AppInfoModel(appInfo.Label, appId, appInfo.IconPath); - appInfoModel.SetExtractedBackground(appInfoModel.IconUrl); + appInfoModel.SetBackgroundColor(appInfoModel.IconUrl); appInfoModelDictionary.Add(appId, appInfoModel); appInfo.Dispose(); } diff --git a/TrayApplication/ViewModels/QuickAccessViewModel.cs b/TrayApplication/ViewModels/QuickAccessViewModel.cs index 4039d0d..afc0d6f 100755 --- a/TrayApplication/ViewModels/QuickAccessViewModel.cs +++ b/TrayApplication/ViewModels/QuickAccessViewModel.cs @@ -48,9 +48,9 @@ namespace TrayApplication.ViewModels ((List)ButtonsInfo).Clear(); List buttons = new List { - new AppInfoModel(AppNames[0], "org.tizen.homescreen-efl", imagePath + AppNames[0] + ".png"), + new AppInfoModel(AppNames[0], "org.tizen.homescreen-nui", imagePath + AppNames[0] + ".png"), new AppInfoModel(AppNames[1], "org.tizen.SettingView", imagePath + AppNames[1] + ".png"), - new AppInfoModel(AppNames[2], "org.tizen.volume", imagePath + AppNames[2] + ".png"), + new AppInfoModel(AppNames[2], "org.tizen.volume-nui", imagePath + AppNames[2] + ".png"), new AppInfoModel(AppNames[3], string.Empty, imagePath + AppNames[3] + ".png"), //new AppInfoModel(AppNames[3], "org.tizen.quickpanel", imagePath + AppNames[3] + ".png"), //Will be added Later //new AppInfoModel(AppNames[5], "org.tizen.powerkey-syspopup", imagePath + AppNames[5] + ".png") //Will be added Later diff --git a/TrayApplication/Views/ApplicationsView.cs b/TrayApplication/Views/ApplicationsView.cs index e0fc012..2a55cae 100755 --- a/TrayApplication/Views/ApplicationsView.cs +++ b/TrayApplication/Views/ApplicationsView.cs @@ -156,7 +156,7 @@ namespace TrayApplication.Views itemView.Icon.SetBinding(ImageView.ResourceUrlProperty, "IconUrl"); itemView.Label.SetBinding(TextLabel.TextProperty, "Name"); itemView.SetBinding(AppItemView.AppSelectCommandProperty, "AppSelectCommand"); - itemView.IconBackground.SetBinding(BackgroundProperty, "IconBackground"); + itemView.IconBackground.SetBinding(BackgroundColorProperty, "IconBackgroundColor"); } currentAppsCount = totalCount; if (removeMode == true) diff --git a/packaging/org.tizen.Apps-1.0.0.tpk b/packaging/org.tizen.Apps-1.0.0.tpk index d279654..0a8b9c4 100755 Binary files a/packaging/org.tizen.Apps-1.0.0.tpk and b/packaging/org.tizen.Apps-1.0.0.tpk differ diff --git a/packaging/org.tizen.TrayApplication-1.0.0.tpk b/packaging/org.tizen.TrayApplication-1.0.0.tpk index 02152a7..c61298c 100755 Binary files a/packaging/org.tizen.TrayApplication-1.0.0.tpk and b/packaging/org.tizen.TrayApplication-1.0.0.tpk differ