diff options
author | Jihoon Kim <jihoon48.kim@samsung.com> | 2022-09-18 15:19:18 +0900 |
---|---|---|
committer | Jihoon Kim <jihoon48.kim@samsung.com> | 2022-09-19 09:57:43 +0900 |
commit | 8d78327185544af7e43da0e7ac5eafe446f6b3b7 (patch) | |
tree | e41a2d1ae3ab2400a94990eb9a7fd43570f42366 | |
parent | 84536c9ba7c1c30bb16384fbf03b909b9eb931fb (diff) | |
download | ise-default-nui-8d78327185544af7e43da0e7ac5eafe446f6b3b7.tar.gz ise-default-nui-8d78327185544af7e43da0e7ac5eafe446f6b3b7.tar.bz2 ise-default-nui-8d78327185544af7e43da0e7ac5eafe446f6b3b7.zip |
Support recent emoticon featureaccepted/tizen/unified/20220920.050141
Change-Id: I5ebb2e1778e8daefaa2fd60762a2eae84f43d29b
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
-rw-r--r-- | ISEDefaultNUI/EmoticonPage.cs | 111 | ||||
-rw-r--r-- | packaging/org.tizen.ISEDefaultNUI-1.0.0.tpk | bin | 1245316 -> 407828 bytes |
2 files changed, 89 insertions, 22 deletions
diff --git a/ISEDefaultNUI/EmoticonPage.cs b/ISEDefaultNUI/EmoticonPage.cs index 7821cdb..095ab62 100644 --- a/ISEDefaultNUI/EmoticonPage.cs +++ b/ISEDefaultNUI/EmoticonPage.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Text; using Tizen; +using Tizen.Applications;
using Tizen.NUI; using Tizen.NUI.BaseComponents; using Tizen.NUI.Components; @@ -806,7 +807,8 @@ namespace ISEDefaultNUI private static int landscapeRow = 3; private static int landscapeCol = 13; private View rootView; - private ScrollableBase scroll; + private ScrollableBase scroll;
+ private const string RECENT_EMOTICONS = "RecentEmoticons"; private void DisplayCurrentEmoticonGroup()
{
@@ -832,33 +834,42 @@ namespace ISEDefaultNUI Log.Info("NUIIME", "current group : " + currentGroup);
if (currentGroup == EmoticonGroup.RecentlyUsed) { - + foreach (int emoticonCode in recentEmoticons) + {
+ AddEmoticon(emoticonCode); + } } else { for (int i = 0; i < EmoticonList[(int)currentGroup].Length; i++) { - TextLabel emoticon = new TextLabel();
- emoticon.Text = Char.ConvertFromUtf32(EmoticonList[(int)currentGroup][i]); - 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);
+ AddEmoticon(EmoticonList[(int)currentGroup][i]); + } + }
- 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; - };
+ void AddEmoticon(int emoticonCode)
+ {
+ TextLabel emoticon = new TextLabel();
+ emoticon.Text = Char.ConvertFromUtf32(emoticonCode);
+ 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);
- scroll.Add(emoticon); - } + emoticon.TouchEvent += (object sender, TouchEventArgs e) =>
+ {
+ if (e.Touch.GetState(0) == PointStateType.Up)
+ {
+ Log.Info("NUIIME", "text: " + emoticon.Text);
+ InputMethodEditor.CommitString(emoticon.Text);
+ UpdateRecentEmoticon(emoticonCode);
+ }
+
+ return true;
+ };
+
+ scroll.Add(emoticon);
}
}
@@ -866,7 +877,6 @@ namespace ISEDefaultNUI {
Size2D windowSize = NUIApplication.GetDefaultWindow().Size; - recentEmoticons = IseConfig.Instance.RecentEmoticons; if (recentEmoticons != null && recentEmoticons.Count > 0) { //Need to Add the code @@ -897,6 +907,10 @@ namespace ISEDefaultNUI public EmoticonPage() { + recentEmoticons = IseConfig.Instance.RecentEmoticons; + + ReadRecentEmoticonList(); + CreateEmoticonView(); } @@ -921,5 +935,58 @@ namespace ISEDefaultNUI DisplayCurrentEmoticonGroup();
}
+
+ private bool RemoveFromEmoticonList(int emoticonCode)
+ {
+ return recentEmoticons.Remove(emoticonCode);
+ }
+
+ private void UpdateRecentEmoticon(int emoticonCode)
+ {
+ // remove from recent emoticon list
+ RemoveFromEmoticonList(emoticonCode);
+
+ recentEmoticons.Insert(0, emoticonCode);
+
+ WriteRecentEmoticonList();
+ }
+
+ private void ReadRecentEmoticonList()
+ {
+ string recentEmoticonString;
+ if (Preference.Contains(RECENT_EMOTICONS))
+ {
+ recentEmoticonString = Preference.Get<string>(RECENT_EMOTICONS);
+ Log.Info("NUIIME", "Read recent Emoticon string(" + recentEmoticonString + ")");
+ }
+ else {
+ Log.Info("NUIIME", "Failed to read recent Emoticon string");
+ return;
+ }
+
+ recentEmoticons.Clear();
+
+ string[] emoticon_list = recentEmoticonString.Split(" ");
+ foreach (string emoticon in emoticon_list)
+ {
+ if (String.IsNullOrEmpty(emoticon))
+ continue;
+
+ int emoticonCode = Int32.Parse(emoticon);
+ recentEmoticons.Add(emoticonCode);
+ }
+ }
+
+ private void WriteRecentEmoticonList()
+ {
+ string recentEmoticonString = "";
+
+ foreach (int emoticonCode in recentEmoticons)
+ {
+ recentEmoticonString += emoticonCode + " ";
+ }
+
+ Preference.Set(RECENT_EMOTICONS, recentEmoticonString);
+ }
} } diff --git a/packaging/org.tizen.ISEDefaultNUI-1.0.0.tpk b/packaging/org.tizen.ISEDefaultNUI-1.0.0.tpk Binary files differindex 9cffdbc..f21bb74 100644 --- a/packaging/org.tizen.ISEDefaultNUI-1.0.0.tpk +++ b/packaging/org.tizen.ISEDefaultNUI-1.0.0.tpk |