Update punctuation popup for recently used punctuations. 78/41578/1
authorshoum.chen@samsung.com <shoum.chen@samsung.com>
Fri, 27 Mar 2015 06:10:58 +0000 (02:10 -0400)
committerJihoon Kim <jihoon48.kim@samsung.com>
Tue, 16 Jun 2015 12:57:55 +0000 (21:57 +0900)
Change-Id: Ia9655c04547e93f5e444b7fbe021421f83ca0be4
Signed-off-by: shoum.chen@samsung.com <shoum.chen@samsung.com>
data/layout/sdk/LYT_LANDSCAPE_QTY_CANGJIE.xml
data/layout/sdk/LYT_LANDSCAPE_QTY_CHINESE.xml
data/layout/sdk/LYT_LANDSCAPE_QTY_ENGLISH.xml
data/layout/sdk/LYT_LANDSCAPE_QTY_JAPANESE.xml
data/layout/sdk/LYT_LANDSCAPE_QTY_KOREAN.xml
data/layout/sdk/LYT_LANDSCAPE_QTY_SYM_1.xml
data/layout/sdk/LYT_LANDSCAPE_QTY_SYM_2.xml
src/ise.cpp

index f7edde1..b281b45 100644 (file)
         <rec>Space</rec>
       </key_value>
     </key>
-    <key key_type="string" popup_type="longpress_popup_once" label_type="QTY_DOT" image_label_type="IMAGE_CUE" popup_offset_x="-472" popup_offset_y="-326" width="81">
+    <key key_type="string" popup_type="longpress_popup_once" label_type="QTY_DOT" image_label_type="IMAGE_CUE" popup_offset_x="-305" popup_offset_y="-162" width="81">
       <label>
         <rec>.</rec>
       </label>
         <rec button="disabled">button/B09_Qwerty_l_btn_02.png</rec>
       </background_image>
     </key>
-    <key key_type="string" popup_type="longpress_popup_once" label_type="QTY_WWWCOM" popup_offset_x="-100" popup_offset_y="-264">
+    <key key_type="string" popup_type="longpress_popup_once" label_type="QTY_WWWCOM" popup_offset_x="-82" popup_offset_y="-302">
       <label>
         <rec>www.</rec>
       </label>
         <rec button="disabled">button/B09_Qwerty_l_btn_02.png</rec>
       </background_image>
     </key>
-    <key key_type="string" popup_type="longpress_popup_once" label_type="QTY_WWWCOM" popup_offset_x="-100" popup_offset_y="-264">
+    <key key_type="string" popup_type="longpress_popup_once" label_type="QTY_WWWCOM" popup_offset_x="-82" popup_offset_y="-302">
       <label>
         <rec>.com</rec>
       </label>
index 5d3b2df..7d95612 100644 (file)
         <rec>Space</rec>
       </key_value>
     </key>
-    <key key_type="string" popup_type="longpress_popup_once" label_type="QTY_DOT" image_label_type="IMAGE_CUE" popup_offset_x="-472" popup_offset_y="-326" width="81">
+    <key key_type="string" popup_type="longpress_popup_once" label_type="QTY_DOT" image_label_type="IMAGE_CUE" popup_offset_x="-305" popup_offset_y="-162" width="81">
       <label>
         <rec>。</rec>
       </label>
         <rec button="disabled">button/B09_Qwerty_l_btn_02.png</rec>
       </background_image>
     </key>
-    <key key_type="string" popup_type="longpress_popup_once" label_type="QTY_WWWCOM" popup_offset_x="-100" popup_offset_y="-264">
+    <key key_type="string" popup_type="longpress_popup_once" label_type="QTY_WWWCOM" popup_offset_x="-82" popup_offset_y="-302">
       <label>
         <rec>www.</rec>
       </label>
         <rec button="disabled">button/B09_Qwerty_l_btn_02.png</rec>
       </background_image>
     </key>
-    <key key_type="string" popup_type="longpress_popup_once" label_type="QTY_WWWCOM" popup_offset_x="-100" popup_offset_y="-264">
+    <key key_type="string" popup_type="longpress_popup_once" label_type="QTY_WWWCOM" popup_offset_x="-82" popup_offset_y="-302">
       <label>
         <rec>.com</rec>
       </label>
index 90b22d4..3af19f0 100755 (executable)
         <rec>Space</rec>
       </key_value>
     </key>
