[Worldclock TTS] Add screen reader support in worldclock view 42/120642/6
authorKamil Lipiszko <k.lipiszko@samsung.com>
Thu, 23 Mar 2017 11:42:32 +0000 (12:42 +0100)
committerLukasz Stanislawski <l.stanislaws@samsung.com>
Tue, 28 Mar 2017 07:59:32 +0000 (00:59 -0700)
Changed arrow buttons from edje elements to elm buttons with custom
style. Moved timezone list item time label into the textblock part
of layout.

Change-Id: Id37096da531ec643085231d20fed4665b1e1ff11

clock/inc/View/WorldClockView.h
clock/res/edje/CitiesListItem.edc
clock/res/edje/WorldClock.edc
clock/res/po/en.po
clock/src/View/TimerView.cpp
clock/src/View/WorldClockView.cpp

index 555b92422537a9b67af2cdd99c0a7df055716f78..cfdb50e51e664a98c96fa6c3a19177a57cb8b135 100644 (file)
@@ -190,12 +190,15 @@ namespace view {
                                const char *emission, const char *source);
                        static void ItemClicked(void *data, Evas_Object *obj, void *event_info);
 
+                       void CreateNavigationButtons();
+                       Evas_Object *CreateNavigationButton(const char *part);
+                       static void RightArrowButtonClickedCb(void *data, Evas_Object *obj, void *event_info);
+                       static void LeftArrowButtonClickedCb(void *data, Evas_Object *obj, void *event_info);
                        static Evas_Object *CreateTimezoneTime(Evas_Object *parent);
                        static Evas_Object *CreateTimezoneXMeridiem(Evas_Object *parent);
                        static Evas_Object *CreateTimezoneRelativeToLocalObject(Evas_Object *parent);
                        static Evas_Object *CreatePadding(Evas_Object *parent, int width);
 
-                       static Evas_Object *ContentGet(void *data, Evas_Object *obj, const char *part);
                        static char *TextGet(void *data, Evas_Object *obj, const char *part);
                        static void Del(void *data, Evas_Object *obj);
 
index e61639a479472c2fc9b05b6fc5a435a4eb5ce3c0..53f2456aedb37816b80768952acf57ffee8cc4c7 100644 (file)
@@ -36,8 +36,7 @@ collections {
                        }
                }
                data.item: "banded_bg_area" "elm.swallow.bg";
-               data.item: "texts" "date city.country gmt.offset.desc";
-               data.item: "contents" "time";
+               data.item: "texts" "time ampm date city.country gmt.offset.desc";
                parts {
                        spacer { "base"; scale;
                                desc { "default";
@@ -68,20 +67,6 @@ collections {
                                        rel1.to: "base";
                                }
                        }
-                       swallow { "time"; scale;
-                               desc { "default";
-                                       min: 173 67;
-                                       max: 173 67;
-                                       fixed: 1 1;
-                                       align: 0.0 0.0;
-                                       rel1 {
-                                               relative: 1.0 1.0;
-                                               to_x: "padding.left";
-                                               to_y: "padding.top.left";
-                                       }
-                               }
-                       }
-
                        spacer { "padding.middle"; scale;
                                desc {
                                        min: 82 0;
@@ -162,6 +147,79 @@ collections {
                                        }
                                }
                        }
+                       spacer { "time.bg"; scale;
+                               desc { "default";
+                                       min: 173 67;
+                                       max: 173 67;
+                                       fixed: 1 1;
+                                       align: 0.0 0.0;
+                                       rel1 {
+                                               relative: 1.0 1.0;
+                                               to_x: "padding.left";
+                                               to_y: "padding.top.left";
+                                       }
+                               }
+                       }
+                       textblock { "time"; scale;
+                               desc { "default";
+                                       rel1.to: "time.bg";
+                                       rel2.to: "time.bg";
+                                       align: 0.0 0.5;
+                                       text {
+                                               style: "time_ATO040";
+                                               min: 1 0;
+                                               max: 1 0;
+                                               align: 0.0 1.0;
+                                       }
+                               }
+                       }
+                       spacer { "padding.time"; scale;
+                               desc { "default";
+                                       min: 8 0;
+                                       max: 8 -1;
+                                       fixed: 1 0;
+                                       align: 0.0 0.5;
+                                       rel1 {
+                                               relative: 1.0 0.0;
+                                               to_x: "time";
+                                               to_y: "time.bg";
+                                       }
+                                       rel2.to: "time.bg";
+                               }
+                       }
+                       spacer { "padding.ampm"; scale;
+                               desc { "default";
+                                       min: 0 6;
+                                       max: -1 6;
+                                       fixed: 0 1;
+                                       align: 0.5 1.0;
+                                       rel1.to: "time.bg";
+                                       rel2.to: "time.bg";
+                               }
+                       }
+                       textblock { "ampm"; scale;
+                               desc { "default";
+                                       min: 0 40;
+                                       max: -1 40;
+                                       fixed: 0 1;
+                                       align: 0.0 1.0;
+                                       rel1 {
+                                               relative: 1.0 0.0;
+                                               to_x: "padding.time";
+                                               to_y: "time.bg";
+                                       }
+                                       rel2 {
+                                               relative: 1.0 0.0;
+                                               to_x: "time.bg";
+                                               to_y: "padding.ampm";
+                                       }
+                                       text {
+                                               style: "ampm_ATO041";
+                                               max: 1 0;
+                                               align: 0.0 0.5;
+                                       }
+                               }
+                       }
                }
        }
 }
