WorldClock: user default "nocontents" layout 20/140220/1
authorLukasz Stanislawski <l.stanislaws@samsung.com>
Thu, 20 Jul 2017 15:28:55 +0000 (17:28 +0200)
committerLukasz Stanislawski <l.stanislaws@samsung.com>
Thu, 20 Jul 2017 15:29:52 +0000 (17:29 +0200)
WorlcClock was using application defined layout theme
for displaying "no content" information to user.
Tizen default theme provides one by default, so use
it instead custom one.

Change-Id: Iec1e1cf6897213a41309ef0876721cd6fcafd31a

clock/inc/Internal/WorldClockDefs.h
clock/inc/View/WorldClockView.h
clock/res/edje/WorldClock.edc
clock/src/View/WorldClockView.cpp

index 496719f9c77991633ddeeddad2dce7a71810f332..d66b04434474dc9d6ef0e9c60533c89285c84917 100644 (file)
@@ -45,7 +45,6 @@
 #define TIMEZONE_DETAILS_FIRST_LINE_PART "main.timezone.details:timezone.details.first.line.content"
 #define TIMEZONE_DETAILS_SECOND_LINE_PART "main.timezone.details:timezone.details.second.line.cities"
 
-#define TIMEZONE_CUSTOM_LOCATIONS_LIST_PART "main.locations.list:custom.locations.list"
 
 /* Styles names*/
 
index 3a6e30e41755f6ff858fc6170007df87248ae86b..afd1fe99064f50abfacbd553644639342bb72dde 100644 (file)
@@ -263,6 +263,7 @@ namespace view {
                        Evas_Object *timezone_cities_;
                        Evas_Object *custom_locations_list_;
                        Evas_Object *more_popup_;
+                       Evas_Object *nocontent_layout_;
 
                        const model::Location *item_last_clicked_;
                        const model::Location *item_to_add_;
index 92b5a26a9217ef5aa77cebfba05e1ca73a06df54..2303100bec26abc9f6220c3bcdccd6eb524b68b9 100644 (file)
@@ -110,8 +110,7 @@ collections {
                                        align: 0.5 0.0;
                                }
                        }
-                       group { "main.locations.list"; scale;
-                               source: "locations.list";
+                       swallow { "main.locations.list"; scale;
                                desc { "default";
                                        rel1 {
                                                relative: 0.0 1.0;
@@ -370,66 +369,6 @@ collections {
                                }
                        }
                }
-       group { "locations.list";
-
-               styles {
-                       style {
-                               name: "ATO044";
-                               base: "font=Tizen:style=Regular color=#808080aa font_size=34 align=center wrap=word";
-                               //TODO Update it when GUI designer will reply
-                       }
-               }
-
-               parts {
-                       rect { "emptylist.label.bg";
-                               desc{ "default";
-                                       color: 255 255 255 255;
-                               }
-                               desc { "hidden"
-                                       hid;
-                               }
-                       }
-                       textblock { "emptylist.label"; scale;
-                               desc { "default";
-                                       text {
-                                               style: "ATO044";
-                                               ellipsis: -1;
-                                       }
-                               }
-                               desc { "hidden";
-                                       hid;
-                               }
-                       }
-                       swallow { "custom.locations.list";
-                               desc { "default";
-                                       vis;
-                               }
-                               desc { "hidden";
-                                       hid;
-                               }
-                       }
-               }
-
-               programs {
-                       program {
-                               name: "emptylist.label.show";
-                               signal: "emptylist.label.show";
-                               source: "world_clock";
-                               action: STATE_SET "default";
-                               target: "emptylist.label";
-                               target: "emptylist.label.bg";
-                       }
-
-                       program {
-                               name: "emptylist.label.hide";
-                               signal: "emptylist.label.hide";
-                               source: "world_clock";
-                               action: STATE_SET "hidden";
-                               target: "emptylist.label";
-                               target: "emptylist.label.bg";
-                       }
-               }
-       }
 
        group { "map";
                parts {
index f53ae5d2a9a643e153812ccf94f14cbee84cef89..26441ac495d13b0eda3ab126bd92f08c975a5d8a 100644 (file)
@@ -61,7 +61,6 @@ void WorldClockView::CreateCustomLocationsList(Evas_Object *parent)
        evas_object_size_hint_expand_set(custom_locations_list_, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
        evas_object_size_hint_align_set(custom_locations_list_, EVAS_HINT_FILL, EVAS_HINT_FILL);
        elm_genlist_homogeneous_set(custom_locations_list_, EINA_TRUE);
-       elm_layout_content_set(world_clock_, TIMEZONE_CUSTOM_LOCATIONS_LIST_PART, custom_locations_list_);
 }
 
 void WorldClockView::UpdateLocationItemLanguage(LocationItemData *data)
@@ -252,6 +251,16 @@ WorldClockView::WorldClockView(ui::IView &main)
 
        elm_object_part_content_set(world_clock_, "main.world.map", world_clock_map_);
 
+       nocontent_layout_ = elm_layout_add(world_clock_);
+       if (!nocontent_layout_)
+               FAT("elm_layout_add failed");
+
+       elm_layout_theme_set(nocontent_layout_, "layout", "nocontents", "default");
+       elm_object_translatable_part_text_set(nocontent_layout_, "elm.text",
+                       "IDS_CLOCK_BODY_AFTER_YOU_ADD_CITIES_THEY_WILL_BE_SHOWN_HERE");
+       elm_layout_signal_emit(nocontent_layout_, "align.center", "elm");
+       evas_object_show(nocontent_layout_);
+
        CreateTimezoneDetails();
        CreateCustomLocationsList(main.GetEvasObject());
 
@@ -281,9 +290,6 @@ WorldClockView::WorldClockView(ui::IView &main)
 
        language_change_listener_ = EventBus::AddListener<SystemSettings::LanguageChanged>(
                        std::bind(&WorldClockView::LanguageChanged, this));
-
-       elm_object_translatable_part_text_set(world_clock_, "main.locations.list:emptylist.label",
-                       "IDS_CLOCK_BODY_AFTER_YOU_ADD_CITIES_THEY_WILL_BE_SHOWN_HERE");
 }
 
 void WorldClockView::LeftArrowButtonClickedCb(void *data, Evas_Object *obj, void *event_info)
@@ -799,12 +805,18 @@ const char *WorldClockView::OffsetToString(int offset)
 
 void WorldClockView::ShowEmptyListLabel()
 {
-       elm_layout_signal_emit(world_clock_, "emptylist.label.show", "world_clock");
+       elm_object_part_content_unset(world_clock_, "main.locations.list");
+       elm_object_part_content_set(world_clock_, "main.locations.list", nocontent_layout_);
+       evas_object_hide(custom_locations_list_);
+       evas_object_show(nocontent_layout_);
 }
 
 void WorldClockView::HideEmptyListLabel()
 {
-       elm_layout_signal_emit(world_clock_, "emptylist.label.hide", "world_clock");
+       elm_object_part_content_unset(world_clock_, "main.locations.list");
+       elm_object_part_content_set(world_clock_, "main.locations.list", custom_locations_list_);
+       evas_object_hide(nocontent_layout_);
+       evas_object_show(custom_locations_list_);
 }
 
 void WorldClockView::PostItemExistMessage(const model::Location *location)