diff options
Diffstat (limited to 'ISEDefaultNUI')
-rw-r--r-- | ISEDefaultNUI/EmoticonPage.cs | 138 | ||||
-rw-r--r-- | ISEDefaultNUI/ISEDefaultNUI.cs | 2 | ||||
-rw-r--r-- | ISEDefaultNUI/SCLNUI.cs | 82 | ||||
-rw-r--r-- | ISEDefaultNUI/res/LYT_LANDSCAPE_QTY_ENGLISH.xml | 17 |
4 files changed, 178 insertions, 61 deletions
diff --git a/ISEDefaultNUI/EmoticonPage.cs b/ISEDefaultNUI/EmoticonPage.cs index b6c0bdb..eb8e83e 100644 --- a/ISEDefaultNUI/EmoticonPage.cs +++ b/ISEDefaultNUI/EmoticonPage.cs @@ -1,13 +1,15 @@ using System; using System.Collections.Generic; using System.Text; +using Tizen; using Tizen.NUI; using Tizen.NUI.BaseComponents; using Tizen.NUI.Components; +using Tizen.Uix.InputMethod; namespace ISEDefaultNUI { - class EmoticonPage : ContentPage + class EmoticonPage : View { private static int[] EmoticonList1 = new int[] { @@ -803,57 +805,32 @@ namespace ISEDefaultNUI private static int portraitCol = 7; private static int landscapeRow = 3; private static int landscapeCol = 13; + private View rootView; + private ScrollableBase scroll; - public EmoticonPage(Navigator Navigator) - { - navigator = Navigator; - Size2D windowSize = NUIApplication.GetDefaultWindow().Size; - - recentEmoticons = IseConfig.Instance.RecentEmoticons; - if (recentEmoticons != null && recentEmoticons.Count > 0) - { - //Need to Add the code - currentGroup = EmoticonGroup.RecentlyUsed; - } - else - { - currentGroup = EmoticonGroup.Group1; - } - - View rootView = new View() - { - Layout = new LinearLayout() - { - LinearOrientation = LinearLayout.Orientation.Vertical, - }, - WidthSpecification = LayoutParamPolicies.MatchParent, - HeightSpecification = LayoutParamPolicies.MatchParent, - }; - - ScrollableBase scroll = new ScrollableBase() + private void DisplayCurrentEmoticonGroup()
+ {
+ Size2D windowSize = NUIApplication.GetDefaultWindow().Size;
+
+ scroll?.Dispose();
+
+ scroll = new ScrollableBase() { WidthSpecification = LayoutParamPolicies.MatchParent, - SizeHeight = (float)(windowSize.Height * 0.75), + SizeHeight = (float)(windowSize.Height * 0.70), ScrollingDirection = ScrollableBase.Direction.Vertical, HideScrollbar = true, + Position = new Position(80, 0), Layout = new GridLayout() { - Rows = portraitRow, - Columns = portraitCol + Rows = landscapeRow, + Columns = landscapeCol }, }; - rootView.Add(scroll); - - View buttonView = new View() - { - WidthSpecification = LayoutParamPolicies.MatchParent, - SizeHeight = (float)(windowSize.Height * 0.25), - // Temporary Code - BackgroundColor = new Color(0.8f, 0.2f, 0.2f, 1.0f) - }; - rootView.Add(buttonView); - + rootView.Add(scroll);
+
+ Log.Info("NUIIME", "current group : " + currentGroup);
if (currentGroup == EmoticonGroup.RecentlyUsed) { @@ -862,18 +839,87 @@ namespace ISEDefaultNUI { for (int i = 0; i < EmoticonList[(int)currentGroup].Length; i++) { - TextLabel emoticon = new TextLabel(); + TextLabel emoticon = new TextLabel();
emoticon.Text = Char.ConvertFromUtf32(EmoticonList[(int)currentGroup][i]); - emoticon.Margin = new Extents(margin, margin, margin, margin); + emoticon.Margin = new Extents(margin, margin, margin, margin);
emoticon.HorizontalAlignment = HorizontalAlignment.Center; emoticon.VerticalAlignment = VerticalAlignment.Center; emoticon.PointSize = pointSize; - emoticon.Size2D = new Size2D(itemSize, itemSize); + emoticon.Size2D = new Size2D(itemSize, itemSize);
+
+ emoticon.TouchEvent += (object sender, TouchEventArgs e) => + { + if (e.Touch.GetState(0) == PointStateType.Up) + { + Log.Info("NUIIME", "text: " + emoticon.Text); + InputMethodEditor.CommitString(emoticon.Text); + } + + return true; + };
+
scroll.Add(emoticon); } + }
+ }
+
+ private View CreateEmoticonView()
+ {
+ Size2D windowSize = NUIApplication.GetDefaultWindow().Size; + + recentEmoticons = IseConfig.Instance.RecentEmoticons; + if (recentEmoticons != null && recentEmoticons.Count > 0) + { + //Need to Add the code + currentGroup = EmoticonGroup.RecentlyUsed; } + else + { + currentGroup = EmoticonGroup.Group1; + } + + rootView = new View() + { + Layout = new LinearLayout() + { + LinearOrientation = LinearLayout.Orientation.Vertical, + }, + WidthSpecification = LayoutParamPolicies.MatchParent, + HeightSpecification = LayoutParamPolicies.MatchParent, + }; - Add(rootView); + DisplayCurrentEmoticonGroup(); + + Add(rootView);
+
+ return rootView;
+ } + + public EmoticonPage() + { + CreateEmoticonView(); } + + public View GetView() + {
+ return rootView;
+ } + + public void SetEmoticonGroup(string groupName)
+ {
+ Log.Info("NUIIME", "Group name : " + groupName);
+
+ for (int i = 0; i < EmoticonGroupName.Count; i++)
+ {
+ if (EmoticonGroupName[i] == groupName) {
+ if (i >= 1)
+ currentGroup = (EmoticonGroup)i - 1;
+ else
+ currentGroup = EmoticonGroup.RecentlyUsed;
+ }
+ }
+
+ DisplayCurrentEmoticonGroup();
+ }
} } diff --git a/ISEDefaultNUI/ISEDefaultNUI.cs b/ISEDefaultNUI/ISEDefaultNUI.cs index 1884abb..ab24bdb 100644 --- a/ISEDefaultNUI/ISEDefaultNUI.cs +++ b/ISEDefaultNUI/ISEDefaultNUI.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using System.IO;
+using System.IO; using System.Runtime.InteropServices; using System.Threading.Tasks; using System.Xml; diff --git a/ISEDefaultNUI/SCLNUI.cs b/ISEDefaultNUI/SCLNUI.cs index 747c11c..4fb3178 100644 --- a/ISEDefaultNUI/SCLNUI.cs +++ b/ISEDefaultNUI/SCLNUI.cs @@ -9,7 +9,7 @@ using Tizen.NUI.BaseComponents; using Tizen.NUI.Components; using Tizen.Uix.InputMethod; using static Interop.SclNuiCSharp; - +
namespace ISEDefaultNUI { class SCLNUI : Page @@ -42,6 +42,9 @@ namespace ISEDefaultNUI private string[] sigDec = { ".", "-" }; private uint[] sigDecEvent = { '.', '-' }; private Timer commitTimer; + private Timer showEmoticonTimer; + private View emoticonView = null; + private EmoticonPage emoticonPage = null;
enum LabelAlignment { @@ -79,7 +82,10 @@ namespace ISEDefaultNUI label_list = new List<TextLabel>(); commitTimer = new Timer(1000); - commitTimer.Tick += CommitTimerTick; + commitTimer.Tick += CommitTimerTick;
+
+ showEmoticonTimer = new Timer(10);
+ showEmoticonTimer.Tick += showEmoticonTimerTick; /* Draw text callback */ _draw_text_cb = (IntPtr font_name, short font_size, bool is_italic, bool is_bold, int r, int g, int b, int a, @@ -262,6 +268,9 @@ namespace ISEDefaultNUI IntPtr inputModePtr; SclNuiGetInputMode(out inputModePtr); string inputMode = Marshal.PtrToStringAnsi(inputModePtr); + + Log.Info("NUIIME", "key value: " + keyValue + ", keyType: " + keyType + ", inputmode: " + inputMode); + if (keyModifier == SclNuiKeyModifier.MultitapStart) { if (keyboardState.MultitapValue.Length > 0) @@ -344,6 +353,7 @@ namespace ISEDefaultNUI const string capsLock = "CapsLock"; const string deleteAll = "DeleteAll"; const string hidePanel = "Hide"; + const string EmoticonLayout = "EMOTICON_LAYOUT"; if (keyValue.Equals(longShift)) { Log.Info("NUIIME", "shift key is longpress"); @@ -368,7 +378,8 @@ namespace ISEDefaultNUI SclNuiSetShiftState((uint)ShiftState.Off); KeyboardState.Instance.ResetMultitapState(true); InputMethodEditor.RequestHide(); - } + }
+
else if (key_event > 0) { Common.SendKeyEvent((KeyCode)key_event); @@ -376,7 +387,13 @@ namespace ISEDefaultNUI break; case SclNuiKeyType.Modechange: break; - case SclNuiKeyType.User: + case SclNuiKeyType.User:
+ { + String substring = keyValue.Substring(0, 15); + Log.Info("NUIIME", "key substring " + substring); + if (substring.Equals("EMOTICON_GROUP_"))
+ emoticonPage?.SetEmoticonGroup(keyValue);
+ }
break; case SclNuiKeyType.Max: break; @@ -386,16 +403,18 @@ namespace ISEDefaultNUI if (keyValue.Equals("OPTION")) { - /* AppControl appControl = new AppControl(); appControl.Operation = AppControlOperations.Default; appControl.ApplicationId = ResourceManager.IseSettingAppId; appControl.ExtraData.Add("caller", "NUI_IME"); appControl.LaunchMode = AppControlLaunchMode.Group; AppControl.SendLaunchRequest(appControl); - */ - - ShowEmoticonLayout(); + } + else if (keyValue.Equals("EMOTICON_LAYOUT"))
+ {
+ ShowEmoticonLayout();
+
+ Log.Info("NUIIME", "emoticon");
} if (keyValue.Equals("Space") && afterPositionX != 0 && Math.Abs(beforePositionX - afterPositionX) > 100 && !inputMode.Equals("SYM_QTY_1")) @@ -426,6 +445,8 @@ namespace ISEDefaultNUI if (keyValue.Equals("CUR_LANG")) { + HideEmoticonLayout(); + this.SetUpdatePending(true); LanguageInfo currentLanguage = LanguageManager.Instance.GetLanguageInfo(LanguageManager.Instance.GetCurrentLanguage()); this.SetInputMode(currentLanguage.SelectedInputMode); @@ -506,6 +527,21 @@ namespace ISEDefaultNUI return true; } + private void ShowEmoticonLayout()
+ { + if (showEmoticonTimer.IsRunning())
+ showEmoticonTimer.Stop();
+
+ showEmoticonTimer.Start();
+ } + + private bool showEmoticonTimerTick(object source, Timer.TickEventArgs e) + {
+ Log.Info("NUIIME", "emoticon layout timer");
+ OnShowEmoticonLayoutTimer(); + return false;
+ } + private void OnResized(object sender, Window.ResizedEventArgs e) { SclNuiSetRotation((int)Window.Instance.GetCurrentOrientation()); @@ -679,11 +715,22 @@ namespace ISEDefaultNUI } } - private void ShowEmoticonLayout() + private void OnShowEmoticonLayoutTimer() + { + emoticonPage = new EmoticonPage(); + emoticonView = emoticonPage.GetView(); + Add(emoticonView); + } + + private void HideEmoticonLayout() { - navigator.RemoveAll(); - EmoticonPage emoticonPage = new EmoticonPage(navigator); - navigator.Push(emoticonPage); + Log.Info("NUIIME", "Hide emoticon layout"); + + if (emoticonView) + Remove(emoticonView); + + emoticonView?.Dispose(); + emoticonView = null; } public int Init(string entry_filepath) @@ -698,7 +745,16 @@ namespace ISEDefaultNUI public int SetInputMode(string mode) { - return SclNuiSetInputMode(mode); + int ret = SclNuiSetInputMode(mode); + + Log.Info("NUIIME", "Input mode: " + mode); + + if (mode.Equals("EMOTICON_LAYOUT")) + ShowEmoticonLayout(); + else + HideEmoticonLayout(); + + return ret; } public int SetUpdatePending(bool pend) diff --git a/ISEDefaultNUI/res/LYT_LANDSCAPE_QTY_ENGLISH.xml b/ISEDefaultNUI/res/LYT_LANDSCAPE_QTY_ENGLISH.xml index 4a894f3..8f13f58 100644 --- a/ISEDefaultNUI/res/LYT_LANDSCAPE_QTY_ENGLISH.xml +++ b/ISEDefaultNUI/res/LYT_LANDSCAPE_QTY_ENGLISH.xml @@ -583,7 +583,22 @@ <popup_input_mode>CM_POPUP</popup_input_mode> </popup_input_mode_record> </key> - <key button_type="direction" key_type="control" custom_id="SPACE_KEY" hit_left="6" hit_right="7" label_type="QTY_LAND_SPACE" image_label_type="IMAGE_ARROW" width="544"> + <key key_type="modechange" custom_id="EMOTICON_KEY" width="96"> + <key_value> + <rec>EMOTICON_LAYOUT</rec> + </key_value> + <image_label> + <rec button="normal">icon/54x54/icon_emotion_nor.png</rec> + <rec button="pressed">icon/54x54/icon_emotion_press.png</rec> + <rec button="disabled">icon/54x54/icon_emotion_dim.png</rec> + </image_label> + <background_image> + <rec button="normal">nine patch/btn_02.#.png</rec> + <rec button="pressed">nine patch/btn_press.#.png</rec> + <rec button="disabled">nine patch/btn_02.#.png</rec> + </background_image> + </key> + <key button_type="direction" key_type="control" custom_id="SPACE_KEY" hit_left="6" hit_right="7" label_type="QTY_LAND_SPACE" image_label_type="IMAGE_ARROW" width="448"> <label> <rec>_LANGUAGE_</rec> </label> |