index 8bba1495d9143ab3f53623c2f23101b969be96dc..e6c7476120cee130cc962065eaac3d8e840dffb2 100644 (file)
@@ -203,77 +203,22 @@ collections {
                                }
                        }
 
-                       image { "arrow.left.bg"; scale;
-                               desc { "default";
-                                       max: 56 80;
-                                       hid;
-                                       color_class: "B043";
-                                       rel1.to: "arrow.left";
-                                       rel2.to: "arrow.left";
-                                       image {
-                                               normal: "arrow_bg.png";
-                                               border: 10 10 10 10;
-                                       }
-                               }
-                               desc { "on.click.start";
-                                       inherit: "default";
-                                       vis;
-                                       max: (56 * 0.7) (80 * 0.7);
-                               }
-                               desc { "on.click.end";
-                                       inherit: "default";
-                                       vis;
-                                       max: 56 80;
-                               }
-                       }
-
-                       image { "arrow.left"; scale;
+                       swallow { "arrow.left"; scale;
                                desc { "default";
                                        max: 56 80;
+                                       align: 0.0 0.0;
                                        rel1 {
                                                relative: 0.0 1.0;
                                                to: "arrow.spacer.top";
                                                offset: 10 0;
                                        }
-                                       align: 0.0 0.0;
-                                       image.normal: "clock_icon_world_clock_arrow_left.png";
-                                       color_class: "AO010";
-                               }
-                       }
-
-                       image { "arrow.right.bg"; scale;
-                               desc { "default";
-                                       min: 56 80;
-                                       max: 56 80;
-                                       fixed: 1 1;
-                                       hid;
-                                       color_class: "B043";
-                                       rel1.to: "arrow.right";
-                                       rel2.to: "arrow.right";
-                                       image {
-                                               normal: "arrow_bg.png";
-                                               border: 10 10 10 10;
-                                       }
-                               }
-                               desc { "on.click.start";
-                                       inherit: "default";
-                                       vis;
-                                       min: (56 * 0.7) (80 * 0.7);
-                                       max: (56 * 0.7) (80 * 0.7);
-                                       fixed: 1 1;
-                               }
-                               desc { "on.click.end";
-                                       inherit: "default";
-                                       vis;
-                                       min: 56 80;
-                                       max: 56 80;
-                                       fixed: 1 1;
                                }
                        }
 
-                       image { "arrow.right"; scale;
+                       swallow { "arrow.right"; scale;
                                desc { "default";
                                        max: 56 80;
+                                       align: 1.0 1.0;
                                        rel1 {
                                                relative: 0.0 1.0;
                                                to_y: "arrow.spacer.top";
@@ -283,9 +228,6 @@ collections {
                                                to: "arrow.spacer.bottom";
                                                offset: -10 0;
                                        }
-                                       align: 1.0 1.0;
-                                       image.normal: "clock_icon_world_clock_arrow_right.png";
-                                       color_class: "AO010";
                                }
                        }
                }
@@ -351,65 +293,6 @@ collections {
                                }
                        }
                }
