diff options
author | Hyerim Kim <rimi.kim@samsung.com> | 2016-12-08 17:43:20 +0900 |
---|---|---|
committer | Hyerim Kim <rimi.kim@samsung.com> | 2016-12-08 17:43:20 +0900 |
commit | b3f63f352920f5be220e966924ca5dd5ecffaf9d (patch) | |
tree | 7a122de3d39a88df1381eb21b84ec69500e7ecf4 | |
parent | 1575eaa9315ec7ef4cc5f3c0e5ab8159972bebfc (diff) | |
download | w3-home-b3f63f352920f5be220e966924ca5dd5ecffaf9d.tar.gz w3-home-b3f63f352920f5be220e966924ca5dd5ecffaf9d.tar.bz2 w3-home-b3f63f352920f5be220e966924ca5dd5ecffaf9d.zip |
Modify to improve w-home notification
- Add elm_atspi_bridge_utils_is_screen_reader_enabled() to check whether tts is enable or not
- Fix bug about notification indicator
Change-Id: I2011a679c509e9d1aa92fb681504e18e7393dd0a
Signed-off-by: Hyerim Kim <rimi.kim@samsung.com>
-rwxr-xr-x | home/src/clock.c | 9 | ||||
-rwxr-xr-x | home/src/notification/noti_detail_view.c | 85 | ||||
-rw-r--r-- | home/src/notification/noti_popup_small_view.c | 44 | ||||
-rwxr-xr-x | home/src/scroller.c | 4 |
4 files changed, 97 insertions, 45 deletions
diff --git a/home/src/clock.c b/home/src/clock.c index bb5c90f..c067be7 100755 --- a/home/src/clock.c +++ b/home/src/clock.c @@ -487,8 +487,10 @@ static void _watch_face_visibility_changed_cb() if (vconf_get_bool(VCONFKEY_HOMESCREEN_WATCH_FACE_VISIBILITY, &watch_face_visibility) < 0) _E("Failed to get vconfkey[%s]", VCONFKEY_HOMESCREEN_WATCH_FACE_VISIBILITY); - if (watch_face_visibility == 1) - clock_service_read_time(); + if (elm_atspi_bridge_utils_is_screen_reader_enabled()) { + if (watch_face_visibility == 1) + clock_service_read_time(); + } } void clock_service_init(Evas_Object *win) @@ -519,7 +521,8 @@ void clock_service_init(Evas_Object *win) watch_manager_init(win); evas_object_smart_callback_add(win, WATCH_SMART_SIGNAL_ADDED, __watch_added, scroller); evas_object_smart_callback_add(win, WATCH_SMART_SIGNAL_REMOVED, __watch_removed, scroller); - clock_service_read_time(); + if (elm_atspi_bridge_utils_is_screen_reader_enabled()) + clock_service_read_time(); ret = _try_to_launch(pkg_name); if (ret < 0) { diff --git a/home/src/notification/noti_detail_view.c b/home/src/notification/noti_detail_view.c index d58b776..1b3ccc3 100755 --- a/home/src/notification/noti_detail_view.c +++ b/home/src/notification/noti_detail_view.c @@ -116,14 +116,16 @@ void noti_detail_view_set_back_key(Eina_Bool is_open_more_option) { _noti_detail_view_data_s.is_open_more_option = is_open_more_option; - if (is_open_more_option) { - elm_atspi_accessible_can_highlight_set(_noti_detail_view_data_s.box_up_ao, EINA_FALSE); - elm_atspi_accessible_can_highlight_set(_noti_detail_view_data_s.box_bottom_ao, EINA_FALSE); - elm_atspi_accessible_can_highlight_set(_noti_detail_view_data_s.more_option, EINA_TRUE); - } else { - elm_atspi_accessible_can_highlight_set(_noti_detail_view_data_s.box_up_ao, EINA_TRUE); - elm_atspi_accessible_can_highlight_set(_noti_detail_view_data_s.box_bottom_ao, EINA_TRUE); - elm_atspi_accessible_can_highlight_set(_noti_detail_view_data_s.more_option, EINA_FALSE); + if (elm_atspi_bridge_utils_is_screen_reader_enabled()) { + if (is_open_more_option) { + elm_atspi_accessible_can_highlight_set(_noti_detail_view_data_s.box_up_ao, EINA_FALSE); + elm_atspi_accessible_can_highlight_set(_noti_detail_view_data_s.box_bottom_ao, EINA_FALSE); + elm_atspi_accessible_can_highlight_set(_noti_detail_view_data_s.more_option, EINA_TRUE); + } else { + elm_atspi_accessible_can_highlight_set(_noti_detail_view_data_s.box_up_ao, EINA_TRUE); + elm_atspi_accessible_can_highlight_set(_noti_detail_view_data_s.box_bottom_ao, EINA_TRUE); + elm_atspi_accessible_can_highlight_set(_noti_detail_view_data_s.more_option, EINA_FALSE); + } } } @@ -146,6 +148,18 @@ void noti_detail_view_destroy() } _noti_detail_view_data_s.is_open_more_option = EINA_FALSE; + + if (elm_atspi_bridge_utils_is_screen_reader_enabled()) { + if (_noti_detail_view_data_s.box_bottom_ao != NULL) { + elm_access_object_unregister(_noti_detail_view_data_s.box_bottom); + _noti_detail_view_data_s.box_bottom_ao = NULL; + } + + if (_noti_detail_view_data_s.box_up_ao != NULL) { + elm_access_object_unregister(_noti_detail_view_data_s.box_up); + _noti_detail_view_data_s.box_up_ao = NULL; + } + } } static Evas_Object * _noti_create_detail_view_win() @@ -236,7 +250,9 @@ static Evas_Object* _noti_create_detail_view_scroller(Evas_Object *parent) goto OUT; } - evas_object_smart_callback_add(scroller, "scroll", _scroll_cb, NULL); + if (elm_atspi_bridge_utils_is_screen_reader_enabled()) + evas_object_smart_callback_add(scroller, "scroll", _scroll_cb, NULL); + evas_object_size_hint_weight_set(scroller, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_scroller_policy_set(scroller, ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_AUTO); evas_object_show(scroller); @@ -350,15 +366,40 @@ static void _noti_detail_view_box_pack_end() elm_box_pack_end(_noti_detail_view_data_s.box, _noti_detail_view_data_s.box_bottom); elm_box_recalculate(_noti_detail_view_data_s.box); - Evas_Object *ao = NULL; + _noti_detail_view_data_s.more_option = noti_create_more_option(_noti_detail_view_data_s.box, _noti_detail_view_data_s.circle_scroller); - ao = elm_access_object_register(_noti_detail_view_data_s.box_up, _noti_detail_view_data_s.box); - elm_atspi_accessible_description_set(ao, _noti_detail_view_data_s.up_screen_text); - elm_atspi_accessible_name_set(ao, app_name); - elm_atspi_accessible_reading_info_type_set(ao, (ELM_ACCESSIBLE_READING_INFO_TYPE_NAME | ELM_ACCESSIBLE_READING_INFO_TYPE_DESCRIPTION)); - _noti_detail_view_data_s.box_up_ao = ao; + if (elm_atspi_bridge_utils_is_screen_reader_enabled()) { + Evas_Object *ao = NULL; - _noti_detail_view_data_s.more_option = noti_create_more_option(_noti_detail_view_data_s.box, _noti_detail_view_data_s.circle_scroller); + ao = elm_access_object_register(_noti_detail_view_data_s.box_up, _noti_detail_view_data_s.box); + elm_atspi_accessible_description_set(ao, _noti_detail_view_data_s.up_screen_text); + elm_atspi_accessible_name_set(ao, app_name); + elm_atspi_accessible_reading_info_type_set(ao, (ELM_ACCESSIBLE_READING_INFO_TYPE_NAME | ELM_ACCESSIBLE_READING_INFO_TYPE_DESCRIPTION)); + _noti_detail_view_data_s.box_up_ao = ao; + + int x, y, w, h; + evas_object_geometry_get(_noti_detail_view_data_s.box_bottom, &x, &y, &w, &h); + + if (y < 300) { + if (!_noti_detail_view_data_s.box_bottom_ao) { + const char *actbtn_text = NULL; + + ao = elm_access_object_register(_noti_detail_view_data_s.box_bottom, _noti_detail_view_data_s.box); + actbtn_text = elm_object_part_text_get(_noti_detail_view_data_s.bottom_spacer, "actbtn,text"); + elm_atspi_accessible_name_set(ao, actbtn_text); + elm_atspi_accessible_reading_info_type_set(ao, ELM_ACCESSIBLE_READING_INFO_TYPE_NAME); + + char *appid = evas_object_data_get(_noti_detail_view_data_s.box, DATA_KEY_APP_ID); + elm_access_action_cb_set(ao, ELM_ACCESS_ACTION_ACTIVATE, _noti_detail_view_activate_cb, appid); + _noti_detail_view_data_s.box_bottom_ao = ao; + } + } else { + if (_noti_detail_view_data_s.box_bottom_ao) { + _noti_detail_view_data_s.box_bottom_ao = NULL; + elm_access_object_unregister(_noti_detail_view_data_s.box_bottom); + } + } + } } static bool _noti_detail_view_check_package_info(const char *package_id) @@ -505,7 +546,8 @@ static void _noti_detail_view_set_contents(Eina_Bool is_popup) _noti_detail_view_data_s.item_list = eina_list_append(_noti_detail_view_data_s.item_list, _noti_detail_view_data_s.title_label); - elm_atspi_accessible_can_highlight_set(_noti_detail_view_data_s.title_label, EINA_FALSE); + if (elm_atspi_bridge_utils_is_screen_reader_enabled()) + elm_atspi_accessible_can_highlight_set(_noti_detail_view_data_s.title_label, EINA_FALSE); free(set_text); } @@ -525,7 +567,8 @@ static void _noti_detail_view_set_contents(Eina_Bool is_popup) _noti_detail_view_data_s.item_list = eina_list_append(_noti_detail_view_data_s.item_list, _noti_detail_view_data_s.time_label); - elm_atspi_accessible_can_highlight_set(_noti_detail_view_data_s.time_label, EINA_FALSE); + if (elm_atspi_bridge_utils_is_screen_reader_enabled()) + elm_atspi_accessible_can_highlight_set(_noti_detail_view_data_s.time_label, EINA_FALSE); free(set_text); } @@ -543,7 +586,8 @@ static void _noti_detail_view_set_contents(Eina_Bool is_popup) _noti_detail_view_data_s.item_list = eina_list_append(_noti_detail_view_data_s.item_list, _noti_detail_view_data_s.contents_title_label); - elm_atspi_accessible_can_highlight_set(_noti_detail_view_data_s.contents_title_label, EINA_FALSE); + if (elm_atspi_bridge_utils_is_screen_reader_enabled()) + elm_atspi_accessible_can_highlight_set(_noti_detail_view_data_s.contents_title_label, EINA_FALSE); free(set_text); } @@ -566,7 +610,8 @@ static void _noti_detail_view_set_contents(Eina_Bool is_popup) _noti_detail_view_data_s.item_list = eina_list_append(_noti_detail_view_data_s.item_list, _noti_detail_view_data_s.paragraph_label); - elm_atspi_accessible_can_highlight_set(_noti_detail_view_data_s.paragraph_label, EINA_FALSE); + if (elm_atspi_bridge_utils_is_screen_reader_enabled()) + elm_atspi_accessible_can_highlight_set(_noti_detail_view_data_s.paragraph_label, EINA_FALSE); free(set_text); } diff --git a/home/src/notification/noti_popup_small_view.c b/home/src/notification/noti_popup_small_view.c index d14a76b..507a3e1 100644 --- a/home/src/notification/noti_popup_small_view.c +++ b/home/src/notification/noti_popup_small_view.c @@ -198,12 +198,9 @@ int noti_small_popup_view_create(notification_h notification) char *main_text = NULL; char *icon_path = NULL; char *app_name = NULL, *app_id = NULL; - char *screen_text; Evas_Object *noti_win = NULL; Evas_Object *noti_layout = NULL; - int screen_buffer_size = 0; - if (notification == NULL) { _E("notification is null"); ret = W_HOME_ERROR_FAIL; @@ -255,23 +252,30 @@ int noti_small_popup_view_create(notification_h notification) app_name = _noti_small_popup_view_get_app_name(app_id); - if (main_text) - screen_buffer_size += strlen(main_text); - if (app_name) - screen_buffer_size += strlen(app_name); - - screen_text = (char *)calloc(screen_buffer_size+5, sizeof(char)); - - if (app_name) { - strncat(screen_text, app_name, strlen(app_name)); - strncat(screen_text, ". ", 2); + /* For Accessibility */ + if (elm_atspi_bridge_utils_is_screen_reader_enabled()) { + int screen_buffer_size = 0; + char *screen_text; + + if (main_text) + screen_buffer_size += strlen(main_text); + if (app_name) + screen_buffer_size += strlen(app_name); + + screen_text = (char *)calloc(screen_buffer_size+5, sizeof(char)); + + if (app_name) { + strncat(screen_text, app_name, strlen(app_name)); + strncat(screen_text, ". ", 2); + } + if (main_text) { + strncat(screen_text, main_text, strlen(main_text)); + strncat(screen_text, ". ", 2); + } + + elm_atspi_bridge_utils_say(screen_text, EINA_FALSE, NULL, NULL); + free(screen_text); } - if (main_text) { - strncat(screen_text, main_text, strlen(main_text)); - strncat(screen_text, ". ", 2); - } - - elm_atspi_bridge_utils_say(screen_text, EINA_FALSE, NULL, NULL); /* Show notification window */ evas_object_show(noti_layout); @@ -284,8 +288,6 @@ int noti_small_popup_view_create(notification_h notification) elm_object_signal_callback_add(noti_layout, "image_clicked", "noti_popup_small_view", _noti_small_popup_view_image_clicked_cb, NULL); - free(screen_text); - /* Register callback function for auto removal */ ecore_timer_add(_NOTI_SMALL_POPUP_VIEW_AUTO_REMOVAL_INTERVAL, _noti_small_popup_view_auto_removal_timer_cb, NULL); diff --git a/home/src/scroller.c b/home/src/scroller.c index e0f0124..95ebc63 100755 --- a/home/src/scroller.c +++ b/home/src/scroller.c @@ -532,7 +532,9 @@ static void _anim_stop_cb(void *data, Evas_Object *scroller, void *event_info) ret_if(!page_info); page_info->is_focused_page = EINA_TRUE; - clock_service_set_noti_indicator_icon(); + + if (clock_service_check_noti_indicator_enable()) + clock_service_set_noti_indicator_icon(); } if (page == main_get_info()->clock_focus) { |