using System.Collections.Generic;
using System.Text;
using Tizen;
-using Tizen.Applications;\r
+using Tizen.Applications;
using Tizen.NUI;
using Tizen.NUI.BaseComponents;
using Tizen.NUI.Components;
Max
};
- private Navigator navigator = null;
private EmoticonGroup currentGroup;
private List<int> recentEmoticons;
- private static int pointSize = 16;
- private static int itemSize = 76;
+ private static int pointSize = 32;
+ private static int itemSize = 120;
private static ushort margin = 4;
private static int portraitRow = 4;
private static int portraitCol = 7;
private static int landscapeRow = 3;
private static int landscapeCol = 13;
private View rootView;
- private ScrollableBase scroll;\r
+ private ScrollableBase scroll;
private const string RECENT_EMOTICONS = "RecentEmoticons";
- private void DisplayCurrentEmoticonGroup()\r
- {\r
- Size2D windowSize = NUIApplication.GetDefaultWindow().Size;\r
-\r
- scroll?.Dispose();\r
-\r
+ private void DisplayCurrentEmoticonGroup()
+ {
+ Size2D windowSize = NUIApplication.GetDefaultWindow().Size;
+
+ scroll?.Dispose();
+
scroll = new ScrollableBase()
{
WidthSpecification = LayoutParamPolicies.MatchParent,
Columns = landscapeCol
},
};
- rootView.Add(scroll);\r
-\r
- Log.Info("NUIIME", "current group : " + currentGroup);\r
+ rootView.Add(scroll);
+
+ Log.Info("NUIIME", "current group : " + currentGroup);
if (currentGroup == EmoticonGroup.RecentlyUsed)
{
foreach (int emoticonCode in recentEmoticons)
- {\r
+ {
AddEmoticon(emoticonCode);
}
}
{
AddEmoticon(EmoticonList[(int)currentGroup][i]);
}
- }\r
-\r
- void AddEmoticon(int emoticonCode)\r
- {\r
- TextLabel emoticon = new TextLabel();\r
- emoticon.Text = Char.ConvertFromUtf32(emoticonCode);\r
- emoticon.Margin = new Extents(margin, margin, margin, margin);\r
- emoticon.HorizontalAlignment = HorizontalAlignment.Center;\r
- emoticon.VerticalAlignment = VerticalAlignment.Center;\r
- emoticon.PointSize = pointSize;\r
- emoticon.Size2D = new Size2D(itemSize, itemSize);\r
-\r
- emoticon.TouchEvent += (object sender, TouchEventArgs e) =>\r
- {\r
- if (e.Touch.GetState(0) == PointStateType.Up)\r
- {\r
- Log.Info("NUIIME", "text: " + emoticon.Text);\r
- InputMethodEditor.CommitString(emoticon.Text);\r
- UpdateRecentEmoticon(emoticonCode);\r
- }\r
-\r
- return true;\r
- };\r
-\r
- scroll.Add(emoticon);\r
- }\r
- }\r
-\r
- private View CreateEmoticonView()\r
- {\r
+ }
+
+ 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);
+
+ 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);
+ }
+ }
+
+ private View CreateEmoticonView()
+ {
Size2D windowSize = NUIApplication.GetDefaultWindow().Size;
if (recentEmoticons != null && recentEmoticons.Count > 0)
},
WidthSpecification = LayoutParamPolicies.MatchParent,
HeightSpecification = LayoutParamPolicies.MatchParent,
- Padding = new Extents(80, 80, 0, 0)
+ Padding = new Extents(120, 120, 0, 0)
};
DisplayCurrentEmoticonGroup();
- Add(rootView);\r
-\r
- return rootView;\r
+ Add(rootView);
+
+ return rootView;
}
public EmoticonPage()
}
public View GetView()
- {\r
- return rootView;\r
+ {
+ return rootView;
}
- public void SetEmoticonGroup(string groupName)\r
- {\r
- Log.Info("NUIIME", "Group name : " + groupName);\r
-\r
- for (int i = 0; i < EmoticonGroupName.Count; i++)\r
- {\r
- if (EmoticonGroupName[i] == groupName) {\r
- if (i >= 1)\r
- currentGroup = (EmoticonGroup)i - 1;\r
- else\r
- currentGroup = EmoticonGroup.RecentlyUsed;\r
- }\r
- }\r
-\r
- DisplayCurrentEmoticonGroup();\r
- }\r
-\r
- private bool RemoveFromEmoticonList(int emoticonCode)\r
- {\r
- return recentEmoticons.Remove(emoticonCode);\r
- }\r
-\r
- private void UpdateRecentEmoticon(int emoticonCode)\r
- {\r
- // remove from recent emoticon list\r
- RemoveFromEmoticonList(emoticonCode);\r
-\r
- recentEmoticons.Insert(0, emoticonCode);\r
-\r
- WriteRecentEmoticonList();\r
- }\r
-\r
- private void ReadRecentEmoticonList()\r
- {\r
- string recentEmoticonString;\r
- if (Preference.Contains(RECENT_EMOTICONS))\r
- {\r
- recentEmoticonString = Preference.Get<string>(RECENT_EMOTICONS);\r
- Log.Info("NUIIME", "Read recent Emoticon string(" + recentEmoticonString + ")");\r
- }\r
- else {\r
- Log.Info("NUIIME", "Failed to read recent Emoticon string");\r
- return;\r
- }\r
-\r
- recentEmoticons.Clear();\r
-\r
- string[] emoticon_list = recentEmoticonString.Split(" ");\r
- foreach (string emoticon in emoticon_list)\r
- {\r
- if (String.IsNullOrEmpty(emoticon))\r
- continue;\r
-\r
- int emoticonCode = Int32.Parse(emoticon);\r
- recentEmoticons.Add(emoticonCode);\r
- }\r
- }\r
-\r
- private void WriteRecentEmoticonList()\r
- {\r
- string recentEmoticonString = "";\r
-\r
- foreach (int emoticonCode in recentEmoticons)\r
- {\r
- recentEmoticonString += emoticonCode + " ";\r
- }\r
-\r
- Preference.Set(RECENT_EMOTICONS, recentEmoticonString);\r
- }\r
+ 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();
+ }
+
+ 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);
+ }
}
}