-               programs {
-
-                       //Programs for left arrow click
-                       program {
-                               name: "arrow.left.mouse.down";
-                               signal: "mouse,down,*";
-                               source: "arrow.left";
-                               action: STATE_SET "on.click.start";
-                               target: "arrow.left.bg";
-                               sequence {
-                                       action: STATE_SET "on.click.end";
-                                       target: "arrow.left.bg";
-                                       transition: LINEAR 0.05;
-                               }
-                       }
-
-                       program {
-                               name: "arrow.left.mouse.up";
-                               signal: "mouse,up,*";
-                               source: "arrow.left";
-                               action: SIGNAL_EMIT "timezone,go,left" "arrow.left";
-                               sequence {
-                                       action: STATE_SET "on.click.start";
-                                       target: "arrow.left.bg";
-                                       transition: LINEAR 0.05;
-
-                                       action: STATE_SET "default";
-                                       target: "arrow.left.bg";
-                               }
-                       }
-
-                       //Programs for right arrow click
-                       program {
-                               name: "arrow.right.mouse.down";
-                               signal: "mouse,down,*";
-                               source: "arrow.right";
-                               action: STATE_SET "on.click.start";
-                               target: "arrow.right.bg";
-                               sequence {
-                                       action: STATE_SET "on.click.end";
-                                       target: "arrow.right.bg";
-                                       transition: LINEAR 0.05;
-                               }
-                       }
-                       program {
-                               name: "arrow.right.mouse.up";
-                               signal: "mouse,up,*";
-                               source: "arrow.right";
-                               action: SIGNAL_EMIT "timezone,go,right" "arrow.right";
-                               sequence {
-                                       action: STATE_SET "on.click.start";
-                                       target: "arrow.right.bg";
-                                       transition: LINEAR 0.05;
-
-                                       action: STATE_SET "default";
-                                       target: "arrow.right.bg";
-                               }
-                       }
-               }
        }
 
        group { "timezone.details";
@@ -594,5 +477,78 @@ collections {
                        }
                }
        }
+
+       group { "elm/button/base/arrow_vertical";
+               parts {
+                       image { "btn.arrow";
+                               desc { "default";
+                                       image.normal: "clock_icon_world_clock_arrow_left.png";
+                                       color: 250 250 250 60;
+                               }
+                               desc { "right";
+                                       inherit: "default";
+                                       image.normal: "clock_icon_world_clock_arrow_right.png";
+                               }
+                       }
+                       image { "btn.bg"; scale;
+                               desc { "default";
+                                       color: 0 0 0 20;
+                                       rel1.to: "btn.arrow";
+                                       rel2.to: "btn.arrow";
+                                       image.normal: "arrow_bg.png";
+                                       hid;
+                               }
+                               desc { "pressed";
+                                       inherit: "default";
+                                       rel1 {
+                                               relative: 0.3 0.3;
+                                               to: "btn.arrow";
+                                       }
+                                       rel2 {
+                                               relative: 0.7 0.7;
+                                               to: "btn.arrow";
+                                       }
+                                       vis;
+                               }
+                               desc { "expanded";
+                                       inherit: "default";
+                                       vis;
+                               }
+                       }
+                       program {
+                               signal: "arrow.right";
+                               source: "worldclock";
+                               action: STATE_SET "right";
+                               target: "btn.arrow";
+                       }
+                       program {
+                               signal: "mouse,clicked,*";
+                               source: "btn.arrow";
+                               action: SIGNAL_EMIT "elm,action,click" "";
+                       }
+                       program {
+                               signal: "mouse,down,*";
+                               source: "btn.arrow";
+                               action: STATE_SET "pressed";
+                               target: "btn.bg";
+                               sequence {
+                                       action: STATE_SET "expanded";
+                                       target: "btn.bg";
+                                       transition: LINEAR 0.05;
+                               }
+                       }
+                       program {
+                               signal: "mouse,up,*";
+                               source: "btn.arrow";
+                               action: STATE_SET "pressed";
+                               transition: DECEL 0.05;
+                               target: "btn.bg";
+                               sequence {
+                                       action: STATE_SET "default";
+                                       target: "btn.bg";
+                               }
+                       }
+               }
+       }
 }
 
