[WorldclockView] Read delete/reorder list item as one object 06/120906/4 submit/tizen/20170330.115133
authorKamil Lipiszko <k.lipiszko@samsung.com>
Fri, 24 Mar 2017 14:56:26 +0000 (15:56 +0100)
committerLukasz Stanislawski <l.stanislaws@samsung.com>
Tue, 28 Mar 2017 13:01:53 +0000 (06:01 -0700)
Previously label of time and meridiem were created on their own
and pushed into the swallow part of the items layout. It caused
screen reader frame focus at the beginning on the whole item,
next on the checkbox and again on the time label and am/mp label.
This kind of behaviour was missleading and I've moved those labels
into edc textblocks the same way as did it in worldclock view in
location list.

Change-Id: I235da09066f85895ae0db5f1b69168169883fa81

clock/inc/View/WorldClockDeleteItemsView.h
clock/inc/View/WorldClockReorderView.h
clock/res/edje/WorldClockDeleteReorderList.edc
clock/src/View/WorldClockDeleteItemsView.cpp
clock/src/View/WorldClockReorderView.cpp

index 33b284f2b633f1c05d6b59bcbd5c16762af8c4c7..c46c1117edb0d6fc0ef4b918ea55a4830dc9f5ed 100644 (file)
@@ -208,24 +208,6 @@ namespace view {
                         */
                        static void Del(void *data, Evas_Object *obj);
 
-                       /**
-                        * @brief Creates evas object for time
-                        *
-                        * @param parent parent
-                        *
-                        * @return the object
-                        */
-                       static Evas_Object *CreateTimeObject(Evas_Object *parent, utils::Time t);
-
-                       /**
-                        * @brief Creates evas object for meridiem
-                        *
-                        * @param parent parent
-                        *
-                        * @return the object
-                        */
-                       static Evas_Object *CreateXMeridiemObject(Evas_Object *parent, utils::Time t);
-
                        /**
                         * @brief Creates evas object for padding
                         *
index e1573d2ead66e776bfae4b42280835e8faa81788..74fe7e3b23363585f15663b7cef5373724728c7d 100644 (file)
@@ -140,24 +140,6 @@ namespace view {
                         */
                        static void Del(void *data, Evas_Object *obj);
 
-                       /**
-                        * @brief Creates evas object for time
-                        *
-                        * @param parent parent
-                        *
-                        * @return the object
-                        */
-                       static Evas_Object *CreateTimeObject(Evas_Object *parent, utils::Time t);
-
-                       /**
-                        * @brief Creates evas object for meridiem
-                        *
-                        * @param parent parent
-                        *
-                        * @return the object
-                        */
-                       static Evas_Object *CreateXMeridiemObject(Evas_Object *parent, utils::Time t);
-
                        /**
                         * @brief Creates evas object for padding
                         *
index 40abc743eaf06dbe940efe637f3fbfe96f90ac75..d571e798b3b97cc33a4bb6d1e6f2eeda2ca4a775 100644 (file)
@@ -19,6 +19,12 @@ collections {
 
        group { name: "elm/genlist/item/worldclock.delete/reorder.list/default";
                styles {
+                       style { name: "time_ATO040";
+                               base: "font=Tizen:style=Light color=#000000ff font_size=50 align=left";
+                       }
+                       style { name: "ampm_ATO041";
+                               base: "font=Tizen:style=Medium color=#000000ff font_size=30 align=left";
+                       }
                        style { name: "date_ATO042";
                                base: "font=Tizen:style=Regular color=#808080ff font_size=30 align=left";
                        }
@@ -30,8 +36,8 @@ collections {
                        }
                }
                data.item: "banded_bg_area" "elm.swallow.bg";
-               data.item: "texts" "date city.country gmt.offset.desc";
-               data.item: "contents" "time sw.item";
+               data.item: "texts" "time ampm date city.country gmt.offset.desc";
+               data.item: "contents" "sw.item";
                parts {
                        spacer { "base"; scale;
                                desc { "default";
@@ -62,7 +68,7 @@ collections {
                                        rel1.to: "base";
                                }
                        }
-                       swallow { "time"; scale;
+                       spacer { "time.bg"; scale;
                                desc { "default";
                                        min: 173 67;
                                        max: 173 67;
@@ -75,6 +81,66 @@ collections {
                                        }
                                }
                        }
+                       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;
+                                       }
+                               }
+                       }
                        spacer { "padding.middle"; scale;
                                desc { "default";
                                        min: 82 0;
index ce3243c0a139e6ddcf58b419fe00e51b3ba68811..d737e7df420dee1815216285b15b9f024f4722c0 100644 (file)
@@ -125,28 +125,7 @@ Evas_Object *WorldClockDeleteItemsView::ContentGet(void *data, Evas_Object *obj,
 {
        LocationDeleteItemData *ldid = static_cast<LocationDeleteItemData *>(data);
 
-       if (!strcmp(part, "time")) {
-               Time t = Time::Now().InTimezone(ldid->location->tzpath.c_str());
-
-               ldid->time = elm_table_add(obj);
-               evas_object_size_hint_align_set(ldid->time, 0.0, 0.0);
-
-               Evas_Object *time = CreateTimeObject(ldid->time, t);
-               Evas_Object *padding = CreatePaddingObject(ldid->time, 8);
-               Evas_Object *ampm = CreateXMeridiemObject(ldid->time, t);
-
-               Evas_Object *dynamic_padding = elm_bg_add(ldid->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(ldid->time, time, 0, 0, 1, 1);
-               elm_table_pack(ldid->time, padding, 1, 0, 1, 1);
-               elm_table_pack(ldid->time, ampm, 2, 0, 1, 1);
-               elm_table_pack(ldid->time, dynamic_padding, 3, 0, 1, 1);
-
-               return ldid->time;
-
-       } else if (!strcmp(part, "sw.item")) {
+       if (!strcmp(part, "sw.item")) {
                ldid->checkbox = elm_check_add(obj);
                evas_object_propagate_events_set(ldid->checkbox, EINA_FALSE);
                elm_check_state_set(ldid->checkbox, ldid->selected ? EINA_TRUE : EINA_FALSE);
@@ -167,6 +146,36 @@ char *WorldClockDeleteItemsView::TextGet(void *data, Evas_Object *obj, const cha
                return strdup(ldid->city_country);
        if (!strcmp(part, "gmt.offset.desc"))
                return strdup(ldid->gmt_offset_relative);
+       if (!strcmp(part, "time")) {
+               Time t = Time::Now().InTimezone(ldid->location->tzpath.c_str());
+
+               std::string timezone_time;
+               if (Time::Is24HourFormatPrefered())
+                       timezone_time = t.Format("HH:mm");
+               else
+                       timezone_time = t.Format("h:mm");
+
+               char time_formatted[MAX_STYLE_LEN] = { 0, };
+               snprintf(time_formatted, sizeof(time_formatted),
+                               CUSTOM_LIST_TIME_STYLE("%s"), timezone_time.c_str());
+
+               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(ldid->location->tzpath.c_str());
+               meridiem = t.Format("a");
+
+               snprintf(ampm_formatted, sizeof(ampm_formatted),
+                               CUSTOM_LIST_AMPM_STYLE("%s"), meridiem.c_str());
+
+               return strdup(ampm_formatted);
+       }
 
        return nullptr;
 }
@@ -181,48 +190,6 @@ void WorldClockDeleteItemsView::Del(void *data, Evas_Object *obj)
        delete ldid;
 }
 
-Evas_Object *WorldClockDeleteItemsView::CreateTimeObject(Evas_Object *parent, Time t)
-{
-       std::string timezone_time;
-
-       Evas_Object *label = elm_label_add(parent);
-       evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL);
-
-       if (Time::Is24HourFormatPrefered())
-               timezone_time = t.Format("HH:mm");
-       else
-               timezone_time = t.Format("h:mm");
-
-       char time_formatted[MAX_STYLE_LEN] = { 0, };
-       snprintf(time_formatted, sizeof(time_formatted),
-                       CUSTOM_LIST_TIME_STYLE("%s"), timezone_time.c_str());
-       elm_object_text_set(label, time_formatted);
-
-       evas_object_show(label);
-
-
-       return label;
-}
-
-Evas_Object *WorldClockDeleteItemsView::CreateXMeridiemObject(Evas_Object *parent, Time t)
-{
-       char ampm_formatted[MAX_STYLE_LEN] = { 0, };
-
-       Evas_Object *ampm = elm_label_add(parent);
-       evas_object_size_hint_align_set(ampm, EVAS_HINT_FILL, 0.75);
-
-       if (!Time::Is24HourFormatPrefered()) {
-               std::string 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);
-
-       evas_object_show(ampm);
-
-       return ampm;
-}
-
 Evas_Object *WorldClockDeleteItemsView::CreatePaddingObject(Evas_Object *parent, int width)
 {
        Evas_Object *padding = elm_bg_add(parent);
index 764d974af8d32e33ad29e69e1acf84c969a262c1..64122de55cd6ed112ae4f943c6e986d74277aabb 100644 (file)
@@ -189,27 +189,7 @@ Evas_Object *WorldClockReorderView::ContentGet(void *data,
 {
        LocationReorderItemData *lrid = static_cast<LocationReorderItemData *>(data);
 
-       if (!strcmp(part, "time")) {
-               Time t = Time::Now().InTimezone(lrid->location->tzpath.c_str());
-
-               lrid->time = elm_table_add(obj);
-               evas_object_size_hint_align_set(lrid->time, 0.0, 0.0);
-
-               Evas_Object *time = CreateTimeObject(lrid->time, t);
-               Evas_Object *padding = CreatePaddingObject(lrid->time, 8);
-               Evas_Object *ampm = CreateXMeridiemObject(lrid->time, t);
-
-               Evas_Object *dynamic_padding = elm_bg_add(lrid->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(lrid->time, time, 0, 0, 1, 1);
-               elm_table_pack(lrid->time, padding, 1, 0, 1, 1);
-               elm_table_pack(lrid->time, ampm, 2, 0, 1, 1);
-               elm_table_pack(lrid->time, dynamic_padding, 3, 0, 1, 1);
-
-               return lrid->time;
-       } else if (!strcmp(part, "sw.item")) {
+       if (!strcmp(part, "sw.item")) {
                Evas_Object *img = elm_image_add(obj);
 
                evas_object_size_hint_weight_set(img, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
@@ -234,59 +214,48 @@ char* WorldClockReorderView::TextGet(void* data, Evas_Object* obj,
                return strdup(lrid->city_country);
        if (!strcmp(part, "gmt.offset.desc"))
                return strdup(lrid->gmt_offset_relative);
+       if (!strcmp(part, "time")) {
+               Time t = Time::Now().InTimezone(lrid->location->tzpath.c_str());
 
-       return nullptr;
-}
-
-void WorldClockReorderView::Del(void* data, Evas_Object* obj)
-{
-       LocationReorderItemData *lrid = static_cast<LocationReorderItemData *>(data);
+               std::string timezone_time;
+               if (Time::Is24HourFormatPrefered())
+                       timezone_time = t.Format("HH:mm");
+               else
+                       timezone_time = t.Format("h:mm");
 
-       free(lrid->city_country);
-       free(lrid->date);
-       free(lrid->gmt_offset_relative);
-       delete lrid;
-}
+               char time_formatted[MAX_STYLE_LEN] = { 0, };
+               snprintf(time_formatted, sizeof(time_formatted),
+                               CUSTOM_LIST_TIME_STYLE("%s"), timezone_time.c_str());
 
-Evas_Object *WorldClockReorderView::CreateTimeObject(Evas_Object *parent, Time t)
-{
-       Evas_Object *label = elm_label_add(parent);
-       evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL);
+               return strdup(time_formatted);
+       }
+       if (!strcmp(part, "ampm")) {
+               if (Time::Is24HourFormatPrefered())
+                       return NULL;
 
-       std::string timezone_time;
+               char ampm_formatted[MAX_STYLE_LEN] = { 0, };
+               std::string meridiem;
 
-       if (Time::Is24HourFormatPrefered())
-               timezone_time = t.Format("HH:mm");
-       else
-               timezone_time = t.Format("h:mm");
+               Time t = Time::Now().InTimezone(lrid->location->tzpath.c_str());
+               meridiem = t.Format("a");
 
-       char time_formatted[MAX_STYLE_LEN] = { 0, };
-       snprintf(time_formatted, sizeof(time_formatted),
-                       CUSTOM_LIST_TIME_STYLE("%s"), timezone_time.c_str());
-       elm_object_text_set(label, time_formatted);
+               snprintf(ampm_formatted, sizeof(ampm_formatted),
+                               CUSTOM_LIST_AMPM_STYLE("%s"), meridiem.c_str());
 
-       evas_object_show(label);
+               return strdup(ampm_formatted);
+       }
 
-       return label;
+       return nullptr;
 }
 
-Evas_Object *WorldClockReorderView::CreateXMeridiemObject(Evas_Object *parent, Time t)
+void WorldClockReorderView::Del(void* data, Evas_Object* obj)
 {
-       char ampm_formatted[MAX_STYLE_LEN] = { 0, };
-       Evas_Object *ampm = elm_label_add(parent);
-       evas_object_size_hint_align_set(ampm, EVAS_HINT_FILL, 0.75);
-
-       std::string meridiem = t.Format("a");
-       if (!Time::Is24HourFormatPrefered()) {
-               std::string meridiem = t.Format(Time::FORMAT_TIME_AMPM);
-               snprintf(ampm_formatted, sizeof(ampm_formatted),
-                               CUSTOM_LIST_AMPM_STYLE("%s"), meridiem.c_str());
-       }
-       elm_object_text_set(ampm, ampm_formatted);
-
-       evas_object_show(ampm);
+       LocationReorderItemData *lrid = static_cast<LocationReorderItemData *>(data);
 
-       return ampm;
+       free(lrid->city_country);
+       free(lrid->date);
+       free(lrid->gmt_offset_relative);
+       delete lrid;
 }
 
 Evas_Object *WorldClockReorderView::CreatePaddingObject(Evas_Object *parent, int width)