-    <key key_type="string" popup_type="longpress_popup_once" label_type="QTY_DOT" image_label_type="IMAGE_CUE" popup_offset_x="-472" popup_offset_y="-326" widht="81">
+    <key key_type="string" popup_type="longpress_popup_once" label_type="QTY_DOT" image_label_type="IMAGE_CUE" popup_offset_x="-305" popup_offset_y="-162" widht="81">
       <label>
         <rec>.</rec>
       </label>
         <rec button="disabled">button/B09_Qwerty_l_btn_02.png</rec>
       </background_image>
     </key>
-    <key key_type="string" popup_type="longpress_popup_once" label_type="QTY_WWWCOM" popup_offset_x="-100" popup_offset_y="-264">
+    <key key_type="string" popup_type="longpress_popup_once" label_type="QTY_WWWCOM" popup_offset_x="-82" popup_offset_y="-302">
       <label>
         <rec>www.</rec>
       </label>
         <rec button="disabled">button/B09_Qwerty_l_btn_02.png</rec>
       </background_image>
     </key>
-    <key key_type="string" popup_type="longpress_popup_once" label_type="QTY_WWWCOM" popup_offset_x="-100" popup_offset_y="-264">
+    <key key_type="string" popup_type="longpress_popup_once" label_type="QTY_WWWCOM" popup_offset_x="-82" popup_offset_y="-302">
       <label>
         <rec>.com</rec>
       </label>
index 9dd787e..72c259e 100644 (file)
         <rec>Space</rec>
       </key_value>
     </key>
-    <key key_type="string" popup_type="longpress_popup_once" label_type="QTY_DOT" image_label_type="IMAGE_CUE" popup_offset_x="-472" popup_offset_y="-326" width="81">
+    <key key_type="string" popup_type="longpress_popup_once" label_type="QTY_DOT" image_label_type="IMAGE_CUE" popup_offset_x="-305" popup_offset_y="-163" width="81">
       <label>
         <rec>。</rec>
       </label>
         <rec button="disabled">button/B09_Qwerty_l_btn_02.png</rec>
       </background_image>
     </key>
-    <key key_type="string" popup_type="longpress_popup_once" label_type="QTY_WWWCOM" popup_offset_x="-100" popup_offset_y="-264">
+    <key key_type="string" popup_type="longpress_popup_once" label_type="QTY_WWWCOM" popup_offset_x="-82" popup_offset_y="-302">
       <label>
         <rec>www.</rec>
       </label>
         <rec button="disabled">button/B09_Qwerty_l_btn_02.png</rec>
       </background_image>
     </key>
-    <key key_type="string" popup_type="longpress_popup_once" label_type="QTY_WWWCOM" popup_offset_x="-100" popup_offset_y="-264">
+    <key key_type="string" popup_type="longpress_popup_once" label_type="QTY_WWWCOM" popup_offset_x="-82" popup_offset_y="-302">
       <label>
         <rec>.com</rec>
       </label>
index 70f2497..54941ce 100755 (executable)
         <rec>Space</rec>
       </key_value>
     </key>
-    <key key_type="string" popup_type="longpress_popup_once" label_type="QTY_DOT" image_label_type="IMAGE_CUE" popup_offset_x="-472" popup_offset_y="-326" width="81">
+    <key key_type="string" popup_type="longpress_popup_once" label_type="QTY_DOT" image_label_type="IMAGE_CUE" popup_offset_x="-305" popup_offset_y="-162" width="81">
       <label>
         <rec>.</rec>
       </label>
         <rec button="disabled">button/B09_Qwerty_l_btn_02.png</rec>
       </background_image>
     </key>
-    <key key_type="string" popup_type="longpress_popup_once" label_type="QTY_WWWCOM" popup_offset_x="-100" popup_offset_y="-264" width="128">
+    <key key_type="string" popup_type="longpress_popup_once" label_type="QTY_WWWCOM" popup_offset_x="-82" popup_offset_y="-302" width="128">
       <label>
         <rec>www.</rec>
       </label>
         <rec button="disabled">button/B09_Qwerty_l_btn_02.png</rec>
       </background_image>
     </key>