index ffe99c4e083e1a34dc36264eec696a69f4897721..c1bbfc1b0ec7543132df1734812e1e694042296b 100644 (file)
@@ -47,6 +47,12 @@ msgstr "%d h ahead"
 msgid "IDS_CLOCK_BODY_PD_H_BEHIND_ABB"
 msgstr "%d h behind"
 
+msgid "IDS_CLOCK_BODY_MOVE_TIMEZONE_TO_THE_LEFT_BTN"
+msgstr "Move by 1 timezone to the left"
+
+msgid "IDS_CLOCK_BODY_MOVE_TIMEZONE_TO_THE_RIGHT_BTN"
+msgstr "Move by 1 timezone to the right"
+
 msgid "IDS_CLOCK_BODY_SAME_AS_LOCAL"
 msgstr "Same as local time"
 
@@ -71,6 +77,9 @@ msgstr "Volume"
 msgid "IDS_CLOCK_BODY_ADD_ALARM"
 msgstr "Add alarm"
 
+msgid "IDS_CLOCK_BODY_ADD_LOCATION"
+msgstr "Add location"
+
 msgid "IDS_COM_BODY_STOPWATCH"
 msgstr "Stopwatch"
 
index 0249a990281af6a7b38b1fa07afda5d126796668..add4e3acbae5edb083d296ecafecfdda68b175ea 100644 (file)
@@ -21,6 +21,7 @@
 #include "View/MainView.h"
 #include "Utils/TizenAppUtils.h"
 #include "Utils/Log.h"
