diff options
author | Eunyoung Lee <ey928.lee@samsung.com> | 2022-09-30 17:57:01 +0900 |
---|---|---|
committer | Eunyoung Lee <ey928.lee@samsung.com> | 2022-09-30 17:57:27 +0900 |
commit | d33ab8d205a3cc3316a2570e07d5f8283fbabe18 (patch) | |
tree | 595d1a4a41123419172206cc6e0589423a5b7f8a | |
parent | c38eec3e2d6f2e6be57934f5c3b49c46d425b618 (diff) | |
download | tray-d33ab8d205a3cc3316a2570e07d5f8283fbabe18.tar.gz tray-d33ab8d205a3cc3316a2570e07d5f8283fbabe18.tar.bz2 tray-d33ab8d205a3cc3316a2570e07d5f8283fbabe18.zip |
Adding back button in QuckAcecess
Change-Id: I4e333ef304649e14961e5fb6c4cd88c83c4b8458
-rw-r--r-- | TrayApplication/Common/InputGeneratorBase.cs | 33 | ||||
-rw-r--r--[-rwxr-xr-x] | TrayApplication/Models/AppInfoModel.cs | 6 | ||||
-rw-r--r--[-rwxr-xr-x] | TrayApplication/TrayApplication.cs | 3 | ||||
-rw-r--r--[-rwxr-xr-x] | TrayApplication/ViewModels/QuickAccessViewModel.cs | 3 | ||||
-rw-r--r--[-rwxr-xr-x] | TrayApplication/Views/QuickAccessView.cs | 26 | ||||
-rw-r--r-- | TrayApplication/res/images/dark/back.png | bin | 0 -> 2055 bytes | |||
-rw-r--r-- | TrayApplication/res/images/light/back.png | bin | 0 -> 3496 bytes | |||
-rw-r--r--[-rwxr-xr-x] | TrayApplication/tizen-manifest.xml | 1 |
8 files changed, 65 insertions, 7 deletions
diff --git a/TrayApplication/Common/InputGeneratorBase.cs b/TrayApplication/Common/InputGeneratorBase.cs new file mode 100644 index 0000000..3c644da --- /dev/null +++ b/TrayApplication/Common/InputGeneratorBase.cs @@ -0,0 +1,33 @@ +using ElmSharp;
+
+namespace TrayApplication.Common
+{
+ public static class InputGeneratorBase
+ {
+ const string KeyName = "XF86Back";
+
+ private static InputGenerator inputGenerator;
+ public static InputGenerator InputGenerator
+ {
+ get { return inputGenerator; }
+ }
+ public static void InitInputGenerator()
+ {
+ inputGenerator = new InputGenerator(InputDeviceType.Keyboard, "TrayApplication");
+ }
+
+ public static void OnKeyEvent()
+ {
+ inputGenerator.GenerateKeyEvent(KeyName, 1);
+ inputGenerator.GenerateKeyEvent(KeyName, 0);
+ }
+
+ public static void FinalizeInputGenerator()
+ {
+ if (inputGenerator != null)
+ {
+ inputGenerator.Dispose();
+ }
+ }
+ }
+}
\ No newline at end of file diff --git a/TrayApplication/Models/AppInfoModel.cs b/TrayApplication/Models/AppInfoModel.cs index 13d917c..0d27c85 100755..100644 --- a/TrayApplication/Models/AppInfoModel.cs +++ b/TrayApplication/Models/AppInfoModel.cs @@ -16,6 +16,12 @@ namespace TrayApplication.Models ApplicationId = applicationId; IconUrl = url; AppSelectCommand = new Command(OnAppSelect); + }
+
+ public AppInfoModel(string name, string url) + { + Name = name; + IconUrl = url; } public string Name { get; internal set; } diff --git a/TrayApplication/TrayApplication.cs b/TrayApplication/TrayApplication.cs index bc8aa58..bc2b500 100755..100644 --- a/TrayApplication/TrayApplication.cs +++ b/TrayApplication/TrayApplication.cs @@ -73,7 +73,8 @@ namespace TrayApplication protected override void OnTerminate() { Tizen.Log.Info(Resources.LogTag, "Program OnTerminate"); - AppScoreDataBase.Disconnect(); + AppScoreDataBase.Disconnect();
+ InputGeneratorBase.FinalizeInputGenerator();
base.OnTerminate(); } diff --git a/TrayApplication/ViewModels/QuickAccessViewModel.cs b/TrayApplication/ViewModels/QuickAccessViewModel.cs index 9b17f1b..140252b 100755..100644 --- a/TrayApplication/ViewModels/QuickAccessViewModel.cs +++ b/TrayApplication/ViewModels/QuickAccessViewModel.cs @@ -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 }; diff --git a/TrayApplication/Views/QuickAccessView.cs b/TrayApplication/Views/QuickAccessView.cs index f3e4f5a..3b53756 100755..100644 --- a/TrayApplication/Views/QuickAccessView.cs +++ b/TrayApplication/Views/QuickAccessView.cs @@ -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");
+
+ button.Name = AppNames[i++];
+ if (button.Name == "back")
+ {
+ InputGeneratorBase.InitInputGenerator();
+ button.Clicked += (object sender, ClickedEventArgs e) =>
+ {
+ Tizen.Log.Debug(Resources.LogTag, "Back button clicked");
+ InputGeneratorBase.OnKeyEvent();
+ };
+ }
+ Tizen.Log.Info(Resources.LogTag, "Buttons Added");
} - Tizen.Log.Info(Resources.LogTag, "Buttons Added"); - } - + }
+
public void OnRemoveModeToggled(bool removeMode) { if (removeMode == true) diff --git a/TrayApplication/res/images/dark/back.png b/TrayApplication/res/images/dark/back.png Binary files differnew file mode 100644 index 0000000..5db2452 --- /dev/null +++ b/TrayApplication/res/images/dark/back.png diff --git a/TrayApplication/res/images/light/back.png b/TrayApplication/res/images/light/back.png Binary files differnew file mode 100644 index 0000000..feed590 --- /dev/null +++ b/TrayApplication/res/images/light/back.png diff --git a/TrayApplication/tizen-manifest.xml b/TrayApplication/tizen-manifest.xml index 4bf2be2..21225d2 100755..100644 --- a/TrayApplication/tizen-manifest.xml +++ b/TrayApplication/tizen-manifest.xml @@ -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 /> |