diff options
author | Eunyoung Lee <ey928.lee@samsung.com> | 2022-10-01 07:29:24 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@review> | 2022-10-01 07:29:24 +0000 |
commit | f3907dacc6593c2cbe3032d19d108fe5112614f7 (patch) | |
tree | 291d52caea42b66a3252f4d99e89fd420b0eb1e0 | |
parent | 22231df5c96ac80cf1ad765c94fd1b5a194d60ef (diff) | |
parent | d33ab8d205a3cc3316a2570e07d5f8283fbabe18 (diff) | |
download | tray-f3907dacc6593c2cbe3032d19d108fe5112614f7.tar.gz tray-f3907dacc6593c2cbe3032d19d108fe5112614f7.tar.bz2 tray-f3907dacc6593c2cbe3032d19d108fe5112614f7.zip |
Merge "Adding back button in QuckAcecess" into tizen
-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 4d57ab9..6a80c9e 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 /> |