+#include "Utils/ThemeExtension.h"
 
 namespace view {
 
@@ -283,7 +284,7 @@ void TimerView::CreateSelector()
 
        CreateEntries(selector_);
 
-       elm_theme_overlay_add(NULL, GetEdjeFilePath());
+       ThemeExtension::AddTheme(GetEdjeFilePath());
 
        CreateSelectorsButton("sw.hour.inc", ButtonArrowDirection::ARROW_UP);
        CreateSelectorsButton("sw.minute.inc", ButtonArrowDirection::ARROW_UP);
index c161b8ebbfb6ef4feb13848bdadf00f210db32d1..323c548fcd657a5e8627b6096aa10b2c5c55fe72 100644 (file)
@@ -32,6 +32,8 @@
 #include "Utils/WorldClock.h"
 #include "Utils/PopupManager.h"
 #include "Utils/ThemeExtension.h"
+#include "Utils/Translate.h"
+#include "Utils/Accessibility.h"
 
 using namespace view;
 using namespace utils;
@@ -67,7 +69,7 @@ Elm_Genlist_Item_Class WorldClockView::world_clock_itc_= {
        0, 0, EINA_FALSE, EINA_TRUE,
        "worldclock.custom.list", nullptr, nullptr,
        { WorldClockView::TextGet,
-         WorldClockView::ContentGet,
+         nullptr,
          nullptr,
          WorldClockView::Del,
          nullptr,
@@ -144,64 +146,48 @@ void WorldClockView::ItemClicked(void *data, Evas_Object *obj, void *event_info)
        elm_genlist_item_selected_set(lid->it, EINA_FALSE);
 }
 
-Evas_Object *WorldClockView::ContentGet(void *data, Evas_Object *obj, const char *part)
+char *WorldClockView::TextGet(void *data, Evas_Object *obj, const char *part)
 {
        LocationItemData *lid = static_cast<LocationItemData *>(data);
-
+       if (!strcmp(part, "date"))
+               return strdup(lid->date);
+       if (!strcmp(part, "city.country"))
+               return strdup(lid->city_country);
+       if (!strcmp(part, "gmt.offset.desc"))
+               return strdup(lid->gmt_offset_relative);
        if (!strcmp(part, "time")) {
 
-               lid->time = elm_table_add(obj);
-               evas_object_size_hint_align_set(lid->time, 0.0, 0.0);
-
-               Evas_Object *time = CreateTimezoneTime(lid->time);
-               Evas_Object *padding = CreatePadding(lid->time, 8);
-               Evas_Object *ampm = CreateTimezoneXMeridiem(lid->time);
-
-               Evas_Object *dynamic_padding = elm_bg_add(lid->time);
-               evas_object_color_set(dynamic_padding, 0, 0, 0, 0);
-               evas_object_size_hint_weight_set(dynamic_padding, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-
-               elm_table_pack(lid->time, time, 0, 0, 1, 1);
-               elm_table_pack(lid->time, padding, 1, 0, 1, 1);
-               elm_table_pack(lid->time, ampm, 2, 0, 1, 1);
-               elm_table_pack(lid->time, dynamic_padding, 3, 0, 1, 1);
-
                Time t = Time::Now().InTimezone(lid->location->tzpath.c_str());
 
                std::string timezone_time;
-               std::string meridiem;
                char time_formatted[MAX_STYLE_LEN] = { 0, };
-               char ampm_formatted[MAX_STYLE_LEN] = { 0, };
 
-               if (Time::Is24HourFormatPrefered()) {
+               if (Time::Is24HourFormatPrefered())
                        timezone_time = t.Format("HH:mm");
-               } else {
+               else
                        timezone_time = t.Format("h:mm");
-                       meridiem = t.Format("a");
-               }
 
                snprintf(time_formatted, sizeof(time_formatted),
                                CUSTOM_LIST_TIME_STYLE("%s"), timezone_time.c_str());
-               elm_object_text_set(time, time_formatted);
+
+               return strdup(time_formatted);
+       }
+       if (!strcmp(part, "ampm")) {
+               if (Time::Is24HourFormatPrefered())
+                       return NULL;
+
+               char ampm_formatted[MAX_STYLE_LEN] = { 0, };
+               std::string meridiem;
+
+               Time t = Time::Now().InTimezone(lid->location->tzpath.c_str());
+               meridiem = t.Format("a");
 
                snprintf(ampm_formatted, sizeof(ampm_formatted),
                                CUSTOM_LIST_AMPM_STYLE("%s"), meridiem.c_str());
-               elm_object_text_set(ampm, ampm_formatted);
 
-               return lid->time;
+               return strdup(ampm_formatted);
        }
-       return NULL;
-}
 
-char *WorldClockView::TextGet(void *data, Evas_Object *obj, const char *part)
-{
-       LocationItemData *lid = static_cast<LocationItemData *>(data);
-       if (!strcmp(part, "date"))
-               return strdup(lid->date);
-       if (!strcmp(part, "city.country"))
-               return strdup(lid->city_country);
-       if (!strcmp(part, "gmt.offset.desc"))
-               return strdup(lid->gmt_offset_relative);
        return NULL;
 }
 
@@ -218,19 +204,6 @@ void WorldClockView::Del(void *data, Evas_Object *obj)
 /*[END] Custom list View */
 
 
-void WorldClockView::ChangeTimezoneCb(void *data, Evas_Object *obj, const char *emission,
-        const char *source)
-{
-       WorldClockView *world_clock_view = static_cast<WorldClockView *>(data);
-
-       if (!strcmp(source, "arrow.left")) {
-               world_clock_view->OnLeftArrowClicked();
-
-       } else if (!strcmp(source, "arrow.right")) {
-               world_clock_view->OnRightArrowClicked();
-       }
-}
-
 // TODO FOR DEBUGING ONLY - need to be removed when application is ready
 void message_cb(void *data, Evas_Object *obj, Edje_Message_Type type, int id, void *msg)
 {
@@ -302,12 +275,7 @@ WorldClockView::WorldClockView(ui::IView &main)
        eext_object_event_callback_add(world_clock_main_, EEXT_CALLBACK_MORE,
                         MoreButtonClicked, this);
 
-       elm_layout_signal_callback_add(world_clock_map_, "timezone,go,left",
-               "arrow.left", ChangeTimezoneCb,
-               static_cast<void *>(this));
-       elm_layout_signal_callback_add(world_clock_map_, "timezone,go,right",
-               "arrow.right", ChangeTimezoneCb,
-               static_cast<void *>(this));
+       CreateNavigationButtons();
 
        time_delta = utils::GetSecondsToNextExactMinute();
 
@@ -322,6 +290,57 @@ WorldClockView::WorldClockView(ui::IView &main)
                        std::bind(&WorldClockView::TimeFormatChanged, this));
 }
 
+void WorldClockView::LeftArrowButtonClickedCb(void *data, Evas_Object *obj, void *event_info)
+{
+       WorldClockView *world_clock_view = static_cast<WorldClockView *>(data);
+
+       world_clock_view->OnLeftArrowClicked();
+}
+
+void WorldClockView::RightArrowButtonClickedCb(void *data, Evas_Object *obj, void *event_info)
+{
+       WorldClockView *world_clock_view = static_cast<WorldClockView *>(data);
+
+       world_clock_view->OnRightArrowClicked();
+}
+
+void WorldClockView::CreateNavigationButtons()
+{
+       Evas_Object *button = CreateNavigationButton("arrow.left");
+       evas_object_smart_callback_add(button, "clicked", LeftArrowButtonClickedCb, this);
+       Accessibility::SetName(button,
+                       Translate::Sprintf("IDS_CLOCK_BODY_MOVE_TIMEZONE_TO_THE_LEFT_BTN"));
+
+       button = CreateNavigationButton("arrow.right");
+       evas_object_smart_callback_add(button, "clicked", RightArrowButtonClickedCb, this);
+       Accessibility::SetName(button,
+                       Translate::Sprintf("IDS_CLOCK_BODY_MOVE_TIMEZONE_TO_THE_RIGHT_BTN"));
+}
+
+Evas_Object *WorldClockView::CreateNavigationButton(const char *part)
+{
+       ThemeExtension::AddTheme(TizenAppUtils::GetResourcePath(TizenAppUtils::APP_DIR_RESOURCE,
+                               "edje/WorldClock.edj"));
+
+       Evas_Object *button = elm_button_add(world_clock_map_);
+
+       if (!elm_object_style_set(button, "arrow_vertical"))
+               ERR("Button style setting failed");
+
+       evas_object_size_hint_weight_set(button, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       evas_object_size_hint_align_set(button, EVAS_HINT_FILL, EVAS_HINT_FILL);
+
+       elm_object_part_content_set(world_clock_map_, part, button);
+
+       if (!strcmp(part, "arrow.right")) {
+               elm_object_signal_emit(button, "arrow.right", "worldclock");
+       }
+
+       evas_object_show(button);
+
+       return button;
+}
+
 void WorldClockView::TimeFormatChanged()
 {
        elm_genlist_realized_items_update(custom_locations_list_);
@@ -521,6 +540,8 @@ Evas_Object *WorldClockView::CreateFloatingButton()
 
        elm_object_part_content_set(fb, "button1", btn);
 
+       Accessibility::SetName(btn, Translate::Sprintf("IDS_CLOCK_BODY_ADD_LOCATION"));
+
        return fb;
 }
 
@@ -580,6 +601,8 @@ void WorldClockView::CreateTimezoneDetails()
        Evas_Object *padding_2 = CreatePadding(timezone_details_, 20);
        Evas_Object *relative = CreateTimezoneRelativeToLocalObject(world_clock_);
 
+       elm_object_focus_allow_set(timezone_details_, EINA_TRUE);
+
        elm_table_pack(timezone_details_, time, 0, 0, 1, 1);
        elm_table_pack(timezone_details_, padding_1, 1, 0, 1, 1);
        elm_table_pack(timezone_details_, ampm, 2, 0, 1, 1);