-    <key key_type="string" popup_type="longpress_popup_once" label_type="QTY_WWWCOM" popup_offset_x="-100" popup_offset_y="-264">
+    <key key_type="string" popup_type="longpress_popup_once" label_type="QTY_WWWCOM" popup_offset_x="-82" popup_offset_y="-302">
       <label>
         <rec>.com</rec>
       </label>
index 76cb688..f07b45d 100644 (file)
         <rec>Space</rec>
       </key_value>
     </key>
-    <key key_type="string" popup_type="longpress_popup_once" label_type="QTY_DOT" image_label_type="IMAGE_CUE" popup_offset_x="-472" popup_offset_y="-326" width="81">
+    <key key_type="string" popup_type="longpress_popup_once" label_type="QTY_DOT" image_label_type="IMAGE_CUE" popup_offset_x="-305" popup_offset_y="-162" width="81">
       <label>
         <rec>.</rec>
       </label>
         <rec button="disabled">button/B09_Qwerty_l_btn_02.png</rec>
       </background_image>
     </key>
-    <key key_type="string" popup_type="longpress_popup_once" label_type="QTY_WWWCOM" popup_offset_x="-100" popup_offset_y="-264">
+    <key key_type="string" popup_type="longpress_popup_once" label_type="QTY_WWWCOM" popup_offset_x="-82" popup_offset_y="-302">
       <label>
         <rec>www.</rec>
       </label>
         <rec button="disabled">button/B09_Qwerty_l_btn_02.png</rec>
       </background_image>
     </key>
-    <key key_type="string" popup_type="longpress_popup_once" label_type="QTY_WWWCOM" popup_offset_x="-100" popup_offset_y="-264">
+    <key key_type="string" popup_type="longpress_popup_once" label_type="QTY_WWWCOM" popup_offset_x="-82" popup_offset_y="-302">
       <label>
         <rec>.com</rec>
       </label>
index e5254a7..8dd9791 100644 (file)
         <rec>Space</rec>
       </key_value>
     </key>
-    <key key_type="string" popup_type="longpress_popup_once" label_type="QTY_DOT" image_label_type="IMAGE_CUE" popup_offset_x="-472" popup_offset_y="-326" width="81">
+    <key key_type="string" popup_type="longpress_popup_once" label_type="QTY_DOT" image_label_type="IMAGE_CUE" popup_offset_x="-305" popup_offset_y="-162" width="81">
       <label>
         <rec>.</rec>
       </label>
         <rec button="disabled">button/B09_Qwerty_l_btn_02.png</rec>
       </background_image>
     </key>
-    <key key_type="string" popup_type="longpress_popup_once" label_type="QTY_WWWCOM" popup_offset_x="-100" popup_offset_y="-264">
+    <key key_type="string" popup_type="longpress_popup_once" label_type="QTY_WWWCOM" popup_offset_x="-82" popup_offset_y="-302">
       <label>
         <rec>www.</rec>
       </label>
         <rec button="disabled">button/B09_Qwerty_l_btn_02.png</rec>
       </background_image>
     </key>
-    <key key_type="string" popup_type="longpress_popup_once" label_type="QTY_WWWCOM" popup_offset_x="-100" popup_offset_y="-264">
+    <key key_type="string" popup_type="longpress_popup_once" label_type="QTY_WWWCOM" popup_offset_x="-82" popup_offset_y="-302">
       <label>
         <rec>.com</rec>
       </label>
index b79a8f5..46eeb47 100755 (executable)
@@ -60,6 +60,12 @@ int gLastIC = 0;
 #endif
 
 extern void set_ise_imdata(const char * buf, size_t &len);
+static void update_recent_used_punctuation(const char *key_value);
+static sclboolean g_popup_opened = FALSE;
+static vector<string> g_recent_used_punctuation;
+const int MAX_DEFAULT_PUNCTUATION = 6;
+static string g_default_punctuation[MAX_DEFAULT_PUNCTUATION] = {"-", "@", "'", "!", "?", ","};
+static string g_current_punctuation[MAX_DEFAULT_PUNCTUATION-1] = {"&", "^", "%", "$", "#"};
 
 KEYBOARD_STATE g_keyboard_state = {
     0,
@@ -462,6 +468,17 @@ SCLEventReturnType CUIEventCallback::on_event_notification(SCLUINotiType noti_ty
             g_need_send_shift_event = FALSE;
         }
     }
