Use circle popup style in only wearable profile 84/90184/1
authorJihoon Kim <jihoon48.kim@samsung.com>
Thu, 29 Sep 2016 00:05:35 +0000 (09:05 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Thu, 29 Sep 2016 00:05:40 +0000 (09:05 +0900)
Change-Id: I5d74246ef02e16eeaf5364be43f387809281f97a
Signed-off-by: Jihoon Kim <jihoon48.kim@samsung.com>
src/ise-stt-mode.cpp

index b9b3db5..98c977c 100644 (file)
@@ -105,24 +105,24 @@ void voice_get_string(const char *keyValue, VoiceData *voicedata)
 
 static Eina_Bool _recognition_failure_cb(void *data)
 {
-    if (data) {
-        VoiceData *voicedata = (VoiceData *) data;
+    VoiceData *voicedata = (VoiceData *) data;
+    if (!voicedata) return ECORE_CALLBACK_CANCEL;
+
+    voicedata->state = STT_STATE_VAL_INIT;
+    set_animation_state(voicedata);
+    voicedata->refresh_timer = NULL;
 
-        voicedata->state = STT_STATE_VAL_INIT;
-        set_animation_state(voicedata);
-        voicedata->refresh_timer = NULL;
-    }
     return ECORE_CALLBACK_CANCEL;
 }
 
 static Eina_Bool hide_guide_text(void *data)
 {
-    if (data) {
-        VoiceData *voicedata = (VoiceData *) data;
-        voicedata->guide_text_timer = NULL;
-        elm_object_part_text_set(voicedata->layout_main, "elm.text", "");
-        set_guide_text(voicedata, SK_TAP_TO_PAUSE, true);
-    }
+    VoiceData *voicedata = (VoiceData *) data;
+    if (!voicedata) return ECORE_CALLBACK_CANCEL;
+
+    voicedata->guide_text_timer = NULL;
+    elm_object_part_text_set(voicedata->layout_main, "elm.text", "");
+    set_guide_text(voicedata, SK_TAP_TO_PAUSE, true);
 
     return ECORE_CALLBACK_CANCEL;
 }
@@ -151,17 +151,21 @@ void show_popup_toast(const char *text, bool check_img)
     Evas_Object *popup;
 
     popup = elm_popup_add(win_main);
+#ifdef _CIRCLE
     elm_object_style_set(popup, "toast/circle");
+#endif
     elm_popup_orient_set(popup, ELM_POPUP_ORIENT_BOTTOM);
     evas_object_size_hint_weight_set(popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
 
     if (check_img) {
         std::string path = app_get_resource_path();
         std::string path_ic = path + "/images/toast_check_icon.png";
+
         Evas_Object * img = elm_image_add(popup);
         elm_image_file_set(img, path_ic.c_str(), NULL);
         elm_object_part_content_set(popup, "toast,icon", img);
     }
+
     if (text) {
         elm_object_part_text_set(popup, "elm.text", text);
     }
@@ -192,23 +196,24 @@ void start_by_press(VoiceData *voicedata)
 {
     LOGD("start_by_press ");
     edje_object_signal_emit(_EDJ(voicedata->layout_main), "mouse,clicked,1", "background");
-    return;
 }
 
 static void on_mic_button_press_cb(void *data, Evas_Object *obj, void *event_info)
 {
     LOGD("on_mic_button_press_cb");
     VoiceData *voicedata = (VoiceData *)data;
+    if (!voicedata) return;
+
     edje_object_signal_emit(_EDJ(voicedata->layout_main), "mouse,clicked,1", "background");
 }
 
 static Eina_Bool _mic_button_enable_cb(void *data)
 {
-    if (!data)
-        return ECORE_CALLBACK_CANCEL;
-
     VoiceData* voicedata = (VoiceData*)data;
+    if (!voicedata) return ECORE_CALLBACK_CANCEL;
+
     voicedata->btn_disabling_timer = NULL;
+
     Evas_Object *button = (Evas_Object *)voicedata->mic_button;
     elm_object_disabled_set(button, EINA_FALSE);
 
@@ -365,28 +370,30 @@ void show_error_message(VoiceData *vd, stt_error_e reason)
 static Eina_Bool _start_timer_cb(void* data)
 {
     LOGD("_start_timer_cb");
-    if (data) {
-        VoiceData *voicedata = (VoiceData *) data;
 
-        try {
-            voicedata->state = STT_STATE_VAL_PREPARE_LISTENING;
-            voicedata->sttmanager->Start();
-        }
-        catch (is::stt::SttException &e) {
-            if (e.GetEcode() == STT_ERROR_OUT_OF_NETWORK)
-            {
-                set_guide_text(voicedata, _(SK_NETWORK_ERROR));
-                voicedata->state = STT_STATE_VAL_INIT;
-            } else if (e.GetEcode() == STT_ERROR_RECORDER_BUSY) {
-                show_popup_toast(_(SK_STT_BUSY), false);
-                voicedata->state = STT_STATE_VAL_INIT;
-            } else {
-                show_popup_toast(_(SK_STT_BUSY), false);
-                voicedata->state = STT_STATE_VAL_INIT;
-            }
+    VoiceData *voicedata = (VoiceData *) data;
+    if (!voicedata) return ECORE_CALLBACK_CANCEL;
+
+    try {
+        voicedata->state = STT_STATE_VAL_PREPARE_LISTENING;
+        voicedata->sttmanager->Start();
+    }
+    catch (is::stt::SttException &e) {
+        if (e.GetEcode() == STT_ERROR_OUT_OF_NETWORK)
+        {
+            set_guide_text(voicedata, _(SK_NETWORK_ERROR));
+            voicedata->state = STT_STATE_VAL_INIT;
+        } else if (e.GetEcode() == STT_ERROR_RECORDER_BUSY) {
+            show_popup_toast(_(SK_STT_BUSY), false);
+            voicedata->state = STT_STATE_VAL_INIT;
+        } else {
+            show_popup_toast(_(SK_STT_BUSY), false);
+            voicedata->state = STT_STATE_VAL_INIT;
         }
-        voicedata->start_timer = NULL;
     }
+
+    voicedata->start_timer = NULL;
+
     return ECORE_CALLBACK_CANCEL;
 }