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;
}
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);
}
{
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);
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;
}