summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortarunkumarmahay1999 <tarun.mahay@samsung.com>2022-09-27 15:20:11 +0530
committershivamv <shivam.v2@samsung.com>2022-09-27 15:25:08 +0530
commitc38eec3e2d6f2e6be57934f5c3b49c46d425b618 (patch)
treeff7b0239fc9db1d22808b33a7f65bdf090047597
parent161d9787ebc2b1e7dae7bbc95444649ed81e5361 (diff)
downloadtray-c38eec3e2d6f2e6be57934f5c3b49c46d425b618.tar.gz
tray-c38eec3e2d6f2e6be57934f5c3b49c46d425b618.tar.bz2
tray-c38eec3e2d6f2e6be57934f5c3b49c46d425b618.zip
Adding custom border in Apps application.
Change-Id: I43c655dce85448d8d7d2857dd2eb693a9261a804 Signed-off-by: shivamv <shivam.v2@samsung.com>
-rwxr-xr-x[-rw-r--r--]Apps/Apps.cs4
-rwxr-xr-x[-rw-r--r--]Apps/Common/Resources.cs6
-rwxr-xr-x[-rw-r--r--]Apps/Models/AppInfoModel.cs2
-rwxr-xr-xApps/Views/CustomBorder.cs154
-rwxr-xr-xApps/res/images/close.pngbin0 -> 2092 bytes
-rwxr-xr-xApps/res/images/leftCorner.pngbin0 -> 1583 bytes
-rwxr-xr-xApps/res/images/maximalize.pngbin0 -> 1101 bytes
-rwxr-xr-xApps/res/images/rightCorner.pngbin0 -> 1763 bytes
-rwxr-xr-xApps/res/images/smallwindow.pngbin0 -> 1429 bytes
-rwxr-xr-xpackaging/org.tizen.Apps-1.0.0.tpkbin48464 -> 59571 bytes
10 files changed, 163 insertions, 3 deletions
diff --git a/Apps/Apps.cs b/Apps/Apps.cs
index 7653a43..ca977a2 100644..100755
--- a/Apps/Apps.cs
+++ b/Apps/Apps.cs
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using Tizen.NUI;
using Apps.Common;
-
+using Apps.Views;
namespace Apps
{
public class Program : NUIApplication
@@ -13,7 +13,7 @@ namespace Apps
private Window window;
private Window.WindowOrientation orientation;
- public Program() : base(new Size2D(960, 540), new Position2D(480, 170), ThemeOptions.PlatformThemeEnabled, new DefaultBorder())
+ public Program() : base(new Size2D(960, 540), new Position2D(480, 170), ThemeOptions.PlatformThemeEnabled, new CustomBorder())
{
}
diff --git a/Apps/Common/Resources.cs b/Apps/Common/Resources.cs
index 70657ad..b0100a7 100644..100755
--- a/Apps/Common/Resources.cs
+++ b/Apps/Common/Resources.cs
@@ -9,6 +9,12 @@
public static string GetThemePath()
{
return Tizen.Applications.Application.Current.DirectoryInfo.Resource + "themes/";
+ }
+
+ public static string GetImagePath()
+ {
+ return Tizen.Applications.Application.Current.DirectoryInfo.Resource + "images/";
}
+
}
}
diff --git a/Apps/Models/AppInfoModel.cs b/Apps/Models/AppInfoModel.cs
index 12d89f5..e7a301a 100644..100755
--- a/Apps/Models/AppInfoModel.cs
+++ b/Apps/Models/AppInfoModel.cs
@@ -39,7 +39,7 @@ namespace Apps.Models
{
ImageVisual imageVisual = new ImageVisual()
{
- URL = Application.Current.DirectoryInfo.Resource + "images/" + "default_gradient.png",
+ URL = Resources.GetImagePath() + "default_gradient.png",
};
IconBackground = imageVisual.OutputVisualMap;
}
diff --git a/Apps/Views/CustomBorder.cs b/Apps/Views/CustomBorder.cs
new file mode 100755
index 0000000..0cecea8
--- /dev/null
+++ b/Apps/Views/CustomBorder.cs
@@ -0,0 +1,154 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using Tizen;
+using Tizen.NUI;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using Apps.Common;
+namespace Apps.Views
+{
+ class CustomBorder : DefaultBorder
+ {
+ private ImageView maximalizeIcon;
+ private ImageView closeIcon;
+ private ImageView leftCornerIcon;
+ private ImageView rightCornerIcon;
+ private View borderView;
+
+ public CustomBorder() : base()
+ {
+ }
+
+ public override void CreateBorderView(View borderView)
+ {
+ this.borderView = borderView;
+ borderView.CornerRadius = new Vector4(0.03f, 0.03f, 0.03f, 0.03f);
+ borderView.CornerRadiusPolicy = VisualTransformPolicyType.Relative;
+ borderView.BackgroundColor = new Color(1, 1, 1, 0.3f);
+ }
+
+ public override bool CreateBottomBorderView(View bottomView)
+ {
+ if (bottomView == null)
+ {
+ return false;
+ }
+ bottomView.Layout = new RelativeLayout();
+ maximalizeIcon = new ImageView()
+ {
+ Focusable = true,
+ ResourceUrl = Resources.GetImagePath() + "/maximalize.png",
+ AccessibilityHighlightable = true,
+ };
+
+ closeIcon = new ImageView()
+ {
+ Focusable = true,
+ ResourceUrl = Resources.GetImagePath() + "/close.png",
+ AccessibilityHighlightable = true,
+ };
+
+ leftCornerIcon = new ImageView()
+ {
+ Focusable = true,
+ ResourceUrl = Resources.GetImagePath() + "/leftCorner.png",
+ AccessibilityHighlightable = true,
+ };
+
+ rightCornerIcon = new ImageView()
+ {
+ Focusable = true,
+ ResourceUrl = Resources.GetImagePath() + "/rightCorner.png",
+ AccessibilityHighlightable = true,
+ };
+
+ RelativeLayout.SetRightTarget(maximalizeIcon, closeIcon);
+ RelativeLayout.SetRightRelativeOffset(maximalizeIcon, 0.0f);
+ RelativeLayout.SetHorizontalAlignment(maximalizeIcon, RelativeLayout.Alignment.End);
+
+ RelativeLayout.SetRightTarget(closeIcon, rightCornerIcon);
+ RelativeLayout.SetRightRelativeOffset(closeIcon, 0.0f);
+ RelativeLayout.SetHorizontalAlignment(closeIcon, RelativeLayout.Alignment.End);
+
+ RelativeLayout.SetRightRelativeOffset(rightCornerIcon, 1.0f);
+ RelativeLayout.SetHorizontalAlignment(rightCornerIcon, RelativeLayout.Alignment.End);
+
+ bottomView.Add(leftCornerIcon);
+ bottomView.Add(maximalizeIcon);
+ bottomView.Add(closeIcon);
+ bottomView.Add(rightCornerIcon);
+
+ maximalizeIcon.TouchEvent += OnMaximizeIconTouched;
+ closeIcon.TouchEvent += OnCloseIconTouched;
+ leftCornerIcon.TouchEvent += OnLeftBottomCornerIconTouched;
+ rightCornerIcon.TouchEvent += OnRightBottomCornerIconTouched;
+
+ maximalizeIcon.AccessibilityActivated += (s, e) =>
+ {
+ MaximizeBorderWindow();
+ };
+
+ closeIcon.AccessibilityActivated += (s, e) =>
+ {
+ CloseBorderWindow();
+ };
+
+ maximalizeIcon.AccessibilityNameRequested += (s, e) =>
+ {
+ e.Name = "Maximize";
+ };
+
+ closeIcon.AccessibilityNameRequested += (s, e) =>
+ {
+ e.Name = "Close";
+ };
+
+ leftCornerIcon.AccessibilityNameRequested += (s, e) =>
+ {
+ e.Name = "Resize";
+ };
+
+ rightCornerIcon.AccessibilityNameRequested += (s, e) =>
+ {
+ e.Name = "Resize";
+ };
+
+ maximalizeIcon.SetAccessibilityReadingInfoTypes(Tizen.NUI.BaseComponents.AccessibilityReadingInfoTypes.Name);
+ closeIcon.SetAccessibilityReadingInfoTypes(Tizen.NUI.BaseComponents.AccessibilityReadingInfoTypes.Name);
+ leftCornerIcon.SetAccessibilityReadingInfoTypes(Tizen.NUI.BaseComponents.AccessibilityReadingInfoTypes.Name);
+ rightCornerIcon.SetAccessibilityReadingInfoTypes(Tizen.NUI.BaseComponents.AccessibilityReadingInfoTypes.Name);
+ return true;
+ }
+
+ public override void OnResized(int width, int height)
+ {
+ if (borderView != null)
+ {
+ base.OnResized(width, height);
+ UpdateIcons();
+ }
+ }
+
+ private void UpdateIcons()
+ {
+ if (BorderWindow != null && borderView != null)
+ {
+ if (BorderWindow.IsMaximized() == true)
+ {
+ if (maximalizeIcon != null)
+ {
+ maximalizeIcon.ResourceUrl = Resources.GetImagePath() + "/smallwindow.png";
+ }
+ }
+ else
+ {
+ if (maximalizeIcon != null)
+ {
+ maximalizeIcon.ResourceUrl = Resources.GetImagePath() + "/maximalize.png";
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/Apps/res/images/close.png b/Apps/res/images/close.png
new file mode 100755
index 0000000..6b09554
--- /dev/null
+++ b/Apps/res/images/close.png
Binary files differ
diff --git a/Apps/res/images/leftCorner.png b/Apps/res/images/leftCorner.png
new file mode 100755
index 0000000..72e2119
--- /dev/null
+++ b/Apps/res/images/leftCorner.png
Binary files differ
diff --git a/Apps/res/images/maximalize.png b/Apps/res/images/maximalize.png
new file mode 100755
index 0000000..320b602
--- /dev/null
+++ b/Apps/res/images/maximalize.png
Binary files differ
diff --git a/Apps/res/images/rightCorner.png b/Apps/res/images/rightCorner.png
new file mode 100755
index 0000000..05871f3
--- /dev/null
+++ b/Apps/res/images/rightCorner.png
Binary files differ
diff --git a/Apps/res/images/smallwindow.png b/Apps/res/images/smallwindow.png
new file mode 100755
index 0000000..9def8da
--- /dev/null
+++ b/Apps/res/images/smallwindow.png
Binary files differ
diff --git a/packaging/org.tizen.Apps-1.0.0.tpk b/packaging/org.tizen.Apps-1.0.0.tpk
index 5143e62..14a309b 100755
--- a/packaging/org.tizen.Apps-1.0.0.tpk
+++ b/packaging/org.tizen.Apps-1.0.0.tpk
Binary files differ