Adding back button in QuckAcecess 69/282369/1
authorEunyoung Lee <ey928.lee@samsung.com>
Fri, 30 Sep 2022 08:57:01 +0000 (17:57 +0900)
committerEunyoung Lee <ey928.lee@samsung.com>
Fri, 30 Sep 2022 08:57:27 +0000 (17:57 +0900)
Change-Id: I4e333ef304649e14961e5fb6c4cd88c83c4b8458

TrayApplication/Common/InputGeneratorBase.cs [new file with mode: 0644]
TrayApplication/Models/AppInfoModel.cs [changed mode: 0755->0644]
TrayApplication/TrayApplication.cs [changed mode: 0755->0644]
TrayApplication/ViewModels/QuickAccessViewModel.cs [changed mode: 0755->0644]
TrayApplication/Views/QuickAccessView.cs [changed mode: 0755->0644]
TrayApplication/res/images/dark/back.png [new file with mode: 0644]
TrayApplication/res/images/light/back.png [new file with mode: 0644]
TrayApplication/tizen-manifest.xml [changed mode: 0755->0644]

diff --git a/TrayApplication/Common/InputGeneratorBase.cs b/TrayApplication/Common/InputGeneratorBase.cs
new file mode 100644 (file)
index 0000000..3c644da
--- /dev/null
@@ -0,0 +1,33 @@
+using ElmSharp;\r
+\r
+namespace TrayApplication.Common\r
+{\r
+    public static class InputGeneratorBase\r
+    {\r
+        const string KeyName = "XF86Back";\r
+\r
+        private static InputGenerator inputGenerator;\r
+        public static InputGenerator InputGenerator\r
+        {\r
+            get { return inputGenerator; }\r
+        }\r
+        public static void InitInputGenerator()\r
+        {\r
+            inputGenerator = new InputGenerator(InputDeviceType.Keyboard, "TrayApplication");\r
+        }\r
+\r
+        public static void OnKeyEvent()\r
+        {\r
+            inputGenerator.GenerateKeyEvent(KeyName, 1);\r
+            inputGenerator.GenerateKeyEvent(KeyName, 0);\r
+        }\r
+\r
+        public static void FinalizeInputGenerator()\r
+        {\r
+            if (inputGenerator != null)\r
+            {\r
+                inputGenerator.Dispose();\r
+            }\r
+        }\r
+    }\r
+}
\ No newline at end of file
old mode 100755 (executable)
new mode 100644 (file)
index 13d917c..0d27c85
@@ -16,6 +16,12 @@ namespace TrayApplication.Models
             ApplicationId = applicationId;
             IconUrl = url;
             AppSelectCommand = new Command(OnAppSelect);
+        }\r
+\r
+        public AppInfoModel(string name, string url)
+        {
+            Name = name;
+            IconUrl = url;
         }
 
         public string Name { get; internal set; }
old mode 100755 (executable)
new mode 100644 (file)
index bc8aa58..bc2b500
@@ -73,7 +73,8 @@ namespace TrayApplication
         protected override void OnTerminate()
         {
             Tizen.Log.Info(Resources.LogTag, "Program OnTerminate");
-            AppScoreDataBase.Disconnect();
+            AppScoreDataBase.Disconnect();\r
+            InputGeneratorBase.FinalizeInputGenerator();\r
             base.OnTerminate();
         }
 
old mode 100755 (executable)
new mode 100644 (file)
index 9b17f1b..140252b
@@ -8,7 +8,7 @@ namespace TrayApplication.ViewModels
 {
     class QuickAccessViewModel : PropertyNotifier
     {
-        private readonly List<string> AppNames = new List<string>() { "home", "settings", "volume", "notifications", "gallery", "power" };
+        private readonly List<string> AppNames = new List<string>() { "home", "settings", "volume", "back", "notifications", "gallery", "power" };
 
         public QuickAccessViewModel()
         {
@@ -35,6 +35,7 @@ namespace TrayApplication.ViewModels
                 new AppInfoModel(AppNames[0], "org.tizen.homescreen-efl", imagePath + AppNames[0] + ".png"),
                 new AppInfoModel(AppNames[1], "org.tizen.setting", imagePath + AppNames[1] + ".png"),
                 new AppInfoModel(AppNames[2], "org.tizen.volume", imagePath + AppNames[2] + ".png"),
+                new AppInfoModel(AppNames[3], 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
             };
old mode 100755 (executable)
new mode 100644 (file)
index f3e4f5a..3b53756
@@ -10,6 +10,8 @@ namespace TrayApplication.Views
 {
     public class QuickAccessView : View
     {
+        private readonly List<string> AppNames = new List<string>() { "home", "settings", "volume", "back", "notifications", "gallery", "power" };
+
         private const int QuickAccessViewHeight = 124;
         private const int IconSize = 76;
         private List<Button> defaultButtons;
@@ -70,8 +72,9 @@ namespace TrayApplication.Views
             Button button = new Button(buttonStyle)
             {
                 WidthSpecification = IconSize.SpToPx(),
-                HeightSpecification = IconSize.SpToPx()
+                HeightSpecification = IconSize.SpToPx(),
             };
+
             return button;
         }
 
@@ -82,6 +85,8 @@ namespace TrayApplication.Views
                 Remove(button);
             }
             defaultButtons.Clear();
+
+            int i = 0;
             foreach (var item in appList)
             {
                 Button button = CreateNewButton();
@@ -89,11 +94,22 @@ namespace TrayApplication.Views
                 defaultButtons.Add(button);
                 button.BindingContext = item;
                 button.Icon.SetBinding(ImageView.ResourceUrlProperty, "IconUrl");
-                button.SetBinding(Control.CommandProperty, "AppSelectCommand");
+                button.SetBinding(Control.CommandProperty, "AppSelectCommand");\r
+\r
+                button.Name = AppNames[i++];\r
+                if (button.Name == "back")\r
+                {\r
+                    InputGeneratorBase.InitInputGenerator();\r
+                    button.Clicked += (object sender, ClickedEventArgs e) =>\r
+                    {\r
+                        Tizen.Log.Debug(Resources.LogTag, "Back button clicked");\r
+                        InputGeneratorBase.OnKeyEvent();\r
+                    };\r
+                }\r
+                Tizen.Log.Info(Resources.LogTag, "Buttons Added");\r
             }
-            Tizen.Log.Info(Resources.LogTag, "Buttons Added");
-        }
-
+        }\r
+\r
         public void OnRemoveModeToggled(bool removeMode)
         {
             if (removeMode == true)
diff --git a/TrayApplication/res/images/dark/back.png b/TrayApplication/res/images/dark/back.png
new file mode 100644 (file)
index 0000000..5db2452
Binary files /dev/null and b/TrayApplication/res/images/dark/back.png differ
diff --git a/TrayApplication/res/images/light/back.png b/TrayApplication/res/images/light/back.png
new file mode 100644 (file)
index 0000000..feed590
Binary files /dev/null and b/TrayApplication/res/images/light/back.png differ
old mode 100755 (executable)
new mode 100644 (file)
index 4bf2be2..21225d2
@@ -18,6 +18,7 @@
         <privilege>http://tizen.org/privilege/externalstorage</privilege>
         <privilege>http://tizen.org/privilege/externalstorage.appdata</privilege>
         <privilege>http://tizen.org/privilege/packagemanager.info</privilege>
+        <privilege>http://tizen.org/privilege/inputgenerator</privilege>
     </privileges>
     <dependencies />
     <provides-appdefined-privileges />