summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ISEDefaultNUI/EmoticonPage.cs111
-rw-r--r--packaging/org.tizen.ISEDefaultNUI-1.0.0.tpkbin1245316 -> 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
index 9cffdbc..f21bb74 100644
--- a/packaging/org.tizen.ISEDefaultNUI-1.0.0.tpk
+++ b/packaging/org.tizen.ISEDefaultNUI-1.0.0.tpk
Binary files differ