[Worldclok] Do not mirror map view 88/120088/2
authorKamil Lipiszko <k.lipiszko@samsung.com>
Tue, 21 Mar 2017 09:40:18 +0000 (10:40 +0100)
committerLukasz Stanislawski <l.stanislaws@samsung.com>
Tue, 21 Mar 2017 11:00:53 +0000 (04:00 -0700)
Setting rtl language caused map view being mirrored. This patch
fixes it and now it is displayed correctly and the same way in
both cases (rtl and not rtl languages).

Change-Id: I4e0673a55c626c7d79cd0203db1dcdf5ce9c9e64

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

index ca6c51d10107c96517a06a9b09a4c966453cffac..555b92422537a9b67af2cdd99c0a7df055716f78 100644 (file)
@@ -226,6 +226,7 @@ namespace view {
 
                        Evas_Object *world_clock_;
                        Evas_Object *world_clock_main_;
+                       Evas_Object *world_clock_map_;
                        Evas_Object *timezone_details_;
                        Evas_Object *timezone_cities_;
                        Evas_Object *custom_locations_list_;
index bdef0d4e5e22c33258d61d7b2f75c077d855accf..8bba1495d9143ab3f53623c2f23101b969be96dc 100644 (file)
@@ -83,8 +83,7 @@ collections {
                                        align: 0.5 0.0;
                                }
                        }
-                       group { "main.world.map"; scale;
-                               source:"world.map";
+                       swallow { "main.world.map"; scale;
                                desc { "default";
                                        min: 0 406;
                                        max: -1 406;
index c5b78c8a8d9e2c4833bdddcc1d78bf111bbd6f6b..c161b8ebbfb6ef4feb13848bdadf00f210db32d1 100644 (file)
@@ -223,11 +223,10 @@ void WorldClockView::ChangeTimezoneCb(void *data, Evas_Object *obj, const char *
 {
        WorldClockView *world_clock_view = static_cast<WorldClockView *>(data);
 
-
-       if (!strcmp(source, "main.world.map:arrow.left")) {
+       if (!strcmp(source, "arrow.left")) {
                world_clock_view->OnLeftArrowClicked();
 
-       } else if (!strcmp(source, "main.world.map:arrow.right")) {
+       } else if (!strcmp(source, "arrow.right")) {
                world_clock_view->OnRightArrowClicked();
        }
 }
@@ -268,20 +267,27 @@ WorldClockView::WorldClockView(ui::IView &main)
        elm_layout_theme_set(world_clock_main_, "layout", "application", "default");
 
        world_clock_ = elm_layout_add(world_clock_main_);
-
        if(!elm_layout_file_set(world_clock_,
                TizenAppUtils::GetResourcePath(TizenAppUtils::APP_DIR_RESOURCE, "edje/WorldClock.edj"),
                "main")) {
                FAT("Failed to load layout file");
        }
-
        ThemeExtension::AddTheme(TizenAppUtils::GetResourcePath(TizenAppUtils::APP_DIR_RESOURCE,
                                "edje/CitiesListItem.edj"));
-
        evas_object_size_hint_align_set(world_clock_, EVAS_HINT_FILL, EVAS_HINT_FILL);
        evas_object_size_hint_weight_set(world_clock_, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
 
-       edje_object_message_handler_set(elm_layout_edje_get(world_clock_), message_cb, NULL);
+       world_clock_map_ = elm_layout_add(world_clock_);
+       if(!elm_layout_file_set(world_clock_map_,
+               TizenAppUtils::GetResourcePath(TizenAppUtils::APP_DIR_RESOURCE, "edje/WorldClock.edj"),
+               "world.map")) {
+               FAT("Failed to load layout file");
+       }
+       evas_object_size_hint_align_set(world_clock_map_, EVAS_HINT_FILL, EVAS_HINT_FILL);
+       evas_object_size_hint_weight_set(world_clock_map_, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       edje_object_message_handler_set(elm_layout_edje_get(world_clock_map_), message_cb, NULL);
+
+       elm_object_part_content_set(world_clock_, "main.world.map", world_clock_map_);
 
        CreateTimezoneDetails();
        CreateCustomLocationsList(main.GetEvasObject());
@@ -290,14 +296,17 @@ WorldClockView::WorldClockView(ui::IView &main)
        elm_object_part_content_set(world_clock_main_, "elm.swallow.floatingbutton", fb);
        elm_object_part_content_set(world_clock_main_, "elm.swallow.content", world_clock_);
 
+       elm_object_mirrored_automatic_set(world_clock_map_, EINA_FALSE);
+       elm_object_mirrored_set(world_clock_map_, EINA_FALSE);
+
        eext_object_event_callback_add(world_clock_main_, EEXT_CALLBACK_MORE,
                         MoreButtonClicked, this);
 
-       elm_layout_signal_callback_add(world_clock_, "timezone,go,left",
-               "main.world.map:arrow.left", ChangeTimezoneCb,
+       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_, "timezone,go,right",
-               "main.world.map:arrow.right", ChangeTimezoneCb,
+       elm_layout_signal_callback_add(world_clock_map_, "timezone,go,right",
+               "arrow.right", ChangeTimezoneCb,
                static_cast<void *>(this));
 
        time_delta = utils::GetSecondsToNextExactMinute();
@@ -307,7 +316,7 @@ WorldClockView::WorldClockView(ui::IView &main)
                FAT("Unable to create timer!");
 
        map_ = new WorldClockMap(*this);
-       elm_object_part_content_set(world_clock_, "main.world.map:map", map_->GetEvasObject());
+       elm_object_part_content_set(world_clock_map_, "map", map_->GetEvasObject());
 
        time_format_change_listener_ = EventBus::AddListener<Time::PreferedTimeFormatChanged>(
                        std::bind(&WorldClockView::TimeFormatChanged, this));
@@ -535,7 +544,7 @@ void WorldClockView::UpdateTimezoneLocationsDots(const model::Timezone *timezone
                        msg->val[2] = PART_VISIBLE;
                }
                msg->val[3] = i;
-               edje_object_message_send(elm_layout_edje_get(world_clock_), EDJE_MESSAGE_INT_SET,
+               edje_object_message_send(elm_layout_edje_get(world_clock_map_), EDJE_MESSAGE_INT_SET,
                        MESSAGE_ID_SET_LOCATION_DOT_POSITION, (void *) msg);
                free(msg);
        }
@@ -544,7 +553,7 @@ void WorldClockView::UpdateTimezoneLocationsDots(const model::Timezone *timezone
 void WorldClockView::UpdateGmtOffset(const model::Timezone *timezone)
 {
        const char *offset = OffsetToString(timezone->gmt_offset);
-       elm_object_part_text_set(world_clock_, "main.world.map:timezone_offset", offset);
+       elm_object_part_text_set(world_clock_map_, "timezone_offset", offset);
 }
 
 void WorldClockView::UpdateTimezoneArea(const model::Timezone *timezone)
@@ -556,7 +565,7 @@ void WorldClockView::UpdateTimezoneArea(const model::Timezone *timezone)
        msg->val[0] = timezone->x_coord;
        msg->val[1] = timezone->zone_width;
 
-       edje_object_message_send(elm_layout_edje_get(world_clock_), EDJE_MESSAGE_INT_SET,
+       edje_object_message_send(elm_layout_edje_get(world_clock_map_), EDJE_MESSAGE_INT_SET,
                MESSAGE_ID_SET_TIMEZONE, (void *) msg);
        free(msg);
 }