}
}
- 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";
to: "arrow.spacer.bottom";
offset: -10 0;
}
- align: 1.0 1.0;
- image.normal: "clock_icon_world_clock_arrow_right.png";
- color_class: "AO010";
}
}
}
}
}
}
- 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";
}
}
}
+
+ 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";
+ }
+ }
+ }
+ }
}
#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;
0, 0, EINA_FALSE, EINA_TRUE,
"worldclock.custom.list", nullptr, nullptr,
{ WorldClockView::TextGet,
- WorldClockView::ContentGet,
+ nullptr,
nullptr,
WorldClockView::Del,
nullptr,
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;
}
/*[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)
{
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();
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_);
elm_object_part_content_set(fb, "button1", btn);
+ Accessibility::SetName(btn, Translate::Sprintf("IDS_CLOCK_BODY_ADD_LOCATION"));
+
return fb;
}
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);