+    else if(noti_type == SCL_UINOTITYPE_POPUP_OPENING)
+    {
+        g_popup_opened = TRUE;
+        vector<string>::reverse_iterator iter = g_recent_used_punctuation.rbegin();
+        int punc_pos = 0;
+        for(; iter!=g_recent_used_punctuation.rend(); ++iter)
+        {
+            g_ui->set_string_substitution(g_current_punctuation[punc_pos].c_str(), iter->c_str());
+            punc_pos++;
+        }
+    }
 
     return ret;
 }
@@ -477,7 +494,7 @@ SCLEventReturnType CUIEventCallback::on_event_key_clicked(SclUIEventDesc event_d
 
     if (g_ui) {
         switch (event_desc.key_type) {
-        case KEY_TYPE_STRING:
+        case KEY_TYPE_STRING:{
             if (event_desc.key_modifier != KEY_MODIFIER_MULTITAP_START &&
                 event_desc.key_modifier != KEY_MODIFIER_MULTITAP_REPEAT) {
                     if (event_desc.key_event) {
@@ -486,7 +503,16 @@ SCLEventReturnType CUIEventCallback::on_event_key_clicked(SclUIEventDesc event_d
                         ise_send_string(event_desc.key_value);
                     }
             }
+            const sclchar *input_mode = g_ui->get_input_mode();
+            if((strcmp(input_mode, "SYM_QTY_1")) || (strcmp(input_mode, "SYM_QTY_2"))){
+                update_recent_used_punctuation(event_desc.key_value);
+            }
+            if(g_popup_opened){
+               update_recent_used_punctuation(event_desc.key_value);
+               g_popup_opened = FALSE;
+            }
             break;
+        }
         case KEY_TYPE_CHAR: {
                 sclboolean need_forward = FALSE;
                 // FIXME : Should decide when to forward key events
@@ -520,6 +546,9 @@ SCLEventReturnType CUIEventCallback::on_event_key_clicked(SclUIEventDesc event_d
                         ise_send_event(event_desc.key_event, KEY_MASK_NULL);
                     }
                 }
+                if((strcmp(input_mode, "SYM_QTY_1") == 0) || (strcmp(input_mode, "SYM_QTY_2"))){
+                    update_recent_used_punctuation(event_desc.key_value);
+                }
                 break;
             }
         case KEY_TYPE_CONTROL: {
@@ -864,6 +893,14 @@ ise_create()
         SclSize size_landscape = g_ui->get_input_mode_size(g_ui->get_input_mode(), DISPLAYMODE_LANDSCAPE);
         g_core.set_keyboard_size_hints(size_portrait, size_landscape);
     }
+
+    if(g_recent_used_punctuation.empty())
+    {
+        for(int i=0; i<MAX_DEFAULT_PUNCTUATION-1; ++i)
+        {
+            g_recent_used_punctuation.push_back(g_current_punctuation[MAX_DEFAULT_PUNCTUATION-2-i]);
+        }
+    }
 }
 
 void
@@ -1015,3 +1052,45 @@ sclboolean ise_process_key_event(const char *key)
     }
     return FALSE;
 }
+
+static void update_recent_used_punctuation(const char * key_value)
+{
+    if(NULL == key_value)
+    {
+        return;
+    }
+    for(int i=0; i<10; ++i)
+    {
+        char buf[5] = {0};
+        sprintf(buf, "%d", i);
+        if(strcmp(key_value, buf) == 0)
+        {
+            return;
+        }
+    }
+    string strKey = string(key_value);
+    for(int i=0; i<MAX_DEFAULT_PUNCTUATION; ++i)
+    {
+        if(0 == strKey.compare(g_default_punctuation[i].c_str()))
+        {
+            return;
+        }
+    }
+    vector<string>::iterator iter = g_recent_used_punctuation.begin();
+    for(; iter!=g_recent_used_punctuation.end(); ++iter)
+    {
+        if(0 == strKey.compare(iter->c_str()))
+        {
+            break;
+        }
+    }
+    if(iter != g_recent_used_punctuation.end())
+    {
+        g_recent_used_punctuation.erase(iter);
+    }
+    g_recent_used_punctuation.push_back(strKey);
+    if(g_recent_used_punctuation.size() > MAX_DEFAULT_PUNCTUATION-1)
+    {
+        g_recent_used_punctuation.erase(g_recent_used_punctuation.begin());
+    }
+}