Adopt to execute app control with mime type 37/142037/1
authorsungwook79.park <sungwook79.park@samsung.com>
Wed, 2 Aug 2017 08:52:08 +0000 (17:52 +0900)
committersungwook79.park <sungwook79.park@samsung.com>
Wed, 2 Aug 2017 08:52:08 +0000 (17:52 +0900)
Change-Id: I9fac1058198ea2c588d1c7f0985627d63905bed3
Signed-off-by: sungwook79.park <sungwook79.park@samsung.com>
inc/w-input-emoticon.h
inc/w-input-selector.h
org.tizen.inputdelegator.xml
src/w-input-emoticon.cpp
src/w-input-selector.cpp

index 709fd76..047081a 100755 (executable)
@@ -17,6 +17,7 @@
 #define W_INPUT_EMOTICON_H_
 
 void ise_show_emoticon_list(void *data);
+void launch_drawing_app(void *data);
 
 
 #endif /* W_INPUT_EMOTICON_H_ */
index c5afd21..e79cbf5 100755 (executable)
@@ -52,6 +52,8 @@ enum {
        APP_TYPE_REPLY,
        APP_TYPE_HANDWRITING,
        APP_TYPE_KEYBOARD,
+       APP_TYPE_DRAWING,
+       APP_TYPE_RECORDING,
 };
 
 enum {
@@ -59,6 +61,13 @@ enum {
        REPLY_APP_CONTROL,
 };
 
+enum {
+    MIME_TYPE_ALL = 0,
+    MIME_TYPE_IMAGE,
+    MIME_TYPE_AUDIO,
+    MIME_TYPE_TEXT,
+};
+
 typedef enum {
    TIZEN_PROFILE_UNKNOWN = 0,
    TIZEN_PROFILE_MOBILE = 0x1,
@@ -88,6 +97,7 @@ typedef struct appdata{
 
        app_control_h source_app_control;
        int app_type;
+       int mime_type;
        int reply_type;
        char* res_path;
        char* shared_res_path;
index bad1540..5b2829b 100755 (executable)
@@ -10,6 +10,7 @@
                        <mime name="text/plain"/>
                        <mime name="audio/*"/>
                        <mime name="image/*"/>
+                       <mime name="*/*"/>
                </app-control>
        </ui-application>
 
index ea1140a..a2ab3c9 100755 (executable)
@@ -883,12 +883,15 @@ void _update_emoticon_items(void *data)
     itc_dummy->func.state_get = NULL;
     itc_dummy->func.del = NULL;
 
-    Elm_Genlist_Item_Class *itc_1text_1icon = elm_genlist_item_class_new();
-    itc_1text_1icon->item_style = "drawing";
-    itc_1text_1icon->func.text_get = __emoticon_gl_text_get;
-    itc_1text_1icon->func.content_get = __emoticon_gl_1_content_get;
-    itc_1text_1icon->func.state_get = NULL;
-    itc_1text_1icon->func.del = NULL;
+    Elm_Genlist_Item_Class *itc_1text_1icon = NULL;
+    if (app_data->mime_type == MIME_TYPE_ALL) {
+        itc_1text_1icon = elm_genlist_item_class_new();
+        itc_1text_1icon->item_style = "drawing";
+        itc_1text_1icon->func.text_get = __emoticon_gl_text_get;
+        itc_1text_1icon->func.content_get = __emoticon_gl_1_content_get;
+        itc_1text_1icon->func.state_get = NULL;
+        itc_1text_1icon->func.del = NULL;
+    }
 
     Elm_Genlist_Item_Class *itc_group = elm_genlist_item_class_new();
     itc_group->item_style = "groupindex";
@@ -915,8 +918,10 @@ void _update_emoticon_items(void *data)
     it_emoticon_empty = elm_genlist_item_append(gl, itc_dummy, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
 
     // Drawing
-    it_drawing = elm_genlist_item_append(gl, itc_1text_1icon, "Doodle", NULL, ELM_GENLIST_ITEM_NONE, _drawing_item_clicked_cb, (void *)app_data);
-    first_it = it_drawing;
+    if (app_data->mime_type == MIME_TYPE_ALL) {
+        it_drawing = elm_genlist_item_append(gl, itc_1text_1icon, "Doodle", NULL, ELM_GENLIST_ITEM_NONE, _drawing_item_clicked_cb, (void *)app_data);
+        first_it = it_drawing;
+    }
 
     if (recent_emoji_list.size() > 0) {
         if (is_content_reuse_on) {
@@ -989,3 +994,12 @@ void ise_show_emoticon_list(void *data)
     }
     _update_emoticon_items(emoticon_list);
 }
+
+void launch_drawing_app(void *data)
+{
+    App_Data* ad = (App_Data*) data;
+    if (!ad)
+        return;
+
+    _drawing_item_clicked_cb(ad, NULL, NULL);
+}
index e22274d..8646781 100755 (executable)
@@ -1117,6 +1117,7 @@ void _app_service(app_control_h service, void* user_data)
 
        app_control_clone(&(app_data->source_app_control), service);
        app_data->reply_type = REPLY_APP_NORMAL;
+       app_data->mime_type = MIME_TYPE_ALL;
 
        ret = app_control_get_mime(service, &mime_type);
        if (ret != APP_CONTROL_ERROR_NONE) {
@@ -1125,13 +1126,21 @@ void _app_service(app_control_h service, void* user_data)
                if (mime_type) {
                        LOGD("mime type = %s", mime_type);
                        if (!strncmp(mime_type, "image/", strlen("image/"))) {
-
+                               app_data->mime_type = MIME_TYPE_IMAGE;
+                               app_data->app_type = APP_TYPE_DRAWING;
+                               launch_drawing_app((void *)app_data);
+                               if (mime_type)
+                                       free(mime_type);
+                               goto ACTIVATE;
                        } else if(!strncmp(mime_type, "audio/", strlen("audio/"))) {
+                               app_data->mime_type = MIME_TYPE_AUDIO;
                                app_data->app_type = APP_TYPE_STT;
                                _stt_clicked_cb((void *)app_data, NULL, NULL);
                                if (mime_type)
                                        free(mime_type);
                                goto ACTIVATE;
+                       } else if(!strncmp(mime_type, "text/", strlen("text/"))) {
+                               app_data->mime_type = MIME_TYPE_TEXT;
                        }
                }
        }