From: Md. Shahrukh Islam Date: Wed, 23 Apr 2025 06:10:27 +0000 (+0600) Subject: Implement new SetBinding in Notifications with XAML off to improve launch time and... X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c605cb4b97c702e97d2b64a3cf0a0b940fe97f14;p=profile%2Fiot%2Fapps%2Fdotnet%2Fnotifications.git Implement new SetBinding in Notifications with XAML off to improve launch time and memory management. [Cause & Measure] 1. Implemented SetBinding with creating new BindingSession 2. Set IsUsingXaml variable to false. 3. Launch time improved by on avg 30 ms 4. SptoPx is obsolete. 5. Window.Instance is now obsolete. So used GetDefaultWindow(). 6. Optimized division operation with bitwise operation. 7. Removed unnecessary and redundant code Change-Id: Ifedaecf60c5fb52a82986729e6e6a0c395a3fd40 Signed-off-by: Md. Shahrukh Islam --- diff --git a/Notifications/Common/AppConstants.cs b/Notifications/Common/AppConstants.cs index c9bdc2b..0ecb86b 100644 --- a/Notifications/Common/AppConstants.cs +++ b/Notifications/Common/AppConstants.cs @@ -44,5 +44,8 @@ namespace Notifications.Common public static float windowHeightRatio = 540f / 1080; public static float windowWidthRatio = 960f / 1920; + + public static readonly float MinWidthRatio = 704.0f / 1920; + public static readonly float MinHeightRatio = 436.0f / 1080; } } diff --git a/Notifications/Common/DeviceInfo.cs b/Notifications/Common/DeviceInfo.cs index d66c401..162e9d4 100644 --- a/Notifications/Common/DeviceInfo.cs +++ b/Notifications/Common/DeviceInfo.cs @@ -30,13 +30,13 @@ namespace Notifications.Common width = (int)displaySize.Width; height = (int)displaySize.Height; - orientation = Window.Instance.GetCurrentOrientation(); + orientation = NUIApplication.GetDefaultWindow().GetCurrentOrientation(); IsPortrait = orientation == Window.WindowOrientation.Portrait || orientation == Window.WindowOrientation.PortraitInverse; } public static void UpdateDeviceInfo() { - Window.WindowOrientation currentOrientation = Window.Instance.GetCurrentOrientation(); + Window.WindowOrientation currentOrientation = NUIApplication.GetDefaultWindow().GetCurrentOrientation(); if (orientation == Window.WindowOrientation.Portrait || orientation == Window.WindowOrientation.PortraitInverse) { if (currentOrientation == Window.WindowOrientation.Landscape || currentOrientation == Window.WindowOrientation.LandscapeInverse) diff --git a/Notifications/CustomBorder.cs b/Notifications/CustomBorder.cs index ef8ec6d..260a0ae 100644 --- a/Notifications/CustomBorder.cs +++ b/Notifications/CustomBorder.cs @@ -42,19 +42,15 @@ namespace Notifications public CustomBorder(Size2D screenSize) { ResizePolicy = Window.BorderResizePolicyType.Free; - float minWidthRatio = 704.0f / 1920; - float minHeightRatio = 436.0f / 1080; - int minWidth = (int)(screenSize.Width * minWidthRatio); - int minHeight = (int)(screenSize.Height * minHeightRatio); + int minWidth = (int)(screenSize.Width * AppConstants.MinWidthRatio); + int minHeight = (int)(screenSize.Height * AppConstants.MinHeightRatio); MinSize = new Size2D(minWidth, minHeight); } public void UpdateMinSize(Size2D screenSize) { - float minWidthRatio = 704.0f / 1920; - float minHeightRatio = 436.0f / 1080; - int minWidth = (int)(screenSize.Width * minWidthRatio); - int minHeight = (int)(screenSize.Height * minHeightRatio); + int minWidth = (int)(screenSize.Width * AppConstants.MinWidthRatio); + int minHeight = (int)(screenSize.Height * AppConstants.MinHeightRatio); MinSize = new Size2D(minWidth, minHeight); } @@ -90,37 +86,37 @@ namespace Notifications { return false; } - BorderLineThickness = (uint)BorderThickness.SpToPx(); - bottomView.HeightSpecification = BottomViewHeight.SpToPx(); + BorderLineThickness = (uint)BorderThickness; + bottomView.HeightSpecification = BottomViewHeight; bottomView.Layout = new RelativeLayout() { - Padding = new Extents(0, 24, 0, 0).SpToPx(), + Padding = new Extents(0, 24, 0, 0), }; minimalizeIcon = new ImageView() { - Size2D = IconSize.SpToPx(), + Size2D = IconSize, ResourceUrl = Resources.GetImagePath() + "/minimalize.png", AccessibilityHighlightable = true, }; maximalizeIcon = new ImageView() { - Size2D = IconSize.SpToPx(), + Size2D = IconSize, ResourceUrl = Resources.GetImagePath() + "/maximalize.png", AccessibilityHighlightable = true, }; closeIcon = new ImageView() { - Size2D = IconSize.SpToPx(), + Size2D = IconSize, ResourceUrl = Resources.GetImagePath() + "/close.png", AccessibilityHighlightable = true, }; leftCornerIcon = new ImageView() { - Size2D = IconSize.SpToPx(), + Size2D = IconSize, ResourceUrl = Resources.GetImagePath() + "/leftCorner.png", AccessibilityHighlightable = true, }; @@ -180,10 +176,10 @@ namespace Notifications { e.Name = "Resize"; }; - minimalizeIcon.SetAccessibilityReadingInfoTypes(Tizen.NUI.BaseComponents.AccessibilityReadingInfoTypes.Name); - maximalizeIcon.SetAccessibilityReadingInfoTypes(Tizen.NUI.BaseComponents.AccessibilityReadingInfoTypes.Name); - closeIcon.SetAccessibilityReadingInfoTypes(Tizen.NUI.BaseComponents.AccessibilityReadingInfoTypes.Name); - leftCornerIcon.SetAccessibilityReadingInfoTypes(Tizen.NUI.BaseComponents.AccessibilityReadingInfoTypes.Name); + minimalizeIcon.SetAccessibilityReadingInfoTypes(AccessibilityReadingInfoTypes.Name); + maximalizeIcon.SetAccessibilityReadingInfoTypes(AccessibilityReadingInfoTypes.Name); + closeIcon.SetAccessibilityReadingInfoTypes(AccessibilityReadingInfoTypes.Name); + leftCornerIcon.SetAccessibilityReadingInfoTypes(AccessibilityReadingInfoTypes.Name); return true; } @@ -224,7 +220,7 @@ namespace Notifications return; } borderView.CornerRadiusPolicy = VisualTransformPolicyType.Absolute; - borderView.CornerRadius = BorderCornerRadius.SpToPx(); + borderView.CornerRadius = BorderCornerRadius; if (maximalizeIcon == null) { diff --git a/Notifications/Directory.Build.targets b/Notifications/Directory.Build.targets index a468954..e418e4c 100644 --- a/Notifications/Directory.Build.targets +++ b/Notifications/Directory.Build.targets @@ -16,6 +16,6 @@ WARNING: DO NOT MODIFY this file. Incorrect changes to this file will make it - + diff --git a/Notifications/Notifications.cs b/Notifications/Notifications.cs index c4dd842..ad0cd69 100644 --- a/Notifications/Notifications.cs +++ b/Notifications/Notifications.cs @@ -33,6 +33,12 @@ namespace Notifications { } + protected override void OnPreCreate() + { + IsUsingXaml = false; + base.OnPreCreate(); + } + protected override void OnCreate() { base.OnCreate(); @@ -44,7 +50,7 @@ namespace Notifications Tizen.Log.Info(AppConstants.LogTag, "Program OnCreate"); SetupLanguage(); - window = Window.Instance; + window = GetDefaultWindow(); window.SetTransparency(true); List list = new List { diff --git a/Notifications/Notifications.csproj b/Notifications/Notifications.csproj index a12d136..ce0e6c4 100644 --- a/Notifications/Notifications.csproj +++ b/Notifications/Notifications.csproj @@ -13,7 +13,7 @@ - + diff --git a/Notifications/ViewManager.cs b/Notifications/ViewManager.cs index 4072494..1a97ab2 100644 --- a/Notifications/ViewManager.cs +++ b/Notifications/ViewManager.cs @@ -15,7 +15,6 @@ */ using System; -using System.Timers; using Tizen.Applications.NotificationEventListener; using Tizen.NUI; using Notifications.Common; @@ -39,12 +38,12 @@ namespace Notifications baseView.BindingContext = notificationsViewModel; baseView.BackKeyPressed += OnBackKeyPressed; - Window.Instance.Add(baseView); + NUIApplication.GetDefaultWindow().Add(baseView); timer = new System.Timers.Timer(500); timer.Elapsed += (s, e) => { - Window.Instance.Resized += OnWindowResized; + NUIApplication.GetDefaultWindow().Resized += OnWindowResized; timer.Stop(); }; timer.Start(); diff --git a/Notifications/ViewModels/NotificationsDetailViewModel.cs b/Notifications/ViewModels/NotificationsDetailViewModel.cs index 7ce881e..a4685c3 100644 --- a/Notifications/ViewModels/NotificationsDetailViewModel.cs +++ b/Notifications/ViewModels/NotificationsDetailViewModel.cs @@ -48,8 +48,11 @@ namespace Notifications.ViewModels get => detailContent; set { - detailContent = value; - OnPropertyChanged("DetailContent"); + if (detailContent != value) + { + detailContent = value; + OnPropertyChanged("DetailContent"); + } } } @@ -59,8 +62,11 @@ namespace Notifications.ViewModels get => backCommand; set { - backCommand = value; - OnPropertyChanged("BackCommand"); + if (backCommand != value) + { + backCommand = value; + OnPropertyChanged("BackCommand"); + } } } @@ -75,20 +81,24 @@ namespace Notifications.ViewModels get => appLaunchCommand; set { - appLaunchCommand = value; - OnPropertyChanged("AppLaunchCommand"); + if (appLaunchCommand != value) + { + appLaunchCommand = value; + OnPropertyChanged("AppLaunchCommand"); + } } } private void OnAppLaunched() { - AppControl appControl = new AppControl() - { - ApplicationId = AppId, - Operation = AppControlOperations.Default, - }; try { + AppControl appControl = new AppControl() + { + ApplicationId = AppId, + Operation = AppControlOperations.Default, + }; + AppControl.SendLaunchRequest(appControl); } catch (Exception ex) diff --git a/Notifications/ViewModels/NotificationsViewModel.cs b/Notifications/ViewModels/NotificationsViewModel.cs index 5ce982a..05620df 100644 --- a/Notifications/ViewModels/NotificationsViewModel.cs +++ b/Notifications/ViewModels/NotificationsViewModel.cs @@ -51,8 +51,11 @@ namespace Notifications.ViewModels get => isNotificationsPresent; set { - isNotificationsPresent = value; - OnPropertyChanged("IsNotificationsPresent"); + if (isNotificationsPresent != value) + { + isNotificationsPresent = value; + OnPropertyChanged("IsNotificationsPresent"); + } } } diff --git a/Notifications/Views/BaseView.cs b/Notifications/Views/BaseView.cs index 4b18949..930294e 100644 --- a/Notifications/Views/BaseView.cs +++ b/Notifications/Views/BaseView.cs @@ -19,9 +19,65 @@ using Tizen.NUI.BaseComponents; using Tizen.NUI.Binding; using Tizen.NUI.Components; using Notifications.Common; +using Notifications.ViewModels; +using System.Windows.Input; +using System.Collections; +using Notifications.Models; namespace Notifications.Views { + static class ViewBindings + { + public static BindingProperty IsContentAvailableProperty { get; } = new BindingProperty + { + Setter = (v, value) => v.IsContentAvailable = value, + }; + + public static BindingProperty CommandProperty { get; } = new BindingProperty + { + Setter = (v, value) => ((Control)v).Command = value, + }; + } + + static class RecyclerViewBindings + { + public static BindingProperty ItemsSourceProperty { get; } = new BindingProperty + { + Setter = (v, value) => v.ItemsSource = value, + }; + } + + static class CollectionViewBindings + { + public static BindingProperty SelectionChangedCommandProperty { get; } = new BindingProperty + { + Setter = (v, value) => v.SelectionChangedCommand = value, + }; + } + + static class ButtonBindings + { + public static BindingProperty IsSelectedProperty { get; } = new BindingProperty + { + Setter = (v, value) => v.IsSelected = value, + }; + + public static BindingProperty TextProperty { get; } = new BindingProperty + { + Setter = (v, value) => v.Text = value, + }; + + public static BindingProperty CommandProperty { get; } = new BindingProperty + { + Setter = (v, value) => v.Command = value, + }; + + public static BindingProperty IsEnabledProperty { get; } = new BindingProperty + { + Setter = (v, value) => v.IsEnabled = value, + }; + } + class BaseView : View { public static BindableProperty IsContentAvailableProperty = BindableProperty.Create(nameof(IsContentAvailable), typeof(bool), typeof(BaseView), false, propertyChanged: (bindable, oldValue, newValue) => @@ -49,8 +105,8 @@ namespace Notifications.Views public BaseView() : base() { ThemeChangeSensitive = true; - Size2D = Window.Instance.Size; - CornerRadius = (AppConstants.BorderCornerRadius - AppConstants.BorderWindowPadding).SpToPx(); + Size2D = NUIApplication.GetDefaultWindow().Size; + CornerRadius = (AppConstants.BorderCornerRadius - AppConstants.BorderWindowPadding); Layout = new LinearLayout() { LinearOrientation = LinearLayout.Orientation.Vertical, @@ -61,7 +117,17 @@ namespace Notifications.Views AddTopView(); UpdateContent(); - this.SetBinding(IsContentAvailableProperty, "IsNotificationsPresent"); + + var session = new BindingSession (); + + this.BindingContextChanged += (sender, e) => + { + if (this.BindingContext is NotificationsViewModel model) + { + session.ViewModel = model; + } + }; + this.SetBinding(session, ViewBindings.IsContentAvailableProperty, "IsNotificationsPresent"); } public void UpdateContent() @@ -82,38 +148,47 @@ namespace Notifications.Views public void AddDetailContentView() { - RemoveContent(); if (detailContentView == null) { - ButtonStyle buttonStyle = new ButtonStyle() + var text = new TextLabel() { BackgroundColor = Color.Transparent, - Text = new TextLabelStyle() - { - BackgroundColor = Color.Transparent, - MultiLine = true, - FontFamily = "BreezeSans", - HorizontalAlignment = HorizontalAlignment.Begin, - }, - Margin = AppConstants.DetailContentMargin.SpToPx(), - IsEnabled = true, - IsSelectable = false, + MultiLine = true, + FontFamily = "BreezeSans", + HorizontalAlignment = HorizontalAlignment.Begin, }; - detailContentView = new Button(buttonStyle) + detailContentView = new Button() { + BackgroundColor = Color.Transparent, + + Margin = AppConstants.DetailContentMargin, + IsEnabled = true, + IsSelectable = false, WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.WrapContent, }; - detailContentView.SetBinding(Button.TextProperty, "DetailContent"); - detailContentView.SetBinding(Control.CommandProperty, "AppLaunchCommand"); + detailContentView.Add(text); + + var session = new BindingSession(); + + detailContentView.BindingContextChanged += (sender, e) => + { + if (detailContentView.BindingContext is NotificationsDetailViewModel viewModel) + { + session.ViewModel = viewModel; + } + }; + + detailContentView.SetBinding(session, ButtonBindings.TextProperty, "DetailContent"); + detailContentView.SetBinding(session, ButtonBindings.CommandProperty, "AppLaunchCommand"); } Add(detailContentView); } public void UpdateSize() { - Size2D = Window.Instance.Size; + Size2D = NUIApplication.GetDefaultWindow().Size; UpdateNotificationsViewItemTemplate(); } @@ -157,10 +232,10 @@ namespace Notifications.Views { ThemeChangeSensitive = true, WidthSpecification = LayoutParamPolicies.MatchParent, - HeightSpecification = AppConstants.HeaderHeight.SpToPx(), + HeightSpecification = AppConstants.HeaderHeight, Layout = new RelativeLayout() { - Padding = AppConstants.HeaderPadding.SpToPx(), + Padding = AppConstants.HeaderPadding, }, }; Add(topView); @@ -169,22 +244,36 @@ namespace Notifications.Views private void AddTopViewElements() { - ButtonStyle buttonStyle = new ButtonStyle() + var buttonSize = AppConstants.BackButtonSize; + + ImageView icon = new ImageView { BackgroundColor = Color.Transparent, - Size = AppConstants.BackButtonSize.SpToPx(), - Icon = new ImageViewStyle() - { - BackgroundColor = Color.Transparent, - Size = AppConstants.BackButtonSize.SpToPx(), - }, + Size = buttonSize, + }; + + backButton = new Button() + { + BackgroundColor = Color.Transparent, + Size = buttonSize, + IsEnabled = true, IsSelectable = false, }; - backButton = new Button(buttonStyle); + backButton.Add(icon); + RelativeLayout.SetVerticalAlignment(backButton, RelativeLayout.Alignment.Center); RelativeLayout.SetHorizontalAlignment(backButton, RelativeLayout.Alignment.Start); - backButton.SetBinding(Control.CommandProperty, "BackCommand"); + + var session = new BindingSession(); + backButton.BindingContextChanged += (sender, e) => + { + if (backButton.BindingContext is NotificationsDetailViewModel model) + { + session.ViewModel = model; + } + }; + backButton.SetBinding(session, ButtonBindings.CommandProperty, "BackCommand"); topView.Add(backButton); titleText = new TextLabel() @@ -193,7 +282,7 @@ namespace Notifications.Views TranslatableText = "IDS_ST_HEADER_NOTIFICATIONS", HeightSpecification = LayoutParamPolicies.MatchParent, VerticalAlignment = VerticalAlignment.Center, - PixelSize = AppConstants.TextPixelSize.SpToPx(), + PixelSize = AppConstants.TextPixelSize, FontFamily = "BreezeSans", }; RelativeLayout.SetLeftTarget(titleText, backButton); @@ -221,8 +310,19 @@ namespace Notifications.Views SelectionMode = ItemSelectionMode.Single, }; UpdateNotificationsViewItemTemplate(); - notificationsView.SetBinding(RecyclerView.ItemsSourceProperty, "NotificationsListSource"); - notificationsView.SetBinding(CollectionView.SelectionChangedCommandProperty, "SelectionChangedCommand"); + + var session = new BindingSession(); + + notificationsView.BindingContextChanged += (sender, e) => + { + if (notificationsView.BindingContext is NotificationsViewModel model) + { + session.ViewModel = model; + } + }; + + notificationsView.SetBinding(session, RecyclerViewBindings.ItemsSourceProperty, "NotificationsListSource"); + notificationsView.SetBinding(session, CollectionViewBindings.SelectionChangedCommandProperty, "SelectionChangedCommand"); } notificationsView.SelectedItem = null; Add(notificationsView); @@ -234,13 +334,24 @@ namespace Notifications.Views { return; } - notificationsView.SizeWidth = Window.Instance.Size.Width; + notificationsView.SizeWidth = NUIApplication.GetDefaultWindow().Size.Width; notificationsView.ItemTemplate = new DataTemplate(() => { ItemLayout item = new ItemLayout(); - item.Label.SetBinding(TextLabel.TextProperty, "Title"); - item.SubLabel.SetBinding(TextLabel.TextProperty, "SubTitle"); - item.Extra.SetBinding(Control.CommandProperty, "ClearNotificationCommand"); + + var session = new BindingSession(); + + item.BindingContextChanged += (sender, e) => + { + if (item.BindingContext is NotificationsModel model) + { + session.ViewModel = model; + } + }; + + item.Label.SetBinding(session, TextLabelBindings.TextProperty, "Title"); + item.SubLabel.SetBinding(session, TextLabelBindings.TextProperty, "SubTitle"); + item.Extra.SetBinding(session, ViewBindings.CommandProperty, "ClearNotificationCommand"); return item; }); } @@ -249,24 +360,34 @@ namespace Notifications.Views { if (clearAllButton == null) { - ButtonStyle buttonStyle = new ButtonStyle() + var textLabel = new TextLabel() { - Size = AppConstants.ClearAllButtonSize.SpToPx(), BackgroundColor = Color.Transparent, - Text = new TextLabelStyle() - { - BackgroundColor = Color.Transparent, - TranslatableText = "IDS_ST_BUTTON_CLEAR_ALL", - FontFamily = "BreezeSans", - VerticalAlignment = VerticalAlignment.Center, - HorizontalAlignment = HorizontalAlignment.Center, - }, + TranslatableText = "IDS_ST_BUTTON_CLEAR_ALL", + FontFamily = "BreezeSans", + VerticalAlignment = VerticalAlignment.Center, + HorizontalAlignment = HorizontalAlignment.Center, + }; + + clearAllButton = new Button() + { + Size = AppConstants.ClearAllButtonSize, + BackgroundColor = Color.Transparent, }; - clearAllButton = new Button(buttonStyle); + clearAllButton.Add(textLabel); RelativeLayout.SetVerticalAlignment(clearAllButton, RelativeLayout.Alignment.Center); RelativeLayout.SetHorizontalAlignment(clearAllButton, RelativeLayout.Alignment.End); - clearAllButton.SetBinding(Control.CommandProperty, "ClearAllNotificationsCommand"); + + var session = new BindingSession(); + clearAllButton.BindingContextChanged += (sender, e) => + { + if (clearAllButton.BindingContext is NotificationsViewModel model) + { + session.ViewModel = model; + } + }; + clearAllButton.SetBinding(session, ButtonBindings.CommandProperty, "ClearAllNotificationsCommand"); } topView?.Add(clearAllButton); } @@ -283,7 +404,7 @@ namespace Notifications.Views HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, FontFamily = "BreezeSans", - PixelSize = AppConstants.TextPixelSize.SpToPx(), + PixelSize = AppConstants.TextPixelSize, }; } Add(noNotificationsText); @@ -333,6 +454,7 @@ namespace Notifications.Views topView?.Dispose(); topView = null; } + Tizen.Log.Info(AppConstants.LogTag, "Dispose BaseView"); base.Dispose(type); } diff --git a/Notifications/Views/ItemLayout.cs b/Notifications/Views/ItemLayout.cs index 392e04b..c665b25 100644 --- a/Notifications/Views/ItemLayout.cs +++ b/Notifications/Views/ItemLayout.cs @@ -10,31 +10,35 @@ namespace Notifications.Views public ItemLayout() : base() { WidthSpecification = LayoutParamPolicies.MatchParent; - HeightSpecification = AppConstants.NotificationItemHeight.SpToPx(); + HeightSpecification = AppConstants.NotificationItemHeight; + + var textSizePx = AppConstants.TextPixelSize; Label.HorizontalAlignment = HorizontalAlignment.Begin; Label.VerticalAlignment = VerticalAlignment.Bottom; Label.FontFamily = "BreezeSans"; - Label.PixelSize = AppConstants.TextPixelSize.SpToPx(); + Label.PixelSize = textSizePx; SubLabel.HorizontalAlignment = HorizontalAlignment.Begin; SubLabel.VerticalAlignment = VerticalAlignment.Top; SubLabel.FontFamily = "BreezeSans"; - SubLabel.PixelSize = AppConstants.TextPixelSize.SpToPx(); + SubLabel.PixelSize = textSizePx; + + var clearBinSizePx = AppConstants.ClearBinSize; - ButtonStyle buttonStyle = new ButtonStyle() + var icon = new ImageView() + { + BackgroundColor = Color.Transparent, + Size = clearBinSizePx, + }; + Extra = new Button() { - Size = AppConstants.ClearBinSize.SpToPx(), + Size = clearBinSizePx, BackgroundColor = Color.Transparent, - Icon = new ImageViewStyle() - { - BackgroundColor = Color.Transparent, - Size = AppConstants.ClearBinSize.SpToPx(), - }, IsEnabled = true, IsSelectable = false, }; - Extra = new Button(buttonStyle); + Extra.Add(icon); UpdateTheme(); ThemeManager.ThemeChanged += OnItemThemeChanged; @@ -66,4 +70,4 @@ namespace Notifications.Views base.Dispose(type); } } -} +} \ No newline at end of file diff --git a/Notifications/core/WindowManager.cs b/Notifications/core/WindowManager.cs index e082828..6f736e4 100644 --- a/Notifications/core/WindowManager.cs +++ b/Notifications/core/WindowManager.cs @@ -25,7 +25,7 @@ namespace Notifications.Core static WindowManager() { - window = Window.Instance; + window = NUIApplication.GetDefaultWindow(); } public static void UpdateWindowPositionSize() @@ -38,8 +38,8 @@ namespace Notifications.Core width = (int)(DeviceInfo.DisplayWidth * AppConstants.windowWidthRatio); height = (int)(DeviceInfo.DisplayHeight * AppConstants.windowHeightRatio); - positionX = ((DeviceInfo.IsPortrait ? DeviceInfo.DisplayHeight : DeviceInfo.DisplayWidth) - width) / 2; - positionY = ((DeviceInfo.IsPortrait ? DeviceInfo.DisplayWidth : DeviceInfo.DisplayHeight) - height) / 2; + positionX = ((DeviceInfo.IsPortrait ? DeviceInfo.DisplayHeight : DeviceInfo.DisplayWidth) - width) >> 1; + positionY = ((DeviceInfo.IsPortrait ? DeviceInfo.DisplayWidth : DeviceInfo.DisplayHeight) - height) >> 1; if (DeviceInfo.IsPortrait) { diff --git a/packaging/org.tizen.notifications-1.0.4.tpk b/packaging/org.tizen.notifications-1.0.4.tpk index c43fcbf..f1c5dd3 100644 Binary files a/packaging/org.tizen.notifications-1.0.4.tpk and b/packaging/org.tizen.notifications-1.0.4.tpk differ